feat: add IFRAME_CSP env var for srcdoc iframe content security policy
Adds an IFRAME_CSP environment variable that injects a Content-Security-Policy <meta> tag into all srcdoc iframes rendering untrusted content: - Artifacts (LLM-generated HTML previews) - FullHeightIframe (tool/embed output) - FilePreview (user-uploaded HTML files) - CitationModal (RAG document HTML) Shared utility in src/lib/utils/csp.ts handles injection with HTML-safe attribute escaping. URL-based iframes (src=) are correctly excluded. Env-var only — no PersistentConfig, no admin UI, no DB. Set once at deploy time, requires restart. Empty string (default) means no CSP restriction.
This commit is contained in:
1 parent
1388f4568b
commit
3bba1c2270
8 files changed
+30
-6
No files matched your search
@@ -309,6 +309,7 @@ type Config = {
|
||||
ui?: {
|
||||
pending_user_overlay_title?: string;
|
||||
pending_user_overlay_content?: string;
|
||||
iframe_csp?: string;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user