Response headers and content policy
Middleware generates a per-request nonce and is the single document-CSP authority. Production policy blocks nonce-less inline scripts, restricts framing and narrows third-party script, frame and connection origins. Embeds receive a separately reviewed framing contract.
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Content-Security-Policy: script-src 'nonce-…' 'strict-dynamic' …
Source: next.config.ts (SECURITY_BASE_HEADERS), src/lib/security/csp-builder.ts, src/middleware.ts
Signed events and observable failures
Inbound provider webhooks verify signatures before business logic and record verification evidence. Outbound partner events are signed. Structured logs, request identifiers, audit records and Sentry capture provide correlation, with scrubbers reducing the chance that credentials or common personal-data patterns reach telemetry.
const verified = await verifyWebhookSignature(request, provider);
if (!verified.ok) {
return Response.json({ error: 'invalid_signature' }, { status: 401 });
}
Source: src/lib/webhooks/webhook-verify-helpers.ts, src/lib/observability, src/lib/audit
Recovery and operational controls
Database, storage and external-system recovery have documented runbooks, reconciliation steps and restore-drill evidence. Feature flags and kill switches reduce rollout blast radius. Recovery objectives remain conditional on verified provider configuration such as PITR; the platform does not publish an unverified RPO as a guarantee.
release change
→ staged rollout
→ monitor errors and payment funnel
→ kill switch or rollback when abort criteria fire
Source: docs/DISASTER_RECOVERY.md, docs/BACKUP_RULES.md, docs/ROLLOUT_RULES.md