From b11f31fbadc5b37f5b49a675886dcdc2e9a84ad9 Mon Sep 17 00:00:00 2001 From: chen Date: Wed, 17 Jun 2026 00:19:18 +0800 Subject: [PATCH 1/5] feat: add Content-Security-Policy header and externalize theme-init --- app.py | 20 ++++++++++++++++++++ docs/architecture.md | 15 +++++++++++++++ static/index.html | 21 ++------------------- static/js/hljs-theme-init.js | 10 ++++++++++ static/js/theme-init.js | 7 +++++++ tests/test_api_integration.py | 9 +++++++++ 6 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 static/js/hljs-theme-init.js create mode 100644 static/js/theme-init.js diff --git a/app.py b/app.py index bcaaab1..dbaaf82 100644 --- a/app.py +++ b/app.py @@ -13,6 +13,21 @@ from api.sessions import sessions_bp from utils.exclusion_rules import load_rules, resolve_exclusion_rules_path +# Content-Security-Policy for all Flask responses. 'unsafe-inline' in style-src is +# required because highlight.js themes apply inline styles; can be tightened with +# nonces later. script-src lists cdnjs only — keep in sync with SRI +