From 0a632e08629cd39359c4f200f5bf832ba72195e3 Mon Sep 17 00:00:00 2001 From: Paul Lizer Date: Fri, 26 Sep 2025 13:50:10 -0600 Subject: [PATCH 1/7] Development (#466) * Update release notes to show support for GPT-5 * Documented support for gpt-image-1 * Update config.py * remove documentation folder * Documentation and message table support (#444) * Develop demo docs and import markdown table support * fixed enhanced citations for groups and public workspaces * Updated to support showing public workspaces in scope * Update config.py * fix docs * Updated RELEASE_NOTES * docs demos for public workspaces * V0.229 bug fixes (v0.229.019) (#448) * Development (#445) * Update release notes to show support for GPT-5 * Documented support for gpt-image-1 * Update config.py * remove documentation folder * Documentation and message table support (#444) * Develop demo docs and import markdown table support * fixed enhanced citations for groups and public workspaces * Updated to support showing public workspaces in scope * Update config.py * fix docs * Updated RELEASE_NOTES * video indexer config details, doc intel test button fix, move multimedia configs to search and extract * improved header security * updated versions * moved * Update EXTERNAL_HEALTH_CHECK_DUPLICATION_FIX.md * added pdfs * v0.229.019 bug fixes upgrade to v0.229.058 (#452) * all urls in chat open in new tabs * consolidated admin settings for improved navigation * added left hand nav admin settings menus * added left hand menu options for workspaces * Added debug logging to video indexer processes * readme and functional test * Workspace Scope in Chat affects Prompts * Create WORKSPACE_SCOPE_PROMPTS_FIX.md * time based turn off for debug and file process logging * improve saving in admin settings * update to v0.229.058 * Update RELEASE_NOTES.md * Update RELEASE_NOTES.md * Popup modal for Health Check config * Added Health Check config guide * Chat page top nav bug (#458) * initial fix * fixed top nav chat up bug * notes for v0.229.060 * moved to correct location * Fixed enhanced citations CSP bug Simple Chat implemented improved security which negatively impacted enhanced citations. * Updated release notes --- RELEASE_NOTES.md | 54 ++++- application/single_app/config.py | 5 +- .../v0.229.062/ENHANCED_CITATIONS_CSP_FIX.md | 212 +++++++++++++++++ .../test_enhanced_citations_csp_fix.py | 216 ++++++++++++++++++ 4 files changed, 484 insertions(+), 3 deletions(-) create mode 100644 docs/fixes/v0.229.062/ENHANCED_CITATIONS_CSP_FIX.md create mode 100644 functional_tests/test_enhanced_citations_csp_fix.py diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c479bb93..c1ba78df 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,19 @@ # Feature Release +### **(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 @@ -52,6 +65,46 @@ #### Bug Fixes +### **(v0.229.058)** + +#### New Features + +* **Admin Left-Hand Navigation Enhancement** + * Introduced an innovative dual-navigation approach for admin settings, providing both traditional top-nav tabs and a modern left-hand hierarchical navigation system. + * **Key Features**: Conditional navigation that automatically detects layout preference, hierarchical structure with two-level navigation (tabs → sections), smart state management for active states and submenus. + * **Comprehensive Organization**: All admin tabs now include organized sub-sections with proper section targeting for enhanced navigation. + * **Benefits**: Matches conversation navigation patterns users already know, provides better organization for complex admin settings, enables bookmarkable deep links to specific sections. + * (Ref: `admin_settings.html`, `_sidebar_nav.html`, `admin_sidebar_nav.js`) + +* **Time-Based Logging Turnoff Feature** + * Provides administrators with automatic turnoff capabilities for debug logging and file process logging to manage costs and security risks. + * **Cost Management**: Prevents excessive logging costs by automatically disabling logging after specified time periods (minutes to weeks). + * **Risk Mitigation**: Reduces security risks by ensuring debug logging doesn't remain enabled indefinitely. + * **Configuration Options**: Supports time ranges from 1-120 minutes, 1-24 hours, 1-7 days, and 1-52 weeks for both debug logging and file processing logs. + * **Background Monitoring**: Daemon thread monitors and enforces timer expiration automatically. + * (Ref: `admin_settings.html`, `route_frontend_admin_settings.py`, `app.py`) + +* **Comprehensive Table Support Enhancement** + * Enhanced table rendering to support multiple input formats ensuring tables from AI agents or users are properly displayed as styled HTML tables. + * **Format Support**: Unicode box-drawing tables (┌─┬─┐ style), markdown tables wrapped in code blocks, pipe-separated values (PSV) in code blocks, standard markdown tables. + * **Processing Pipeline**: Implements preprocessing pipeline that detects and converts various table formats to standard markdown before parsing. + * **Bootstrap Integration**: All generated tables automatically receive Bootstrap styling with striped rows and responsive design. + * (Ref: `chat-messages.js`, table conversion functions, functional tests) + +* **Public Workspace Management Enhancement** + * Added "Go to Public Workspace" button to Public Workspace Management page for quick navigation from management to workspace usage. + * **User Experience**: One-click navigation from management page to public workspace, automatically sets workspace as active for the user. + * **Consistency**: Aligns with existing Group Workspace management functionality, provides consistent workflow between management and usage. + * (Ref: `manage_public_workspace.html`, `route_frontend_public_workspaces.py`) + +* **Multimedia Support Reorganization** + * Reorganized Multimedia Support section from "Other" tab to "Search and Extract" tab with comprehensive Azure AI Video Indexer configuration guide. + * **Enhanced Configuration**: Added detailed setup instructions modal with step-by-step account creation, API key acquisition guidelines, and troubleshooting section. + * **Improved Organization**: Groups related search and extraction capabilities together, maintains all existing multimedia settings and functionality. + * (Ref: `admin_settings.html`, `_video_indexer_info.html`) + +#### Bug Fixes + * **Admin Configuration Improvements** * Addressed user feedback about admin settings organization and implemented critical improvements to reduce confusion and provide better guidance. * **Duplicate Health Check Fix**: Consolidated health check configuration in General tab, removed duplicate from Other tab, added missing form field processing. @@ -88,7 +141,6 @@ * (Ref: `functions_authentication.py`, `functions_documents.py`, Video Indexer workflow logging) ### **(v0.229.014)** - #### Bug Fixes ##### Public Workspace Management Fixes diff --git a/application/single_app/config.py b/application/single_app/config.py index e3461e10..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.061" +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: `