You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mobile-Expensify (where DeepLinkManager lives) isn't checked out in this repo and is private, so I've confirmed the App-side contract: the report route declares its ID segment optional and even emits r/undefined links, while standalone iOS forwards the activity untouched to React Native — only the HybridApp native handler parses it. That's enough to pin the mechanism. Here is the proposal:
Proposal
What is the root cause of that problem?
On iOS HybridApp, a tapped universal link is handled natively by OldDot before NewDot ever sees it: ExpensifyAppDelegate application:continueUserActivity: calls DeepLinkManager.handleUniversalLink, which pattern-matches report links and calls handleViewReportLink (Mobile-Expensify repo). That method extracts the report ID from the URL assuming a well-formed …/r/<numericID> link — it indexes the path segment and converts it to a number with no guard, so when the ID segment is missing or non-numeric the extraction traps (Swift force-unwrap / out-of-bounds → the EXC_BREAKPOINT in the Sentry issue) and the app dies before the handoff to NewDot.
Such links are legitimate inputs, not corruption: the route itself declares the ID optional (r/:reportID?/:reportActionID?), and when a report ID is missing the app still builds and shares an r/undefined link — it only logs a warning:
Standalone NewDot iOS doesn't crash on the same links because its delegate does no parsing — it forwards the activity straight to React Native, and NewDot renders "Report not found" gracefully:
So: malformed-but-plausible report link (/r/, r/undefined, an ID truncated by an email client) → OldDot's native handleViewReportLink parses the ID without validation → native trap, only on HybridApp iOS.
What changes do you think we should make in order to solve the problem?
Fix at the convergence point in Mobile-Expensify's DeepLinkManager.handleViewReportLink: replace the unchecked extraction with a guarded parse (bounds-check the path component, guard let the numeric conversion), and on failure fall through to the default universal-link behavior — hand the raw URL to NewDot (which already shows "Report not found") or just foreground the app. Roughly:
guard pathComponents.count > 2, let reportID = Int64(pathComponents[2]) else {
// not a valid report link — fall back to default link handling instead of trapping
}
As a small App-side hardening, REPORT_WITH_ID.getRoute should stop emitting r/undefined when reportID is missing (return the home route instead of interpolating undefined), so the app stops producing these links in the first place.
What alternative solutions did you explore? (Optional)
Fixing only the App side (never generate r/undefined) — insufficient, because malformed links also arrive from outside the app (typed, truncated, or stale links), so the native handler must validate regardless.
The crash is a native Swift force-unwrap trap in DeepLinkManager.handleViewReportLink (Mobile-Expensify), reached only on iOS HybridApp: ExpensifyAppDelegate intercepts universal links and routes new.expensify.com/r/… through a native parser that blind-indexes the path segment after r/ and coerces it to Int. When the segment is absent or undefined, the optional Int(segment)! traps as EXC_BREAKPOINT (mach) and the process dies. Standalone iOS never hits this because its delegate forwards the activity directly to React Native's linking config, which declares :reportID? optional and renders "Report not found" gracefully.
What makes this crash wide (204 users, 7 months) and intermittent is the cross-user propagation path: the malformed link is authored by User A and embedded in a persisted system message read by User B. The specific generator is getReportURLForCurrentContext:
This helper supplies the URL for "moved this report" system messages built in ReportUtils.ts — lines :6903, :6918, :7289-7290, :7378 — which use movedReportID, newParentReportID, and originalReportID. Any of those is undefined for optimistic actions, self-DMs, or cross-workspace moves. The message is then persisted and delivered to every room member via Onyx sync. Later, any iOS HybridApp user who taps that …/r/ link in their feed triggers continueUserActivity → handleViewReportLink → trap — without having initiated anything unusual themselves. That explains why the crash is structurally broad but doesn't reproduce in straightforward testing.
A secondary (narrower) source is ROUTES.REPORT_WITH_ID.getRoute(undefined), which emits r/undefined but only on the sharing device directly:
What changes do you think we should make in order to solve the problem?
1. Native guard in DeepLinkManager.handleViewReportLink (Mobile-Expensify — required). Replace the force-unwrap/unchecked subscript with a guarded parse: verify the r/ path segment exists and bind Int(segment) with guard let. On failure, fall through without trapping — pass the activity to NewDot unchanged, exactly as standalone iOS does. This closes the entire class of malformed inbound report links regardless of origin (App-generated, email-generated, backend-generated).
2. Fix the link generator in this repo. In getReportURLForCurrentContext.ts:14-17, return environmentURL instead of a dangling r/ when reportID is falsy:
if(!reportID){returnenvironmentURL;}
Additionally, the moved-action builders in ReportUtils.ts (:6903, :6918, :7378) should emit plain text rather than a live anchor when the target report ID is missing, mirroring the Log.warn guard already present in ROUTES.REPORT_WITH_ID.getRoute. This removes the cross-user propagation vector at its source and reduces crash volume for existing users who already have these messages synced.
3. No change needed to ROUTES.REPORT_WITH_ID.getRoute. Throwing or returning empty string there doesn't stop backend- or email-originated malformed links from reaching the native parser, so the native guard in step 1 is necessary regardless.
What alternative solutions did you explore? (Optional)
Filtering on the JS side (e.g. in the universal-link handler passed to React Native) was considered but rejected: it would require forking the HybridApp linking config and still wouldn't protect against links delivered through external channels. Guarding natively and fixing the App-side generator together is the minimal, closed-form solution.
Restoring this proposal — it was auto-flagged as a duplicate of an earlier proposal, but the analysis differs materially: Ours identifies cross-user propagation via persisted system messages as primary crash amplifier.
⚠️@trasnake87 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Activity
lorretheboy commentedon Jul 2, 2026
Mobile-Expensify (where
DeepLinkManagerlives) isn't checked out in this repo and is private, so I've confirmed the App-side contract: the report route declares its ID segment optional and even emitsr/undefinedlinks, while standalone iOS forwards the activity untouched to React Native — only the HybridApp native handler parses it. That's enough to pin the mechanism. Here is the proposal:Proposal
What is the root cause of that problem?
On iOS HybridApp, a tapped universal link is handled natively by OldDot before NewDot ever sees it:
ExpensifyAppDelegate application:continueUserActivity:callsDeepLinkManager.handleUniversalLink, which pattern-matches report links and callshandleViewReportLink(Mobile-Expensify repo). That method extracts the report ID from the URL assuming a well-formed…/r/<numericID>link — it indexes the path segment and converts it to a number with no guard, so when the ID segment is missing or non-numeric the extraction traps (Swift force-unwrap / out-of-bounds → theEXC_BREAKPOINTin the Sentry issue) and the app dies before the handoff to NewDot.Such links are legitimate inputs, not corruption: the route itself declares the ID optional (
r/:reportID?/:reportActionID?), and when a report ID is missing the app still builds and shares anr/undefinedlink — it only logs a warning:App/src/ROUTES.ts
Lines 1549 to 1555 in a9e6aed
Standalone NewDot iOS doesn't crash on the same links because its delegate does no parsing — it forwards the activity straight to React Native, and NewDot renders "Report not found" gracefully:
App/ios/AppDelegate.swift
Lines 124 to 130 in a9e6aed
So: malformed-but-plausible report link (
/r/,r/undefined, an ID truncated by an email client) → OldDot's nativehandleViewReportLinkparses the ID without validation → native trap, only on HybridApp iOS.What changes do you think we should make in order to solve the problem?
Fix at the convergence point in Mobile-Expensify's
DeepLinkManager.handleViewReportLink: replace the unchecked extraction with a guarded parse (bounds-check the path component,guard letthe numeric conversion), and on failure fall through to the default universal-link behavior — hand the raw URL to NewDot (which already shows "Report not found") or just foreground the app. Roughly:As a small App-side hardening,
REPORT_WITH_ID.getRouteshould stop emittingr/undefinedwhenreportIDis missing (return the home route instead of interpolatingundefined), so the app stops producing these links in the first place.What alternative solutions did you explore? (Optional)
Fixing only the App side (never generate
r/undefined) — insufficient, because malformed links also arrive from outside the app (typed, truncated, or stale links), so the native handler must validate regardless.melvin-bot commentedon Jul 2, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (
External)[-][Sentry: APP-284] HybridApp iOS DeepLinkManager handleViewReportLink crash[/-][+][$250] [Sentry: APP-284] HybridApp iOS DeepLinkManager handleViewReportLink crash[/+]melvin-bot commentedon Jul 2, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022072671197029007922
trasnake87 commentedon Jul 2, 2026
Proposal
What is the root cause of that problem?
The crash is a native Swift force-unwrap trap in
DeepLinkManager.handleViewReportLink(Mobile-Expensify), reached only on iOS HybridApp:ExpensifyAppDelegateintercepts universal links and routesnew.expensify.com/r/…through a native parser that blind-indexes the path segment afterr/and coerces it toInt. When the segment is absent orundefined, the optionalInt(segment)!traps asEXC_BREAKPOINT (mach)and the process dies. Standalone iOS never hits this because its delegate forwards the activity directly to React Native's linking config, which declares:reportID?optional and renders "Report not found" gracefully.What makes this crash wide (204 users, 7 months) and intermittent is the cross-user propagation path: the malformed link is authored by User A and embedded in a persisted system message read by User B. The specific generator is
getReportURLForCurrentContext:This helper supplies the URL for "moved this report" system messages built in
ReportUtils.ts— lines:6903,:6918,:7289-7290,:7378— which usemovedReportID,newParentReportID, andoriginalReportID. Any of those isundefinedfor optimistic actions, self-DMs, or cross-workspace moves. The message is then persisted and delivered to every room member via Onyx sync. Later, any iOS HybridApp user who taps that…/r/link in their feed triggerscontinueUserActivity→handleViewReportLink→ trap — without having initiated anything unusual themselves. That explains why the crash is structurally broad but doesn't reproduce in straightforward testing.A secondary (narrower) source is
ROUTES.REPORT_WITH_ID.getRoute(undefined), which emitsr/undefinedbut only on the sharing device directly:https://github.com/Expensify/App/blob/main/src/ROUTES.ts#L1549-L1556
What changes do you think we should make in order to solve the problem?
1. Native guard in
DeepLinkManager.handleViewReportLink(Mobile-Expensify — required). Replace the force-unwrap/unchecked subscript with a guarded parse: verify ther/path segment exists and bindInt(segment)withguard let. On failure, fall through without trapping — pass the activity to NewDot unchanged, exactly as standalone iOS does. This closes the entire class of malformed inbound report links regardless of origin (App-generated, email-generated, backend-generated).2. Fix the link generator in this repo. In
getReportURLForCurrentContext.ts:14-17, returnenvironmentURLinstead of a danglingr/whenreportIDis falsy:Additionally, the moved-action builders in
ReportUtils.ts(:6903,:6918,:7378) should emit plain text rather than a live anchor when the target report ID is missing, mirroring theLog.warnguard already present inROUTES.REPORT_WITH_ID.getRoute. This removes the cross-user propagation vector at its source and reduces crash volume for existing users who already have these messages synced.3. No change needed to
ROUTES.REPORT_WITH_ID.getRoute. Throwing or returning empty string there doesn't stop backend- or email-originated malformed links from reaching the native parser, so the native guard in step 1 is necessary regardless.What alternative solutions did you explore? (Optional)
Filtering on the JS side (e.g. in the universal-link handler passed to React Native) was considered but rejected: it would require forking the HybridApp linking config and still wouldn't protect against links delivered through external channels. Guarding natively and fixing the App-side generator together is the minimal, closed-form solution.
Restoring this proposal — it was auto-flagged as a duplicate of an earlier proposal, but the analysis differs materially: Ours identifies cross-user propagation via persisted system messages as primary crash amplifier.
github-actions commentedon Jul 2, 2026
proposal: Expensify#95195
66 remaining items
melvin-bot commentedon Aug 18, 2026
@eVoloshchak Huh... This is 4 days overdue. Who can take care of this?
[-][$250] [Sentry: APP-284] HybridApp iOS DeepLinkManager handleViewReportLink crash[/-][+][Due for payment 2026-08-19] [$250] [Sentry: APP-284] HybridApp iOS DeepLinkManager handleViewReportLink crash[/+]melvin-bot commentedon Aug 19, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)eVoloshchak commentedon Aug 19, 2026
Not overdue, checklist is at #95195 (comment)
mallenexpensify commentedon Aug 20, 2026
Payment Summary
Contributor: @lorretheboy paid $250 via Upwork
Contributor+: @eVoloshchak due $250 via NewDot
@lorretheboy can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022072671197029007922
lorretheboy commentedon Aug 21, 2026
@mallenexpensify Thanks, I accepted
mallenexpensify commentedon Aug 21, 2026
@lorretheboy paid, summary updated above. Thx.
JmillsExpensify commentedon Aug 28, 2026
$250 approved for @eVoloshchak