diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 04f8b792..c1ba78df 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,20 @@ # Feature Release -### **(v0.229.060)** +### **(v0.229.062)** + +#### Bug Fixes + +* **Enhanced Citations CSP Fix** + * Fixed Content Security Policy (CSP) violation that prevented enhanced citations PDF documents from being displayed in iframe modals. + * **Issue**: CSP directive `frame-ancestors 'none'` blocked PDF endpoints from being embedded in iframes, causing console errors: "Refused to frame '...' because an ancestor violates the following Content Security Policy directive: 'frame-ancestors 'none''". + * **Root Cause**: Enhanced citations use iframes to display PDF documents via `/api/enhanced_citations/pdf` endpoint, but the restrictive CSP policy prevented same-origin iframe embedding. + * **Solution**: Changed CSP configuration from `frame-ancestors 'none'` to `frame-ancestors 'self'`, allowing same-origin framing while maintaining security against external clickjacking attacks. + * **Security Impact**: No reduction in security posture - external websites still cannot embed application content, only same-origin framing is now allowed. + * **Benefits**: Enhanced citations PDF modals now display correctly without CSP violations, improved user experience for document viewing. + * (Ref: `config.py` SECURITY_HEADERS, `test_enhanced_citations_csp_fix.py`, CSP policy update) + +### **(v0.229.061)** #### Bug Fixes diff --git a/application/single_app/config.py b/application/single_app/config.py index 59e2e39a..1078e6f4 100644 --- a/application/single_app/config.py +++ b/application/single_app/config.py @@ -88,7 +88,8 @@ EXECUTOR_TYPE = 'thread' EXECUTOR_MAX_WORKERS = 30 SESSION_TYPE = 'filesystem' -VERSION = "0.229.084" +VERSION = "0.229.062" + SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production') @@ -107,7 +108,7 @@ "connect-src 'self' https: wss: ws:; " "media-src 'self' blob:; " "object-src 'none'; " - "frame-ancestors 'none'; " + "frame-ancestors 'self'; " "base-uri 'self';" ) } diff --git a/docs/fixes/v0.229.062/ENHANCED_CITATIONS_CSP_FIX.md b/docs/fixes/v0.229.062/ENHANCED_CITATIONS_CSP_FIX.md new file mode 100644 index 00000000..ae82521e --- /dev/null +++ b/docs/fixes/v0.229.062/ENHANCED_CITATIONS_CSP_FIX.md @@ -0,0 +1,212 @@ +# ENHANCED_CITATIONS_CSP_FIX + +**Fixed in version:** 0.229.061 + +## Overview + +This fix resolves a Content Security Policy (CSP) violation that prevented enhanced citations PDF documents from being displayed in iframe modals. The issue was caused by the CSP directive `frame-ancestors 'none'` which blocked the PDF endpoints from being embedded in iframes, even when served from the same origin. + +## Issue Description + +Users reported that enhanced citations PDF modals were not loading, with the browser console showing CSP violations: + +``` +Refused to frame 'https://simplechatapp-dev-*.azurewebsites.net/api/enhanced_citations/pdf?...' +because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'". +``` + +### Root Cause Analysis + +1. **CSP Policy Too Restrictive**: The `frame-ancestors 'none'` directive prevented ANY page from being embedded in a frame or iframe, including same-origin content +2. **Enhanced Citations Architecture**: Enhanced citations use iframes to display PDF documents via the `/api/enhanced_citations/pdf` endpoint +3. **Same-Origin Blocking**: Even though the PDF content was served from the same origin, the CSP policy blocked the iframe embedding + +### Technical Background + +Enhanced citations display PDFs using the following approach: +- JavaScript creates an iframe element: `