fix(web): add baseline security response headers#1934
Open
richiemcilroy wants to merge 3 commits into
Open
Conversation
|
Paragon Review Skipped Hi @richiemcilroy! Your Polarity credit balance is insufficient to complete this review. Please visit https://app.paragon.run to finish your review. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Member
Author
|
@greptileai please review the PR |
Member
Author
|
@greptileai please review the PR |
Member
Author
|
@greptileai please review the PR |
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.
Adds baseline security response headers (X-Content-Type-Options, Referrer-Policy, HSTS, DNS-prefetch-control) globally. No framing restriction is added, so embedded videos keep working.
Greptile Summary
This PR adds a baseline set of security response headers to the Next.js app —
X-Content-Type-Options,Referrer-Policy,X-DNS-Prefetch-Control, and HSTS — applied globally, with targetedX-Frame-Options: SAMEORIGINguards on sensitive authenticated routes. Previous feedback on DNS prefetch direction, HSTS preload deferral, and admin/verify-otp coverage has been addressed./:path*):nosniff,strict-origin-when-cross-originreferrer policy, DNS prefetch off, and a 2-year HSTS withincludeSubDomains(nopreload, intentionally deferred).X-Frame-Options: SAMEORIGINadded for/dashboard,/onboarding,/admin,/verify-otp,/login, and/signup; public embeddable routes (/s,/embed,/c) are deliberately excluded./invite/:path*(the org-invite acceptance page) is not in the protected list and can still be embedded cross-origin.Confidence Score: 4/5
Safe to merge after adding /invite/:path* to the framing-protection list — everything else in the header baseline is correct and the intentional omissions are well-documented.
The invite-acceptance page (/invite/[inviteId]) was left out of the X-Frame-Options route list. It has interactive buttons that POST to org-membership API endpoints, so a cross-origin iframe embedding it is a real clickjacking vector. All other parts of the change look correct.
apps/web/next.config.mjs — the framing-protection route list needs /invite/:path* added.
Security Review
apps/web/next.config.mjs, line 109):/invite/[inviteId]is excluded from theX-Frame-Options: SAMEORIGINprotection added by this PR. The page lets authenticated users accept or decline org invitations via direct API calls, making it a viable clickjacking target for forcing unintended org-membership changes.Important Files Changed
Prompt To Fix All With AI
Reviews (4): Last reviewed commit: "fix(web): extend clickjacking protection..." | Re-trigger Greptile