fix: persist iOS SDK deeplink connections only after user approval #2185
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.48) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 524 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.375
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #2185"
general
weight: 0.35
devin-ai-integration[bot]
Summary
Fixes code-scan finding
sfind-0b29e37e0223451dbcc47df2e14a6136(medium):DeeplinkProtocolServicesaved a new iOS SDK deeplink connection withaddDappConnectionbefore asking the user for permission, and never removed it after the user rejected. After an app restart,init()loaded the rejected channel and created aBackgroundBridgefor it.handleMessagethen sent its RPCs straight to that bridge, without the re-authorization prompt that normally runs when a channel has no bridge.Changes in
app/core/SDKConnect/SDKDeeplinkProtocol/DeeplinkProtocolService.ts:discardUnapprovedConnection(id)clearsconnections,bridgeByClientIdanddappPublicKeyByClientId, then callsSDKConnect.removeChannel({ channelId, sendTerminate: false }). That call also clears SDKConnect/Redux state and revokes any permissions for the channel.Tests (
DeeplinkProtocolService.test.ts, 7 new):initskips persisted connections that have no CAIP-25 permission, or whose permissions can't be read.mmsdkmessage. The message gets4100 Unauthorized requestand no bridge is created.Local results:
jest DeeplinkProtocolService.test.tspasses 27/27. Prettier is clean.tscshows no errors in SDKConnect files.Notes for reviewers:
GTM-COG-PHIL/metamask-mobile. The Devin git integration has no access to that repo (403 on push), so the same fix is ported here to theCOG-GTMfork, where the same pattern exists (handleConnectioncalledaddDappConnectionbefore approval).Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/268750aef6b34e2eaa77c661a809887e
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/268750aef6b34e2eaa77c661a809887e?variant=devin
<!-- devin-review-badge-staging-begin -->
---
Devin Review
| Status | Commit |
|---|---|
| ⚪ Not started | — |
<a href="https://staging.itsdev.in/review/cog-gtm/metamask-mobile/pull/2185" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-staging-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-staging-light.svg?v=4" alt="Devin Review (Staging)"></picture></a>
<!-- devin-review-badge-staging-end -->
<!-- devin-review-badge-begin -->
---
<a href="https://devin-gtm.devinenterprise.com/review/cog-gtm/metamask-mobile/pull/2185" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->