fix(auth): dual-read session_challange and session_challenge cookie names - #141
Open
thekauer wants to merge 1 commit into
Open
fix(auth): dual-read session_challange and session_challenge cookie names#141thekauer wants to merge 1 commit into
thekauer wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
…ames Server-side companion change in databricks-eng/neon-cloud#6472 fixes a historically misspelled session-challenge cookie name (session_challange -> session_challenge) and dual-writes both names during the migration window. This SDK change reads either name so old and new server builds in the field both work. The legacy const is preserved as NEON_AUTH_LEGACY_SESSION_CHALLANGE_COOKIE_NAME and can be dropped once all production Neon Auth deployments have shipped the dual-write change.
thekauer
force-pushed
the
andras/dual-read-session-challenge-cookie
branch
from
June 30, 2026 13:27
2e9112e to
59b315b
Compare
Collaborator
Author
|
Rebased onto main (was 6 commits behind) to clear staleness; no conflicts. The oauth unit tests pass locally (18/18, including the new dual-read cookie cases). Real CI was already green; the only red checks are Vercel and the claude-review bot, which are infra/bot noise. Ready for review. Heads up though: this is a coordinated change that tracks neon-cloud#6472 (the session_challange -> session_challenge cookie-name spelling fix on the server side). Please do not merge it before the neon-cloud server change is out, otherwise the dual-read has nothing to coordinate with. Review now, hold the merge until #6472 lands. |
4 tasks
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.
Problem
The Neon Auth server has historically set a session-challenge cookie under the misspelled name
session_challange. The server is now correcting the spelling tosession_challengeand dual-writes both names during a transition window — see databricks-eng/neon-cloud#6472. This SDK still hard-coded the legacy name; it needs to read either so old and new server builds in the field both work.Summary of changes
NEON_AUTH_LEGACY_SESSION_CHALLANGE_COOKIE_NAMEfor the misspelled name.NEON_AUTH_SESSION_CHALLENGE_COOKIE_NAMEvalue to the correctly-spelledsession_challenge(the constant identifier was already correctly spelled).packages/auth/src/server/middleware/oauth.ts, dual-read inline at both call sites (needsSessionVerificationandexchangeOAuthToken): try the new name first, fall back to legacy via??.needsSessionVerificationandexchangeOAuthToken), new-name happy path, and both-present preferring new name.packages/auth/src/server/proxy/response.tsaudited and is name-agnostic — it allowlistsSet-Cookieas a header type and pass-through copies cookies without inspecting their names. No change needed there. Existingresponse.test.tsfixtures continue to usesession_challangesince they represent old-server output the SDK should still handle.processor.test.ts:65fixture also kept onsession_challangefor the same reason.Verification
Ran in
packages/auth:vitest runover the four touched/adjacent test files (oauth.test.ts,processor.test.ts,response.test.ts,handler.test.ts) — 60/60 pass, including 4 new tests for dual-read.vitest runsuite — 151/151 pass; two pre-existing test-file failures (src/index.test.ts,src/core/adapter-core.test.ts) are unrelated, caused by workspace deps@neondatabase/internal/@neondatabase/auth-uinot being built locally (nopnpm build), and reproduce onmain.eslinton the three changed files — clean.tsc --noEmitagainst the three changed files — no errors. Same workspace-dep issues affect typecheck across the package; they are pre-existing.Follow-up
Once all production Neon Auth deployments have shipped the dual-write change (databricks-eng/neon-cloud#6472), the legacy constant + fallback can be dropped. Patch release recommended after merge per the original feedback thread.