feat(auth): add parent_origin parameter to embedded login prompt URL#2834
Open
rodrigo-fournier-immutable wants to merge 1 commit intomainfrom
Open
feat(auth): add parent_origin parameter to embedded login prompt URL#2834rodrigo-fournier-immutable wants to merge 1 commit intomainfrom
rodrigo-fournier-immutable wants to merge 1 commit intomainfrom
Conversation
Co-authored-by: Rodrigo Fournier <rodrigo-fournier-immutable@users.noreply.github.com>
|
View your CI Pipeline Execution ↗ for commit 877d30c
☁️ Nx Cloud last updated this comment at |
JCSanPedro
approved these changes
Apr 9, 2026
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.
Hi👋, please ensure the PR title follows the below standards:
type(scope): message. For example:feat(passport): my new feature!after thetype(scope), for examplefeat(passport)!: my new breaking featureSecurity context
This PR is part of the remediation for SAR-127 — Passport Headless Login (internal doc), tracked under BLO-9.
What the assessment found:
The embedded login iframe was using
postMessage(data, "*")— a wildcard target origin — when communicating back to the parent window. This means any page capable of embedding the iframe could intercept messages containing sensitive authentication data (tokens, user session information). A malicious actor hosting such a page would receive those messages silently, with no way for the iframe to distinguish a legitimate parent from a hostile one.How this PR addresses it:
By appending
parent_origin=<encoded-origin>to the iframesrcURL, the SDK now tells the embedded login prompt which origin legitimately spawned it. The companion PR passport-login#211 reads that parameter and uses it as the explicittargetOriginin everypostMessagecall — replacing the wildcard. This ensures authentication messages are only delivered to the window that is authorised to receive them.Summary
Appends
parent_originquery parameter to the embedded login prompt iframe URL so the iframe can validate the parent origin forpostMessagetrust verification. This change works in conjunction with passport-login#211 and both are intended to address the task BLO-9.Detail and impact of the change
Added
parent_originquery parameter to the iframe src URL ingetHref()methodwindow.location.origin) to the/im-embedded-login-promptiframeencodeURIComponentAnything else worth calling out?
This change enables the embedded login prompt iframe to verify which parent origin to trust when handling cross-origin
postMessagecommunication, improving security for the embedded authentication flow.Slack Thread