[BUG Follow-up] Extend clickjacking protections to all auth pages#496
Merged
benjaminfh merged 1 commit intomasterfrom Feb 25, 2026
Conversation
Apply anti-framing headers to login and related auth pages so iframe-based clickjacking is blocked consistently. This updates middleware response handling to set headers on both normal and redirect responses without altering auth flow behavior. - add dedicated helpers to target auth-related routes for clickjacking protection - set X-Frame-Options and CSP frame-ancestors headers for applicable middleware responses - cover login redirect and additional auth pages with middleware tests
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Updates to [Preview Branch (codex/2026-02-25/github-mention-bug]-fix-clickjacking-vurnerability) ↗︎](https://supabase.com/dashboard/project/mersykfigxgsnbbmjbvl)
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
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.
Motivation
Description
shouldApplyClickjackingProtectionandwithClickjackingHeadershelpers tomiddleware.tsto centralize the anti-framing logic and decisioning for protected paths.X-Frame-Options: DENYandContent-Security-Policy: frame-ancestors 'none'for matching routes (/login,/check-email,/forgot-password,/reset-password, and/auth/*).NextResponse.next(), redirect responses, maintenance responses, and the incomplete-env 500 response) by wrapping returned responses withwithClickjackingHeaderswhen the requestpathnamematches.tests/server/middleware.test.tsto assert the new anti-framing headers on the authenticated/loginredirect and on other auth pages like/forgot-passwordand/check-email.Testing
npm test -- tests/server/middleware.test.tsusingvitest, and all tests passed (4 tests, 1 file).x-frame-optionsandcontent-security-policyheaders on protected auth pages and on the login redirect, and they succeeded.Codex Task