Harden the renderer CSP (sec #2)

The policy fell back to default-src for scripts and allowed
'unsafe-inline', so any future injection sink would run with the
renderer's full contextBridge authority. The page has no inline scripts
(one external module), so split the directives: script-src 'self' with
no inline, style-src keeps 'unsafe-inline' for React inline styles, and
add object-src/base-uri/frame-src 'none'. localhost stays only on
script/connect for the dev server. Verified the production build still
loads and renders end to end.
This commit is contained in:
ZacharyZhang-NY committed 2026-06-26 18:05:58 -04:00
1 parent 867070f575
commit 03c4b5376d
1 file changed
+1 -1
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self' 'unsafe-inline' http://localhost:* ws://localhost:* data:; img-src 'self' data:; font-src 'self' data:;"
content="default-src 'self'; script-src 'self' http://localhost:*; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' http://localhost:* ws://localhost:*; object-src 'none'; base-uri 'none'; frame-src 'none';"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AgentCompany</title>