Skip to content

fix(csp): add frame-src, delete unreachable IPFSDocViewer, use per-request nonce for theme script - #353

Open
ZacLou wants to merge 1 commit into
Vero-protocol:mainfrom
ZacLou:fix/issue-305-csp-frame-src-and-nonce
Open

fix(csp): add frame-src, delete unreachable IPFSDocViewer, use per-request nonce for theme script#353
ZacLou wants to merge 1 commit into
Vero-protocol:mainfrom
ZacLou:fix/issue-305-csp-frame-src-and-nonce

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 6, 2026

Copy link
Copy Markdown

Closes #305

This PR resolves the incomplete CSP policy and removes the unreachable component it blocked.

Changes

  • security-headers.js now accepts an optional nonce; when provided, script-src uses nonce-<value> instead of unsafe-inline.
  • Added frame-src 'none' to the CSP (the IPFSDocViewer iframe has been removed).
  • Added middleware.ts that generates a per-request CSP nonce and exposes it via the x-nonce response header.
  • Updated src/app/layout.tsx to read the nonce from headers() and apply it to the anti-flicker theme script.
  • Deleted the unreachable IPFSDocViewer component, its helpers, and tests.
  • Replaced an innerHTML clear in Leaderboard.tsx with replaceChildren().
  • Extended __tests__/security-headers.test.js to assert frame-src is present and that a supplied nonce removes unsafe-inline from script-src.

Verification

  • npx tsc --noEmit passes
  • ESLint passes
  • Unit tests pass

…quest nonce for theme script

Closes Vero-protocol#305

- security-headers.js now accepts an optional nonce; when present,
  script-src uses 'nonce-<value>' and drops 'unsafe-inline'.
- Added frame-src 'none' to the CSP.
- Added middleware.ts that generates a per-request CSP nonce and exposes
  it via the x-nonce response header.
- Updated src/app/layout.tsx to read the nonce and apply it to the
  anti-flicker theme script.
- Deleted the unreachable IPFSDocViewer component, its helpers, and tests.
- Replaced an innerHTML clear in Leaderboard.tsx with replaceChildren().
- Extended __tests__/security-headers.test.js to cover nonce and frame-src.
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.

Add frame-src to the CSP (or delete the unreachable IPFSDocViewer it blocks)

1 participant