check:test-evidence requires every e2e spec to use the strict fixture, which fails on the zod eval console error. The smoke now sets zod's global config jitless before page scripts run and requires zero violations; without that init script it fails on the known probe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.8 KiB
Markdown
30 lines
1.8 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 or console error (review 13-08). One
|
|
violation is known: zod probes `Function("")` on its first object schema and
|
|
the policy refuses it. Parsing still works, but the default build reports the
|
|
violation on every boot until zod is configured `jitless` before the first
|
|
schema is built. `z.config` in the entry module is too late, because the
|
|
bundler evaluates the shared chunks that build schemas first. The smoke sets
|
|
zod's global config before page scripts run so it can catch every other
|
|
violation; the spec comment names when to remove that. 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.
|