Skip to content

fix(functional-tests): fix untrusted relier WAF bypass and pair race - #21424

Merged
vbudhram merged 1 commit into
mainfrom
fxa-14689
Oct 9, 2026
Merged

vbudhram merged 1 commit into
mainfrom
fxa-14689

Conversation

@fxa-agent

@fxa-agent fxa-agent Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Because

  • On stage, the untrusted relier host did not get the fxa-ci header. The WAF challenge page blocked the untrustedRelierSignin tests.
  • In the first pairAttribution test, Firefox handles fxaccounts:pair_preferences by loading about:preferences in the same tab. That navigation raced the test's page.goto, and the test failed at the 120 s timeout.

This pull request

  • Adds the host of target.untrustedRelierUrl to fxaDomains in waf.ts. Requests to the untrusted relier, and its redirect to /authorization, now get the header.
  • Wraps window.dispatchEvent in pairAttribution.spec.ts before the Continue click. The wrapper drops the fxaccounts:pair_preferences WebChannel message and records that the page sent it.
  • Waits for that record, then runs the goto. Firefox never starts its own navigation, so there is no race.

Issue that this pull request solves

Closes: FXA-14689

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on: the page.evaluate stub in pairAttribution.spec.ts.
  • Suggested review order: waf.ts, then pairAttribution.spec.ts.

Screenshots (Optional)

No UI change.

Other information (Optional)

Testing

  • Stage, --repeat-each=5 --retries=0: pairAttribution.spec.ts and untrustedRelierSignin.spec.ts, 35 of 35 passed.
  • Without the WAF change, untrustedRelierSignin.spec.ts failed 4 of 5 tests on stage.
  • In CI stage history, the pairAttribution goto race caused 12 hard fails and 12 flaky runs in 73 jobs.

Known separate issue. On a slow stage response, sign-in can send the user from /pair back to the password page. /pair asks Firefox for fxa_status before Firefox finishes oauth_login. This is a product race, not a test race. It will get its own ticket and PR.

@fxa-agent
fxa-agent Bot requested a review from a team as a code owner October 8, 2026 11:20
@fxa-agent fxa-agent Bot added the auto label Oct 8, 2026
Because:
- The WAF blocked untrusted relier requests on stage, as they had no fxa-ci header.
- In pairAttribution, Firefox loaded about:preferences on pair_preferences, which raced page.goto.

This commit:
- Adds the untrustedRelierUrl host to fxaDomains in waf.ts.
- Drops the pair_preferences WebChannel message in pairAttribution before Continue.
- Waits for the dropped message, then runs the goto.

Closes FXA-14689

@vbudhram vbudhram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this against stage and tests passed 10/10

@vbudhram
vbudhram merged commit 62a1784 into main Oct 9, 2026
20 checks passed
@vbudhram
vbudhram deleted the fxa-14689 branch October 9, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant