fix(security): add content security policy#2353
Merged
jeanduplessis merged 14 commits intomainfrom May 7, 2026
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by gpt-5.5-2026-04-23 · 674,061 tokens |
e107972 to
0ae27d6
Compare
4edb41e to
a5b97f0
Compare
RSO
reviewed
Apr 24, 2026
RSO
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Code-related pentest M3 CSP finding is addressed with a global CSP builder, CSP report-only by default, Sentry security-policy reporting, and explicit allowlists for known production integrations.
M3: Global Content Security Policy
proxy.ts, while preserving existing magic-link no-cache/noindex headers.CSP_MODE=enforce|report-only|offrollout control. Default isreport-only;report-onlyemitsContent-Security-Policy-Report-Only;enforceemitsContent-Security-Policy;offskips CSP and reporting headers.report-uri,report-to,Report-To, andReporting-Endpoints, deriving the security endpoint fromNEXT_PUBLIC_SENTRY_DSN.connect-srcentries for Sentry ingest and explicit Gastown WebSocket origins derived fromNEXT_PUBLIC_GASTOWN_URL.headers()in the root layout and avoiding site-wide dynamic rendering for CSP.CSP_ADDITIONAL_*env override support because changing env still requires redeployment.script-src 'unsafe-inline'andstyle-src 'unsafe-inline'for Next.js static App Router compatibility and runtime styles. This is weaker than nonce-only CSP but avoids breaking hydration or forcing every route dynamic.Verification
N/A
Visual Changes
N/A
Reviewer Notes
CSP_MODE=enforceis explicitly set.CSP_MODE=enforceafter validating core flows.CSP_MODE=offor return to report-only and redeploy; no hot CSP allowlist override remains.