Repository navigation
Give the desktop setup window a strict Content Security Policy - #2143
Merged
Merged
Conversation
The bundled setup page was served with no Content Security Policy. It now loads scripts and styles only from its own files, images from its own files, data URIs and https (an app's icon on the move to OpenBot Cloud), reaches the shell only over Tauri's IPC, and frames only the OpenBot for Business booking calendar. Nothing inline or evaluated runs, and nothing can frame the window. The setup window's real-browser tests serve the page with that policy and check that the first screen and the booking calendar draw with nothing refused, and that a script put into the page is refused. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4kRRs8251kXTRWNeNywkH
davidmckayv
marked this pull request as ready for review
November 24, 2026 19:34
davidmckayv
requested review from
MikeRyanDev,
davidmckayv,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 24, 2026 19:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Add a strict Content Security Policy to the bundled desktop setup page (defense-in-depth).
desktop/src-tauri/tauri.conf.jsonhadapp.security.csp: null, so the page Tauri serves from../distran with no policy.Each source comes from what the page loads:
'self': the Vite build has no inline scripts or styles (Reactstyleprops go through CSSOM, which CSP allows). Tauri adds hashes for its own scripts when it serves the page.data: https:: the brand marks are inlined SVG data URIs (marks.ts), and the move to OpenBot Cloud shows each app'siconUrlfrom the app directory.data:: Inter is bundled. Vite emits it as files, but a build that inlines a small font as a data URI still draws.fetch/WebSocket calls. Everything goes throughinvoke, so only Tauri IPC is allowed (ipc:on macOS/Linux,http://ipc.localhoston Windows).BOOKING_CALENDAR_ORIGIN).Dev (
devUrl) is unaffected. Tauri desktop loads the dev server directly. Navigations to the running OpenBot app are external URLs, which this policy doesn't cover.Where it runs
Desktop app only: no server state, replicas, serialisation, fan-out, listeners or schedules.
Boundary and audit
No change to the gateway, refusals or client trust.
API and database
api/, no app's requests, no database change and norelease-policy.json.Changelog
No deployment behaves differently: this only changes the policy the desktop app serves its own setup page with.
Proof
Tests are in
desktop/src/setupLayout.browser.test.ts. One test asserts the configured policy (it runs in the normal suite). Two run in a real headless Chromium (CI jobapp (real browser, desktop setup window)): they serve the window with the policy header fromtauri.conf.jsonand record everysecuritypolicyviolation.Red (before,
csp: null):Green (after):
The browser test catches real breakage. With
font-src 'self'alone, the harness build reported 7font-src dataviolations, which is whydata:is allowed. Withframe-src 'none', the booking calendar never loads and the test fails.Also run locally:
bun run typecheck: cleanbun run build: passescargo checkinsrc-tauri: passesbun test desktop/src: 556 pass, 0 failsetupLayout.browser.test.ts: 170 pass, 1 fail. The failure is "with scrollbars that take room, as Windows draws them…". It also fails on unchangedmainon macOS, so it is not related to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4kRRs8251kXTRWNeNywkH