Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/desktop/src/renderer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
- script-src 'self' 'wasm-unsafe-eval' https://*.posthog.com: Allow scripts from same origin + WebAssembly (for xterm ImageAddon) + PostHog
- style-src 'self' 'unsafe-inline': Allow styles from same origin + inline (needed for CSS-in-JS)
- connect-src 'self' ws: wss: %NEXT_PUBLIC_API_URL% %NEXT_PUBLIC_ELECTRIC_URL% %NEXT_PUBLIC_STREAMS_URL% https://*.posthog.com https://*.sentry.io sentry-ipc:: Allow WebSocket + API + Electric proxy + Streams server + PostHog + Sentry
- img-src 'self' data: https: Allow images from same origin + data URIs + any HTTPS source (needed for favicons from arbitrary sites in browser history)
- img-src 'self' data: https: http: blob:: Allow images from any source (needed for favicons and browser pane webview content)
- font-src 'self': Allow fonts from same origin
- frame-src https: http: data: blob:: Allow webview browser pane to load any URL
- child-src 'self' blob:: Allow workers from same origin + blob workers
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://*.posthog.com; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: %NEXT_PUBLIC_API_URL% %NEXT_PUBLIC_ELECTRIC_URL% %NEXT_PUBLIC_STREAMS_URL% https://*.posthog.com https://*.sentry.io sentry-ipc:; img-src 'self' data: https:; font-src 'self';" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://*.posthog.com; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: %NEXT_PUBLIC_API_URL% %NEXT_PUBLIC_ELECTRIC_URL% %NEXT_PUBLIC_STREAMS_URL% https://*.posthog.com https://*.sentry.io sentry-ipc:; img-src 'self' data: https: http: blob:; font-src 'self'; frame-src https: http: data: blob:; child-src 'self' blob:;" />
Comment on lines +17 to +20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

data: in frame-src enables arbitrary-HTML frames — remove it unless explicitly required.

data: URIs as a content source allows loading arbitrary content; this is insecure since an attacker can inject arbitrary data: URIs. It should be avoided and is not recommended. Allowing data: in frame-src means any code path that can influence a frame's src could inject a data:text/html,<script>...</script> payload. For the browser-pane use case (loading http:/https: sites in a webview), data: is not needed. The http: and https: sources already cover all legitimate frame/webview loading scenarios.

🛡️ Proposed fix
-      - frame-src https: http: data: blob:: Allow webview browser pane to load any URL
+      - frame-src https: http: blob:: Allow webview browser pane to load any URL
-    <meta http-equiv="Content-Security-Policy" content="...; frame-src https: http: data: blob:; child-src 'self' blob:;" />
+    <meta http-equiv="Content-Security-Policy" content="...; frame-src https: http: blob:; child-src 'self' blob:;" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- frame-src https: http: data: blob:: Allow webview browser pane to load any URL
- child-src 'self' blob:: Allow workers from same origin + blob workers
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://*.posthog.com; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: %NEXT_PUBLIC_API_URL% %NEXT_PUBLIC_ELECTRIC_URL% %NEXT_PUBLIC_STREAMS_URL% https://*.posthog.com https://*.sentry.io sentry-ipc:; img-src 'self' data: https:; font-src 'self';" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://*.posthog.com; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: %NEXT_PUBLIC_API_URL% %NEXT_PUBLIC_ELECTRIC_URL% %NEXT_PUBLIC_STREAMS_URL% https://*.posthog.com https://*.sentry.io sentry-ipc:; img-src 'self' data: https: http: blob:; font-src 'self'; frame-src https: http: data: blob:; child-src 'self' blob:;" />
- frame-src https: http: blob:: Allow webview browser pane to load any URL
- child-src 'self' blob:: Allow workers from same origin + blob workers
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://*.posthog.com; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss: %NEXT_PUBLIC_API_URL% %NEXT_PUBLIC_ELECTRIC_URL% %NEXT_PUBLIC_STREAMS_URL% https://*.posthog.com https://*.sentry.io sentry-ipc:; img-src 'self' data: https: http: blob:; font-src 'self'; frame-src https: http: blob:; child-src 'self' blob:;" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/renderer/index.html` around lines 17 - 20, Remove the
insecure "data:" source from the Content-Security-Policy meta tag's frame-src
directive in the renderer index.html (the meta tag with
http-equiv="Content-Security-Policy"); update the content attribute so frame-src
only contains https: and http: (and blob: if still required for other uses) —
ensure you do not reintroduce "data:" anywhere in the frame-src value while
keeping other directives (script-src, style-src, connect-src, img-src,
child-src) unchanged.

</head>

<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ export function usePersistentWebview({
webview = document.createElement("webview") as Electron.WebviewTag;
webview.setAttribute("partition", "persist:superset");
webview.setAttribute("allowpopups", "");
webview.style.display = "flex";
webview.style.flex = "1";
webview.style.width = "100%";
webview.style.height = "100%";
webview.style.border = "none";
Expand Down
Loading