fix(auth): fix DPoP validation propagation in AuthFlowTester UI tests - #4144
Merged
Merged
Conversation
… and validate Beacon consumer keys are DPoP-enforced server-side. Tests that log in with beacon configs need to pass useDPoP:true so the SDK includes dpop_jkt in /authorize. Without it, the server rejects the request before the login form loads. - launchAndLogin: add useDPoP parameter (default false), forward to login() - loginOtherUser: add useDPoP parameter (default false), forward to login() - validateUser: add expectDP optional override (nil = use userAppConfig.isDPoP) - validate: compute effectiveExpectDP = useDPoP || userAppConfig.isDPoP and pass to both validateUser and assertRevokeAndRefreshWorks so beacon+DPoP sessions are properly validated without requiring _dpop in the app config name
…suite - Fix WelcomeLoginTests test names in overview.md (camelCase → underscore format) - Add missing test_givenNoDPoP_whenLoginViaPoolServer_thenSessionIsValid to ECALoginTests (both docs); update count 8→9 - Add missing testAdvancedAuthUser_HasBWFlag_RegularAuthUser_DoesNot and test_dpopAndNonDPoPUsers_flagOff_maintainIndependentProofs to MultiUserLoginTests in overview.md; update count 13→15
brandonpage
approved these changes
Aug 25, 2026
…DME, delete overview.md overview.md (Dec 2025) and README.md (Aug 2026) duplicated the same test-suite tables. Android has always used a single README; align iOS with that pattern. Changes: - Add LegacyLoginTestsNotHybrid section (was in overview.md only) - Add Scope Definitions table to Configuration section - Add credential setup instructions linking to internal workspace doc - Delete overview.md For cross-platform setup details see docs/auth/auth-ui-testing.md in the workspace repo.
- Add missing RefreshTokenMigrationWithRestartTests section (5 tests) - Add B/L marker reference tables (were in overview.md, not carried over) - Fix testBothStatic_SameApp_SameScopes description (CA → ECA Opaque) - Fix testBothStatic_DifferentApps description (CA+ECA → ECA Opaque+JWT) - Fix test_dpopAndNonDPoPUsers description (process-global flag, not per-user)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4144 +/- ##
==========================================
- Coverage 71.80% 71.61% -0.20%
==========================================
Files 254 254
Lines 22837 22837
==========================================
- Hits 16399 16355 -44
- Misses 6438 6482 +44
🚀 New features to boost your workflow:
|
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.
Summary
BaseAuthFlowTestertest infrastructure so explicituseDPoPenablement correctly propagates through the full validation call chain (launchAndLogin→validate()→validateUser→assertRevokeAndRefreshWorks)README.mdandoverview.mdwith the actual test suite (missing tests, stale test names)BEACON_OPAQUE/BEACON_JWT) fail pre-existing across all suites — same failures observed on Android (forcedotcom/SalesforceMobileSDK-Android#3005), pointing to an environment or server-side issue with the Beacon app configuration in the test sandbox rather than a code regression.Root cause (DPoP validation)
SDK 14.0 made DPoP default-on: commit
a9d333f01changedself.useDPoP = NO→self.useDPoP = YESinresetAuthFlags. The validation logic inBaseAuthFlowTesterderived whether to expect DPoP credentials solely from the app config name (isDPoPreturnstrueonly when the config name contains_dpop). Tests that explicitly enable DPoP via Login Options (e.g.DPoPLoginTestsoperating onecaOpaque) calledvalidate()withuseDPoP: true, butvalidateUserandassertRevokeAndRefreshWorksstill consulteduserAppConfig.isDPoP— alwaysfalseforecaOpaque— so DPoP credentials were validated against Bearer expectations, causing assertion failures.Root cause (WelcomeLoginTests / parallel flakiness)
WelcomeLoginTestsnon-beacon tests (testWelcomeDiscovery_RegularAuthLoginHost,_DynamicConfig) appeared to consistently fail all 3 retries when run in parallel with Beacon tests. Beacon tests each time out after 109s × 3 retries = ~327s per test, saturating the simulator pool. The same two tests pass reliably when run in isolation (117s, 118s). No code change was required; the failures were a parallelism artefact, not a product regression.Fix
Propagate
useDPoPthrough theBaseAuthFlowTestercall chain so explicit DPoP enablement overrides the config-name-derived default:launchAndLoginandloginOtherUser(no-validate variant) — addeduseDPoP: Bool = false, forwarded tologin()validateUser— addedexpectDP: Bool? = nil; resolves toexpectDP ?? userAppConfig.isDPoPvalidate()(private) — computeseffectiveExpectDP = useDPoP || userAppConfig.isDPoPand passes it to bothvalidateUserandassertRevokeAndRefreshWorksNo SDK production code was changed — only test infrastructure (
BaseAuthFlowTester.swift, 15 lines).Test results
All AuthFlowTester UI test suites run on simulator (iPhone 16, iOS 18.6). All non-Beacon tests pass. Beacon tests fail pre-existing across all suites; the same failures are seen on Android (#3005), pointing to a server-side / environment issue with the Beacon app configuration in the test sandbox rather than a code regression.
git diff origin/devshows zero changes to Beacon test files or Beacon app configuration.Some tests required 1–2 retries due to network flakiness against the shared test sandbox (token endpoint timeouts at ~110s). All eventually passed within the built-in retry budget.
In
WelcomeLoginTests,testWelcomeDiscovery_RegularAuthLoginHostandtestWelcomeDiscovery_RegularAuthLoginHost_DynamicConfigfail when run in parallel with Beacon timeouts but pass reliably in isolation (117s, 118s). Root cause: Beacon tests time out after 109s × 3 retries each, exhausting simulator concurrency.Test plan
DPoPLoginTestspass (2skipped — W-22512846 and pending server-side fix)ECALoginTestspass (9/9)LegacyLoginTestspass (7/7)MultiUserLoginTestspass (2/2;testBothStatic_SameApp_SameScopesneeded 2 retries)RefreshTokenMigrationTestspass (3/3; 2 tests needed 2 retries each)WelcomeLoginTestspass in isolation (2/2; fail under parallel Beacon load — parallelism artefact, not a regression)LoginWithRestartTestspass (6/6; all first-attempt)RefreshTokenMigrationWithRestartTestspass (2/2; all first-attempt)