diff --git a/app/config.py b/app/config.py index 85631fb8..20440603 100644 --- a/app/config.py +++ b/app/config.py @@ -1146,7 +1146,7 @@ class Settings(BaseSettings): security_header_csp_enabled: bool = Field(default=True, description="Enable CSP header.") security_header_csp_value: str = Field( default=( - "default-src 'self'; script-src 'self' 'unsafe-inline';" + "default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.tailwindcss.com;" " style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:;" ), description="CSP header value. Customize based on your application's resource loading needs.", diff --git a/docs/ConfigurationGuide.md b/docs/ConfigurationGuide.md index 5dc47650..b2f7ddd8 100644 --- a/docs/ConfigurationGuide.md +++ b/docs/ConfigurationGuide.md @@ -792,7 +792,7 @@ SECURITY_HEADER_CSP_VALUE="default-src 'self'; script-src 'self'; style-src 'sel SECURITY_HEADER_CSP_VALUE="default-src 'self'; script-src 'self' https://cdn.example.com; style-src 'self' 'unsafe-inline';" ``` -**Note:** The default policy includes `'unsafe-inline'` for compatibility with Tailwind CSS and inline JavaScript. For stricter security, use nonces or hashes. +**Note:** The default policy includes `'unsafe-inline'` and `https://cdn.tailwindcss.com` for compatibility with Tailwind CSS v3 Play CDN and inline JavaScript. For stricter security, use nonces or hashes. #### X-Frame-Options diff --git a/docs/ProductionReadiness.md b/docs/ProductionReadiness.md index a938e39e..fd0f3cc7 100644 --- a/docs/ProductionReadiness.md +++ b/docs/ProductionReadiness.md @@ -157,10 +157,10 @@ Recommended headers to configure at the proxy level: #### Content-Security-Policy Notes -DocuElevate's frontend uses Tailwind CSS loaded from CDN in development mode. In production, ensure your CSP allows loading scripts and styles from your configured static file origin. A starting point: +DocuElevate's frontend uses Tailwind CSS v3 Play CDN. In production, ensure your CSP allows loading scripts from `https://cdn.tailwindcss.com`. A starting point: ``` -Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; +Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.tailwindcss.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; ``` Audit and tighten this policy for your specific deployment. diff --git a/frontend/templates/base.html b/frontend/templates/base.html index bf4506b4..6f4a9dbf 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -21,8 +21,13 @@ {% block head_css %} - - + + +