IS-11764 Ignore external browser flow messages from an unexpected origin - #304
Merged
Merged
Conversation
aleixsuau
requested review from
luisgoncalves,
urre and
vahag-curity
and
a lite review from Copilot
August 25, 2026 06:29
Contributor
There was a problem hiding this comment.
Pull request overview
Updates external browser flow handling to ignore unexpected-origin messages while preserving strict validation for valid Curity messages.
Changes:
- Separates origin filtering from payload validation.
- Continues waiting after third-party-origin messages.
- Adds coverage for the updated behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Summary |
|---|---|
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/external-browser-flow/external-browser-flow.ts |
Ignores messages from unexpected origins. |
src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/external-browser-flow/external-browser-flow.spec.ts |
Tests updated origin-handling behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…gin. The external window legitimately navigates to third-party origins mid-flow, and code on those pages can post to its opener. Treating such a message as fatal killed the login flow. Ignore it and keep waiting for Curity's message. Non-string data from the Curity origin still rejects, as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
aleixsuau
force-pushed
the
fix/dev/IS-11764-ebf-ignore-unexpected-origin
branch
from
August 25, 2026 06:46
b310fb8 to
2fd0a4c
Compare
luisgoncalves
approved these changes
Aug 25, 2026
luisgoncalves
deleted the
fix/dev/IS-11764-ebf-ignore-unexpected-origin
branch
August 27, 2026 08:18
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.
Jira: https://curity.atlassian.net/browse/IS-11764
Purpose & Context
The external browser flow opens a second window and waits for a
postMessagethat carries the resume nonce. Until now, any message from that window with a non-Curity origin rejected the promise. The stepper turns that rejection into a full-screen error boundary, so the login flow died.That window legitimately visits third-party origins mid-flow — a social login provider, for example. Code on those pages can post a message to its opener. When it did, a working login broke.
Luis confirmed the intended behaviour while reviewing #288: ignore those messages and keep waiting for the real completion message.
Architecture & Data Flow
flowchart TD A[message event] --> B{source is the external window?} B -- no --> I1[ignore, keep listening] B -- yes --> C{origin is the launch origin?} C -- no --> I2["ignore, keep listening<br/>(was: reject)"] C -- yes --> D{data is a string?} D -- no --> E[reject with the resume error] D -- yes --> F[resolve with the resume nonce]How to Test & Review
Unit tests cover the three paths: