Skip to content

fix(oauth-bff): carry relative redirectTo paths through the state cookie - #1858

Merged
aliaska-varieva merged 1 commit into
mainfrom
fix/bff-relative-redirectto
Aug 22, 2026
Merged

fix(oauth-bff): carry relative redirectTo paths through the state cookie#1858
aliaska-varieva merged 1 commit into
mainfrom
fix/bff-relative-redirectto

Conversation

@aliaska-varieva

Copy link
Copy Markdown
Contributor

Problem

After #1841 the SSO registration/invite finalize passes redirectTo to /oauth/continue — but on prod there is still no redirection: the frontend sends a relative path (/auth/login), and OAuthBffService only stores absolute URLs in the state cookie's rt claim (isAbsoluteUrl(...) ? x : null), so the value is dropped before the callback.

Fix

Allow a safe relative path (single leading /; //host and /\ scheme-relative variants excluded — they can leave the site, a plain path cannot) through the rt claim in both places (authorize-redirect build and state-cookie decode). AuthorizeData.redirectToAbs renamed to redirectTo accordingly (no external consumers).

What a relative value means is up to the RedirectTargetResolver: the default (OSS) resolver already returns it verbatim; the SaaS TenantDomainRedirectResolver gets 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

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>
@aliaska-varieva
aliaska-varieva merged commit ff2b781 into main Aug 22, 2026
6 checks passed
@aliaska-varieva
aliaska-varieva deleted the fix/bff-relative-redirectto branch August 22, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant