Add FXIOS-16685 [FxA Pairflow] Verify pairing v2 against a local FxA stack Part 2 - #35509
Open
vbudhram wants to merge 2 commits into
Open
Add FXIOS-16685 [FxA Pairflow] Verify pairing v2 against a local FxA stack Part 2#35509vbudhram wants to merge 2 commits into
vbudhram wants to merge 2 commits into
Conversation
…stack The pairing URL parser accepted only the production and stage hosts over https, so a local FxA stack could never route a pairing link. Resolve the allowed origin from the content server the build is configured against, which lets the functional test pair against its own stack and keeps a stray host out. Confine cleartext to a loopback host, so a custom content server on a remote http origin still cannot make a plaintext link valid. Emit the URL in the shape the WebChannel bridge expects: a lowercased scheme and host, and no port when it is the scheme default. The bridge compares against WKSecurityOrigin, which reports port 0 for a default port, so a link with :443 would otherwise pass the parser and then lose every message. Select the China content server when the China sync pref is set, in the same order createAccountManager uses. The account manager selects FxAConfig.Server.china, which maps to its own host. Add testPairingV2, which the pairingFlowV2iOS.spec.ts functional test drives against a real authority and a live stack. SyncIntegrationTestPlan must not skip PairingTests: that plan builds the xctestrun the functional test runs with -only-testing, and a skip there becomes a SkipTestIdentifiers entry that -only-testing cannot override, so the run would execute no tests and pass.
The parser now matches the content server the build is configured against, so the stage host no longer routes on a release build. Use the release host, which is what an unconfigured test build resolves to.
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.
📜 Tickets
Jira ticket
Github issue
💡 Description
Part 2 of FXIOS-16685, following #35460. Part 1 shipped pairing v2 itself. This PR makes it verifiable end to end against a local FxA stack, and adds the UI test that drives the whole flow.
Why the parser changes are here
FxAPairingURLParserallowed onlyaccounts.firefox.comandaccounts.stage.mozaws.net, over https. The functional test pairs against a local FxA stack athttp://localhost:3030, which that allowlist rejects, so the deep link opened as an ordinary tab and never reached the pairing modal.The parser now resolves the allowed origin from the content server the build is configured against. On a release build this is tighter than before: stage no longer routes unless the stage pref is set. Cleartext is confined to a loopback host, so a custom content server pointed at a remote
http://origin still cannot make a plaintext pairing link valid.Two consequences follow from that:
Origin shape. The parser emits a lowercased scheme and host and drops a port that equals the scheme default. The WebChannel bridge compares
baseURLagainstWKSecurityOrigin, which reports a lowercased host and port0for a default port. Without this, a link carrying:443passes the parser and then has every WebChannel message dropped, so the page falls back topairingVersion: 1and renders the unsupported card after about three seconds.China.
createAccountManagerselectsFxAConfig.Server.china, which app-services maps to its own host (FxAccountConfig.swiftmaps.chinato the distinctFxaServer.china).contentServerStringhas to select it too, or a genuineaccounts.firefox.com.cnpairing link is treated as an untrusted URL while anaccounts.firefox.comlink is trusted and handed OAuth parameters minted against a different server.RouteTests.testPairingRouteFromSystemCameraDeepLinkmoves from the stage host to the release host for the same reason: stage is no longer a trusted origin on an unconfigured build.Note for reviewers: please do not restore the SyncIntegrationTestPlan skips
SyncIntegrationTestPlan.xctestplandeliberately no longer skipsPairingTests.The functional test builds the
.xctestrunfrom that plan, then runs it with-only-testing:XCUITests/PairingTests/testPairingV2. A plan skip becomes aSkipTestIdentifiersentry in the.xctestrun, and-only-testingcannot override it. Restoring those three lines makes the run execute zero tests and still exit 0, which reads as a passing end-to-end test.PairingTests.setUpthrowsXCTSkipwithoutPAIRING_URLandCUSTOM_FXA_SERVER, so ordinary CI runs of that plan cost nothing.testPairingV2is added to the skip lists of the four plans that skip the pairing class.🎥 Demos
No new native UI.
testPairingV2attaches simulator screenshots of the supplicant card and the closed modal on failure.📝 Checklist