Skip to content

Fix RTR user agent after app restart - #4171

Merged
wmathurin merged 3 commits into
forcedotcom:devfrom
wmathurin:W-24141870-rtr-restart-user-agent
Sep 10, 2026
Merged

wmathurin merged 3 commits into
forcedotcom:devfrom
wmathurin:W-24141870-rtr-restart-user-agent

Conversation

@wmathurin

@wmathurin wmathurin commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bind token refresh requests to the credential owner’s explicit per-user User-Agent instead of ambient current-user state.
  • Add deterministic coverage for a different current user, explicit token-request header construction/fallback, and DPoP nonce-retry User-Agent preservation.
  • Add an AuthFlowTester cold-restart regression that captures the actual /services/oauth2/token User-Agent and requires RT, A2, and OT.
  • Document the first-post-restart refresh invariant.

Why no timestamp reconciliation

No persisted-state repair is needed. Warm refreshes later in the original process already carry RT, and the post-restart regression passes once refresh resolves the credential owner explicitly. The failing request also omitted other per-user markers, confirming request-context loss rather than RT persistence loss.

Validation

  • Pre-fix focused regression failed as expected: the endpoint request had no explicit UA and omitted the owner’s RT/test markers.
  • Focused SalesforceSDKCore tests: 10 passed, 0 failed, 0 skipped.
  • DPoP nonce-retry User-Agent regression: 1 passed, 0 failed; full SFSDKOAuthTokenEndpointResponseTests: 5 passed, 0 failed, 0 skipped.
  • AuthFlowTester build-for-testing passed.
  • Focused live AuthFlowTester UI regression: 1 passed, 0 failed (103.817s).
  • git diff --check passes.

Workspace spec

Work item

  • W-24141870

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
TestsPassed ✅SkippedFailed
SalesforceSDKCore iOS ^18 Test Results1039 ran1039 ✅
TestResult
No test annotations available

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.88%. Comparing base (48982e7) to head (d78f7bc).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4171      +/-   ##
==========================================
+ Coverage   67.28%   70.88%   +3.60%     
==========================================
  Files         254      254              
  Lines       22993    22998       +5     
