diff --git a/CSP_VERIFICATION_GUIDE.md b/CSP_VERIFICATION_GUIDE.md new file mode 100644 index 00000000..de4c914e --- /dev/null +++ b/CSP_VERIFICATION_GUIDE.md @@ -0,0 +1,119 @@ +# Django 6.0 CSP Security Implementation - Verification Guide + +## Summary of Changes + +### Step 4: Middleware Configuration ✅ +- **File**: `dejacode/settings.py` +- **Change**: Added `django.middleware.security.ContentSecurityPolicyMiddleware` after `SecurityMiddleware` +- **Location**: Line 176 +- **Status**: ✅ Complete + +### Step 5: CSP Dictionary Configuration ✅ +- **File**: `dejacode/settings.py` +- **Changes**: + - Imported CSP utility: `from django.utils.csp import CSP` (Line 18) + - Added CSP configuration starting at line 205 + - Set `SECURE_CSP_REPORT_ONLY = True` for initial audit phase + - Configured CSP directives: + - `default-src`: `[CSP.SELF]` - Only allow same-origin content by default + - `script-src`: Allows self, nonces, and CloudFront CDN + - `style-src`: Allows self, Google Fonts, and CloudFront CDN + - `img-src`: Allows self, data URIs, and HTTPS sources + - `connect-src`: Allows self (for API calls to PurlDB/VulnerableCode) +- **Status**: ✅ Complete + +### Step 6: Template Updates with Nonce Support ✅ +- **Method**: Automated Python script (`add_nonces_to_templates.py`) +- **Results**: + - Processed: 254 HTML template files + - Updated: 52 files with nonce attributes + - Pattern Applied: ` {% include 'includes/dependencies-json-viewer.js.html' %} {% if open_add_to_package_modal %} - - - - {% if include_purldb %} - - - \ No newline at end of file diff --git a/license_library/templates/license_library/license_details.html b/license_library/templates/license_library/license_details.html index e219dde7..ae87c6d9 100644 --- a/license_library/templates/license_library/license_details.html +++ b/license_library/templates/license_library/license_details.html @@ -18,7 +18,7 @@ {% if use_annotator %} - - - - - {% endif %} - - -