Skip to content

Add nonce CSP, framing protection, and security.txt - #78

Merged
criptogus merged 1 commit into
mainfrom
fix/security-headers-txt-20261028
Oct 28, 2026
Merged

criptogus merged 1 commit into
mainfrom
fix/security-headers-txt-20261028

Conversation

@criptogus

Copy link
Copy Markdown
Owner

Changes

Production HTML now receives a per-request nonce CSP, frame-ancestors 'none', and X-Frame-Options: DENY through the existing TanStack server wrapper, including 404 and fallback error responses. Lovable preview hosts permit self and the Lovable editor through CSP, with SAMEORIGIN as the legacy framing fallback. HTML uses no-store to prevent nonce reuse.

The nonce flows through TanStack/React streaming, hydration, and JSON-LD. Script policies avoid unsafe-inline and unsafe-eval. Allowlists cover this app's Supabase project, Stripe embedded checkout, Cloudflare challenges, Google Fonts, and Lovable OAuth; Flock scripts and analytics are same-origin. Inline styles remain allowed for React/Radix/charts. The fallback retry link no longer needs an inline script handler.

Adds RFC 9116 /.well-known/security.txt as a public file plus an explicit plain-text route for hosts that skip dot-directory assets. Uses contact@zeroagency.ai from SECURITY.md; expires 2027-04-28.

Validation

  • 10 targeted tests pass: response-security and security-source-state.
  • TypeScript check, ESLint for changed TS/TSX, and production build pass (existing build warnings remain).
  • Local generated Cloudflare Worker: homepage/about return 200 with CSP and DENY; 404 retains headers; all rendered scripts match the CSP nonce; consecutive requests have distinct nonces.
  • Local /.well-known/security.txt returns 200 and text/plain with the expected document.
  • vite preview has an existing output-path mismatch; validated with local Wrangler instead.

No deployment/publication or Lovable AI credits used. Live HTTP behavior remains unchanged until this PR is merged and deployed separately. Authenticated checkout/OAuth flows were inspected in source but not transacted end to end.

@criptogus
criptogus merged commit b247842 into main Oct 28, 2026
3 checks passed
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