==========================================
+ Hits        15470    16303     +833     
+ Misses       7523     6695     -828     
Components Coverage Δ
Analytics 70.78% <ø> (ø)
Common 70.88% <ø> (ø)
Core 66.27% <100.00%> (+5.40%) ⬆️
SmartStore 73.45% <ø> (ø)
MobileSync 88.99% <ø> (ø)
Files with missing lines Coverage Δ
...rceSDKCore/Classes/OAuth/SFOAuthSessionRefresher.m 93.47% <100.00%> (+0.21%) ⬆️
...KCore/SalesforceSDKCore/Classes/Util/SFSDKOAuth2.m 80.62% <100.00%> (+12.73%) ⬆️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wmathurin
wmathurin marked this pull request as ready for review September 9, 2026 21:21
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
TestsPassed ☑️SkippedFailed ❌️
AuthFlowTester UI Test Results all112 ran62 ✅50 ❌
TestResult
AuthFlowTester UI Test Results all
AuthFlowTesterUITests.xctest
MultiUserLoginTests.testFlagDiversity_BeaconNonHybridJwtVsHybridOpaque()❌ failure
MultiUserLoginTests.testBeaconAndNonBeacon_MultiUser()❌ failure
MultiUserLoginTests.testAdvancedAuthUser_HasBWFlag_RegularAuthUser_DoesNot()❌ failure
MultiUserLoginTests.testLogoutUserWithDynamicConfig_OtherUserUnaffected()❌ failure
MultiUserLoginTests.testRevokeAccessForUserWithDynamicConfig_OtherUserUnaffected()❌ failure
MultiUserLoginTests.testDifferentAppTypes_LogoutCaUser_EcaUserUnaffected()❌ failure
MultiUserLoginTests.testFirstStatic_SecondDynamic_DifferentApps()❌ failure
MultiUserLoginTests.testBothDynamic_DifferentApps()❌ failure
MultiUserLoginTests.testBothStatic_SameApp_DifferentScopes()❌ failure
MultiUserLoginTests.testFirstDynamic_SecondStatic_DifferentApps()❌ failure
MultiUserLoginTests.testBothStatic_SameApp_SameScopes()❌ failure
MultiUserLoginTests.test_dpopAndNonDPoPUsers_flagOff_maintainIndependentProofs()❌ failure
MultiUserLoginTests.testDifferentAppTypes_RevokeAccessForCaUser_EcaUserUnaffected()❌ failure
MultiUserLoginTests.testFlagDiversity_NonHybridOpaqueVsHybridJwt()❌ failure
MultiUserLoginTests.testBothStatic_DifferentApps()❌ failure
ECALoginTests.testECAJwt_AllScopes()❌ failure
ECALoginTests.testECAOpaque_SubsetScopes()❌ failure
ECALoginTests.test_givenNoDPoP_whenLoginViaPoolServer_thenSessionIsValid()❌ failure
ECALoginTests.testECAJwt_DefaultScopes()❌ failure
ECALoginTests.testDynamicConfigurationWithInvalidScope()❌ failure
ECALoginTests.testECAOpaque_DefaultScopes()❌ failure
ECALoginTests.testECAJwt_SubsetScopes()❌ failure
ECALoginTests.testECAOpaque_AllScopes()❌ failure
ECALoginTests.testDynamicConfigurationWithInvalidClientId()❌ failure
RefreshTokenMigrationWithRestartTests.testMigrateBeaconScopeAddition_WithRestart()❌ failure
RefreshTokenMigrationWithRestartTests.testMigrateScopeAddition_WithRestart()❌ failure
RefreshTokenMigrationWithRestartTests.testMigrateCAToBeacon_WithRestart()❌ failure
RefreshTokenMigrationWithRestartTests.testMigrateMultipleUsers_WithRestart()❌ failure
RefreshTokenMigrationWithRestartTests.testMigrateCAToECA_WithRestart()❌ failure
RefreshTokenMigrationTests.testMigrateCAToBeacon()❌ failure
RefreshTokenMigrationTests.testMigrateCA_AddMoreScopes()❌ failure
RefreshTokenMigrationTests.testMigrateCAToECA()❌ failure
RefreshTokenMigrationTests.testMigrateBeaconOpaqueToJWTAndBack()❌ failure
RefreshTokenMigrationTests.testMigrateCAUserAgentToECAWebServer()❌ failure
RefreshTokenMigrationTests.testMigrateCAToBeaconAndBack()❌ failure
RefreshTokenMigrationTests.testFlagDiversity_MigratedBeaconJwtVsNonHybridOpaque()❌ failure
RefreshTokenMigrationTests.testMigrateBeacon_AddMoreScopes()❌ failure
RefreshTokenMigrationTests.testMigrateOneUserOnly()❌ failure
LegacyLoginTestsNotHybrid.testCAOpaque_SubsetScopes_WebServerFlow_InAppWebView()❌ failure
LegacyLoginTestsNotHybrid.testCAOpaque_DefaultScopes_UserAgentFlow()❌ failure
LegacyLoginTestsNotHybrid.testCAOpaque_AllScopes_WebServerFlow_InAppWebView()❌ failure
LegacyLoginTestsNotHybrid.testCAOpaque_AllScopes_WebServerFlow()❌ failure
LegacyLoginTests.testCAOpaque_DefaultScopes_WebServerFlow_InAppWebView()❌ failure
BeaconLoginTests.testBeaconOpaque_SubsetScopes()❌ failure
ForceAdvancedAuthTests.testForceAdvancedAuth_AddAdditionalUser_BackButtonAccessible()❌ failure
DPoPLoginTests.test_givenDPoP_whenLoginViaPoolServer_thenTokenTypeIsDPoP()❌ failure
DPoPLoginTests.test_givenTwoDPoPUsers_whenSwitchAndRefresh_thenTokensAndNoncesAreIsolated()❌ failure
DPoPLoginTests.test_givenBearerSession_whenUpgradeToDPoP_thenDPoPBound()❌ failure
LoginWithRestartTests.testBeaconJwt_SubsetScopes_DynamicConfiguration_WithRestart()❌ failure
LoginWithRestartTests.testMultiUserRestart()❌ failure

@wmathurin
wmathurin requested a review from sfdctaka September 10, 2026 00:51

@sfdctaka sfdctaka 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.

LGTM!

@wmathurin
wmathurin merged commit 95ae85f into forcedotcom:dev Sep 10, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants