Skip to content

security: rc.4 CSP hardening for instrument egress - #83

Merged
huximaxi merged 1 commit into
mainfrom
claude/blissful-dewdney-2f2410
Sep 13, 2026
Merged

security: rc.4 CSP hardening for instrument egress#83
huximaxi merged 1 commit into
mainfrom
claude/blissful-dewdney-2f2410

Conversation

@huximaxi

@huximaxi huximaxi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Sets a restrictive CSP in desktop/src-tauri/tauri.conf.json (default-deny + IPC-only connect-src), closing the network-egress advisory raised in PR feat: v0.6.0-beta: desktop cockpit (maps rail + tools gate-ledger) + 1.6 scope + beta cut #79's review: srcdoc iframes inherit the embedder's CSP, so palace-authored cockpit instruments had unrestricted fetch/XHR/beacon/img egress despite the iframe sandbox already blocking IPC and app-origin access.
  • Exempts script-src/style-src from Tauri's asset-CSP hash injection (dangerousDisableAssetCspModification) so instrument inline scripts/styles keep running under 'unsafe-inline' in release builds: otherwise CSP3 would silently void it once Tauri injects hashes.
  • Adds csp_gate_tests in desktop/src-tauri/src/main.rs as a config-regression tripwire (default-deny shape, IPC-only connect-src, no remote origins in any directive, inline-script viability, MapFrame sandbox has no allow-same-origin).
  • Updates MapFrame comments in dashboard.rs and the README's security-gates list to describe enforcement rather than convention.

Threat model: an actor who can write instrument HTML already runs code as a cron: this is defense-in-depth, not a hole.

Test plan

  • cargo test in desktop/src-tauri — 27/27 passing (includes new csp_gate_tests)
  • Release build (npm run tauri:build) succeeds; verified the exact CSP string is embedded in the shipped binary
  • Release app boots and stays alive
  • Browser-based mechanics proof against the real dist/ output under the exact shipped CSP: app wasm fetches/compiles/runs; a sandbox="allow-scripts" srcdoc probe shows inline scripts still run while fetch/image-beacon egress is blocked with connect-src/img-src CSP violations and zero network requests reach the remote host
  • Manual pass in the native window (not run here — no screen access in this environment): flip through cockpit tabs, confirm instruments render and are interactive

@huximaxi
huximaxi force-pushed the claude/blissful-dewdney-2f2410 branch from 4e4d6f7 to b4cf437 Compare July 3, 2026 16:23
@huximaxi
huximaxi force-pushed the claude/blissful-dewdney-2f2410 branch from b4cf437 to 597e32a Compare September 9, 2026 07:37
…network-egress follow-up)

srcdoc iframes inherit the embedder's CSP, so palace-authored instrument
HTML in the cockpit's MapFrame had unrestricted network egress despite
the sandbox already blocking IPC/app-origin access. Sets a restrictive
CSP in tauri.conf.json (default-deny + IPC-only connect-src), keeps
instrument inline scripts/styles runnable by exempting them from
Tauri's asset-CSP hash injection, and adds csp_gate_tests as a
config-regression tripwire.
@huximaxi
huximaxi force-pushed the claude/blissful-dewdney-2f2410 branch from 597e32a to 537555d Compare September 9, 2026 11:12
@huximaxi
huximaxi marked this pull request as ready for review September 9, 2026 11:12
@huximaxi
huximaxi merged commit eff76d9 into main Sep 13, 2026
5 checks passed
@huximaxi
huximaxi deleted the claude/blissful-dewdney-2f2410 branch September 13, 2026 10:04
huximaxi added a commit that referenced this pull request Sep 13, 2026
#83 (rc.4 CSP hardening) and #87 touch the same two desktop files
(dashboard.rs, src-tauri/main.rs); auto-merged cleanly, disjoint regions,
no manual resolution. loci-cli/ unchanged by this merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant