Repository navigation
fix(oauth): bind the OAuth state to the client that started sign-in - #465
Merged
Merged
Conversation
This was referenced Oct 21, 2026
Merged
Merged
Bccorb
marked this pull request as ready for review
October 21, 2026 01:44
5 of 35 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.
Closes #463.
What
POST /oauth/:providerId/startreturns a randombinding(32 bytes, base64url) next tostate. Only its SHA-256 goes into the signed state; it is never put in the authorization URL.POST /oauth/:providerId/callbacktakesbindingand refuses a state whose hash it does not match (constant-time), before the replay cache records the state and before the provider is contacted. A wrong binding therefore cannot use up a state its rightful client has yet to finish.oauth_login_failedwithstate_binding_missingorstate_binding_mismatch(was a singleinvalid_state), so an operator can see old clients during the upgrade.OAUTH_ALLOW_UNBOUND_STATE=trueaccepts a callback with no binding, warns at boot, and is removed in v0.20. A binding that is sent is always checked.docs/oauth.mdanddocs/configuration.mddescribe the binding and the escape hatch.Contract change
Additive in the schemas, but by default it refuses OAuth callbacks from clients that do not send
binding. Patch changeset by maintainer decision (v0.19 ships as 0.19.x); the changeset body states the break.Ripple:
@seamless-auth/types(feat(oauth): add the state binding to the start response and callback request seamless-auth-types#104) adds the field. This PR needs that release: with types 0.28.0 the request schema stripsbinding, so CI fails until the dependency is bumped. Draft until then.@seamless-auth/client/react/react-native: keepbindingfromstartOAuthLoginand send it fromfinishOAuthLogin(PR to follow).Checks (local, against the unreleased types build)
npm run test:run: 138 files, 1891 passed, 1 todonpm run coverage: all files 98.93 statements / 95.43 branches / 99.29 functions / 99.16 lines