The declared CSP was never applied in a browser. A Playwright spec now serves
the build with config/hosting/security-headers.json and fails on any
securitypolicyviolation. It found one: zod's Function('') probe, listed in the
spec as a known violation until zod is configured jitless before first use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.5 KiB
Markdown
26 lines
1.5 KiB
Markdown
# Browser security boundary
|
|
|
|
The browser bundle is public. Secrets, token lifecycle, raw HTML injection,
|
|
dynamic code execution, untrusted script URLs, and public production source
|
|
maps are prohibited defaults.
|
|
|
|
`config/hosting/security-headers.json` is the declared header set. Hosting
|
|
verification compares that declaration with live responses. CSP deliberately
|
|
omits `unsafe-inline` and `unsafe-eval`; production code and built assets must
|
|
remain compatible with that baseline. `tests/e2e/production-csp.spec.ts` (part of
|
|
`test:e2e`, FE-GATE-008) serves the build with these headers and fails on a
|
|
`securitypolicyviolation` event (review 13-08). One violation is known and
|
|
listed in that spec: zod probes `Function("")` on its first object schema and
|
|
the policy refuses it. Parsing still works; the report is noise until zod is
|
|
configured `jitless` before the first schema is built. Features that are off by
|
|
default need CSP additions when a project selects them; see step 9 in
|
|
[optional adapter recipes](../architecture/optional-adapter-recipes.md).
|
|
`connect-src 'self' https:` lets script reach any HTTPS origin. Narrowing it to
|
|
the runtime config's `API_BASE_URL` and `TELEMETRY_ENDPOINT` origins needs a
|
|
header generated per environment at deploy time, because those values are set
|
|
per deployment (`scripts/generate-runtime-config.ts`). That generator does not
|
|
exist yet; a project that deploys should add it with its provider adapter.
|
|
|
|
Route guards are UX hints and client validation does not replace backend
|
|
authorization or validation.
|