fix(oauth-bff): carry relative redirectTo paths through the state cookie - #1858
Merged
Conversation
Only absolute URLs survived into the rt claim, so a relative redirectTo (what the frontend sends, e.g. /auth/login) was silently dropped and the callback fell back to the default target. A single-leading-slash path cannot redirect off-site, so it is now carried too; //host and /\ variants stay excluded. The RedirectTargetResolver decides what it means — the SaaS resolver maps it onto the tenant's own domain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
After #1841 the SSO registration/invite finalize passes
redirectToto/oauth/continue— but on prod there is still no redirection: the frontend sends a relative path (/auth/login), andOAuthBffServiceonly stores absolute URLs in the state cookie'srtclaim (isAbsoluteUrl(...) ? x : null), so the value is dropped before the callback.Fix
Allow a safe relative path (single leading
/;//hostand/\scheme-relative variants excluded — they can leave the site, a plain path cannot) through thertclaim in both places (authorize-redirect build and state-cookie decode).AuthorizeData.redirectToAbsrenamed toredirectToaccordingly (no external consumers).What a relative value means is up to the
RedirectTargetResolver: the default (OSS) resolver already returns it verbatim; the SaaSTenantDomainRedirectResolvergets a companion PR to resolve it against the tenant's own domain.Compile verified cross-repo against openframe-saas-shared (999-SNAPSHOT).
🤖 Generated with Claude Code