Repository navigation
[patch][bugfix]: Align mobile onboarding telemetry and Intune redirect context - #1977
Conversation
Distinguish CA redirects from validated profile-download handoffs and classify native-observed Company Portal App Store handoffs as CPDownloadTriggered. Add regression coverage for telemetry serialization, invalid handoffs, cancellation, and duplicate completion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d907b2ba-130e-4ee4-a75b-2fab6760b99f
Normalize onboarding URL markers and source eligible Intune correlation headers from the original request context. Preserve telemetry UX classification and upstream delegation coverage on the dev-based branch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d907b2ba-130e-4ee4-a75b-2fab6760b99f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d907b2ba-130e-4ee4-a75b-2fab6760b99f
…locally Apply optional headers before assigning the authoritative context correlation ID. Keep the weak onboarding telemetry builder alive across profile-download telemetry calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d907b2ba-130e-4ee4-a75b-2fab6760b99f
There was a problem hiding this comment.
🟡 Changes recommended
New tests contain compilation errors, and scheme-relative URLs are incorrectly classified as Company Portal handoffs.
3 open findings
What changed in this PR
Aligns IdentityCore’s mobile-onboarding telemetry and preserves request context through embedded Intune redirects.
Changes:
- Separates CA redirect, profile-download, and Company Portal handoff telemetry.
- Normalizes
in-app=trueand applies context-derived correlation headers. - Adds regression coverage for telemetry, delegation gates, and redirect handling.
| File | Description |
|---|---|
| IdentityCore/tests/MSIDWebviewNavigationHandlerTests.m | Tests profile-download telemetry timing. |
| IdentityCore/tests/MSIDWebviewNavigationDecisionResolverTests.m | Tests query normalization and correlation headers. |
| IdentityCore/tests/MSIDOnboardingBlobBuilderTests.m | Tests Company Portal URL classification. |
| IdentityCore/tests/MSIDOAuth2EmbeddedWebviewControllerTests.m | Tests terminal telemetry deduplication. |
| IdentityCore/tests/MSIDAADOAuthEmbeddedWebviewControllerTests.m | Tests onboarding delegation and UX tags. |
| IdentityCore/src/webview/embeddedWebview/MSIDWebviewNavigationHandler.m | Records profile-download UX independently of notifications. |
| IdentityCore/src/webview/embeddedWebview/MSIDWebviewNavigationDecisionResolver.m | Normalizes markers and applies context correlation IDs. |
| IdentityCore/src/webview/embeddedWebview/MSIDWebviewNavigationDecisionResolver.h | Documents redirect handling requirements. |
| IdentityCore/src/webview/embeddedWebview/MSIDAADOAuthEmbeddedWebviewController.m | Records the CA redirect UX tag. |
| IdentityCore/src/telemetry/MSIDOnboardingBlobFieldKeys.m | Defines new telemetry constants. |
| IdentityCore/src/telemetry/MSIDOnboardingBlobFieldKeys.h | Declares new telemetry constants. |
| IdentityCore/src/telemetry/MSIDOnboardingBlobBuilder.m | Classifies Company Portal store handoffs. |
| changelog.txt | Summarizes telemetry and redirect changes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
|
|
||
| [request setValue:context.correlationId.UUIDString forHTTPHeaderField:MSID_OAUTH2_CORRELATION_ID_REQUEST_VALUE]; | ||
|
|
There was a problem hiding this comment.
just make sure with you tell Dan we are sending correlation Id in client-request-id:
| @@ -529,6 +531,7 @@ - (NSURLRequest * _Nullable)externallyOverriddenRequestForRequest:(NSURLRequest | |||
| - (nullable NSURLRequest *)buildRequestForURL:(NSString *)URLString | |||
There was a problem hiding this comment.
Send in-app and correlationId from caller as parameter in extraParams and extraHeaders from caller than modifying generic method
| return; | ||
| } | ||
|
|
||
| MSIDOnboardingBlobBuilder *onboardingBlobBuilder = self.onboardingBlobBuilder; |
There was a problem hiding this comment.
Please see addition of phase 1 blob in correct location here.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 452f0661-93ec-4e3b-af52-842802119e48
Use the existing 0.1-second success delay in the three URL-response tests so their callbacks have margin before the 0.5-second timeout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 43e45018-a9d1-4d32-81f2-54b26e77c4f8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 43e45018-a9d1-4d32-81f2-54b26e77c4f8
| NSString * const MSIDOnboardingModeBrokered = @"brokered"; | ||
|
|
||
| // UX flow tags (appended to the `ux_flow_used` array). | ||
| NSString * const MSIDOnboardingUxFlowNewCAMdmRedirect = @"NewCAMdmRedirect"; |
There was a problem hiding this comment.
Nit: NewCAMDMRedirect


Draft scope
Draft for reviewing the combined mobile-onboarding telemetry and Intune redirect changes against
dev. Not ready to merge.Proposed changes
NewCAMdmRedirectfor the CA MDM redirect andMobileOnboardingPhase1after the existing download-profile purpose guard, independently of notification-provider availability.CPDownloadTriggered, rejecting URLs without a scheme and preserving enrollment fwlink classification. Safari-only behavior is out of scope.in-app=true.client-request-idfrom the embedded webview's original request context. The context value replaces caller-supplied variants; a missing context ID removes that header.This PR includes the Intune changes also reviewed in #1975 alongside the telemetry changes so the full combined diff can be inspected. No Broker/MSAL source changes, dependency-pointer updates, or temporary URL logs are included.
Checklist
Validation
Focused tests passed on iOS (261) and macOS (256), covering the AAD and base embedded-webview controllers, navigation decision resolver, navigation handler, and onboarding blob builder. Tests cover conflicting caller correlation headers, mixed casing, absent context correlation IDs, missing URL schemes, and onboarding delegation. The full local iOS suite passed before the timing fix (3,232 tests, three skipped); after the fix, all 10 webview authorization tests passed across 10 iterations (100 executions, zero failures) on Xcode 26.3 / iOS 26.3. Patch-format checks passed. Downstream CI and end-to-end device validation remain outstanding; automation pipeline failures are outside this investigation.
Device logs showed
in-app=trueat the WebKit handoff for enrollment, profile installation, JIT compliance/linking, and troubleshooting. They do not prove server receipt, correlation-header delivery, or successful end-to-end onboarding.Type and risk
Bug fix / telemetry / tests. Medium risk: shared embedded-webview navigation and onboarding telemetry.
Rollout / rollback
Redirect normalization relies on the existing upstream mobile-onboarding gate. Consumers adopt dependency updates separately. Revert the changes to roll back.
Related work items