Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(csp): Remove nonce from style-src to allow dynamic styles

LearningCircuitaecd033f7228
diff --git a/src/local_deep_research/web/app_factory.py b/src/local_deep_research/web/app_factory.py
index a60223b833..afb2491462 100644
--- a/src/local_deep_research/web/app_factory.py
+++ b/src/local_deep_research/web/app_factory.py
@@ -333,14 +333,15 @@ def apply_middleware(app):
nonce = getattr(g, "csp_nonce", "")
# Define a secure CSP with nonce support
- # Removed unsafe-eval for security
- # Using unsafe-hashes to allow inline event handlers (onclick, etc.) temporarily
- # connect-src restricted to localhost only - this is intentional for local-first architecture
- # This application is designed to run locally on the user's machine, not in the cloud
+ # Removed unsafe-eval for security (main XSS vector)
+ # Using unsafe-hashes to allow inline event handlers (onclick, etc.) - to be refactored
+ # Keeping unsafe-inline for styles (low security risk, allows dynamic styling)
+ # Note: When nonce is present, unsafe-inline is ignored, breaking JS-set styles
+ # connect-src restricted to localhost only - intentional for local-first architecture
csp = (
"default-src 'self'; "
f"script-src 'self' 'nonce-{nonce}' 'unsafe-hashes'; "
- f"style-src 'self' 'nonce-{nonce}' 'unsafe-inline'; "
+ "style-src 'self' 'unsafe-inline'; "
"connect-src 'self' ws://localhost:* wss://localhost:* ws://127.0.0.1:* wss://127.0.0.1:*; "
"font-src 'self' data:; "
"img-src 'self' data: blob:; "