feat: harden the HTTP edge (CSP, security headers, timeouts, panics) #290
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.65) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 322 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.346
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #290"
general
weight: 0.35
gabrielzubovsky
What and why
Part of #180. Every
platform-apiresponse now carries a strict page CSP and baseline security headers. Requests time out per route group, and a handler panic answers a generic 500. The CSP is the main control against injected script driving the crypto worker's keys (THREAT_MODEL A3).backend/crates/platform-api/page-csp.txt. The backend compiles it in andvite previewreads it. Its only cross-origin entry is the exact URL of Google's attestation key set.X-Content-Type-Options: nosniff,Referrer-Policy: no-referrer,X-Frame-Options: DENY,Cache-Control: no-store.- query routes:
QUERY_SLOT_WAIT_SECS+QUERY_TIMEOUT_SECS+ 60 s- upload PUTs: a 30 s body gap (408), no total
- everything else: 60 s (503)
VITE_API_BASE_URL(same origin, ADR 0005). No CORS layer.redirect: "error"on the key-set fetch. Both need #286's code and follow in a PR stacked on it. HSTS and static serving are #181.How it was tested
tests/edge_api.rsandedge.rsunit tests:- headers on 200, 401, 404, 405 and 413, and on timeouts and panics, each appearing exactly once
- a handler's own headers are overridden
- a hung read gets 503, a stalled upload body gets 408, and a slow but steady upload succeeds
- query routes get the query timeout
- a timed-out query frees its slot, and a cut upload commit leaves nothing visible
- a panic gives a generic 500, a fixed log line and a metrics count
connect-srcmatches the key-set URL.scripts/check-page-headers.shchecks a release preview's headers on/,/index.htmland the worker script. A Chromium smoke test inbrowser.ymlruns a wasm operation in the worker under the policy.Checklist
scripts/check.shpasses locallySECURITY_AUDIT_EVENTcovered byaudit_coverage.rs(none new: timeouts and panics aren't security decisions)docs/DATA_POLICY.md)CHANGELOG.mdupdated for user-visible changesdocs/adr/if one was made (none: the origin decision is ADR 0005)