Repository navigation
Conversation
Add openLink() and useOpenLink() under app/platform/links with fixed scheme allowlists, MetaMask link rejection, a shared sheet guard, a single fallback and sanitized logging. No production consumers. Mobile Platform owns the contract.
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #41267 +/- ##
==========================================
+ Coverage 88.67% 88.69% +0.01%
==========================================
Files 8795 8859 +64
Lines 266024 268365 +2341
Branches 68391 69016 +625
==========================================
+ Hits 235907 238020 +2113
- Misses 16594 16708 +114
- Partials 13523 13637 +114 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mganchas
commented
Dec 4, 2026
mganchas
commented
Dec 4, 2026
|
mganchas
marked this pull request as ready for review
December 4, 2026 12:00
This branch has not been deployed
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.



Description
Adds
openLink()anduseOpenLink()underapp/platform/links/(spec-022). Mobile Platform owns the contract; feature teams own when to open a link, which origins they trust, and what they track.modeis required:systemusesLinking.openURL,sheetusesreact-native-inappbrowser-rebornwith one configurable fallback (webviewdefault,system,none).system:https:mailto:tel:itms-apps:market:;sheet:https:), MetaMask self-scheme andMETAMASK_DEEPLINK_HOSTSrejection, original-string dispatch.closeSheetonly after native dismissal while mounted.Logger.app/platform/links/README.md, with API types and contract tests colocated.Rollback: revert this PR as a unit.
Test layer placement
Unit (
*.test.ts): capability with no UI, tested at the public entry point (.) with native, navigation and logger boundaries mocked.Changelog
CHANGELOG entry: null
Related issues
Refs:
.specs/spec-022-open-link-platform-api.mdManual testing steps
Native QA (Android emulator, iOS simulator) has not been run for this PR; see Evidence.
Screenshots/Recordings
N/A — no UI change and no production consumer.
Evidence (spec Log)
origin/main98c38bc7d65e717d0481e15f597367d24e4f6583. Skillsorigin/main885dd4def32b2000a2b7ee4d599da00bf09400d7(skills PR not opened yet; waits for this PR onmain).app/platform/links/**+ one/app/platform/CODEOWNERS entry →@MetaMask/mobile-platform. 997 lines added against the PR base. No other file changed.yarn jest app/platform/links --coverage→ 1 suite, 96 tests pass, 100% statements, branches, functions and lines for executable capability code. The consolidated suite tests both public entry points with shared mocks. It covers both scheme allowlists, MetaMask schemes and hosts, malformed and ambiguous URLs, the app URL polyfill, original-string handoff, synchronous OS dispatch, fallback routing, shared and hook-level guards, dismissal and unmount behavior, and sanitized errors and logging.eslint,oxlint(existing warnings only), andprettier --checkpass onapp/platform/links. Fulltsc --noEmit -p .passes after restoring the ignored, generatedtermsOfUseContent.tsfrom the local Mobile setup.d1f6d744cc3d, independently reproduced withgit grep, non-test files):Linking.openURL117 (source-reported 112); native sheetInAppBrowser.open6 (matches) plus 3openAuthfiles (source: two auth flows); dapp browser (Routes.BROWSER.HOME|VIEW) 33 (source 24); SimpleWebview (WEBVIEW.SIMPLE|SimpleWebview) 71 (source 62). Different patterns, so counts are not a migration inventory.yarn knip:checkfails onmainbaseline drift unrelated to this diff (2 unused Collectibles files, 1 stale baseline entry);app/platform/linkshas no new findings.Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
New shared link-opening path with URL validation and optional WebView fallback affects security posture once adopted; this PR adds no runtime consumers, so immediate production risk is low.
Overview
Introduces a new
app/platform/linksplatform module withopenLinkanduseOpenLink, plus a/app/platform/CODEOWNERS entry for Mobile Platform. There are no production call sites in this PR; feature teams adopt the API later.openLinkvalidates URLs (mode-specific scheme allowlists, rejection of MetaMask self-schemes and deeplink hosts), then opens viasystem(Linking.openURL),sheet(native in-app browser), orwebviewfallback onSimpleWebview. Results are alwaysopened/rejected/failed; errors and logs omit URL secrets and only expose a normalized hostname foronOpen/logContext.useOpenLinkadds per-hook repeat-tap gating,isOpening, optionalcloseSheetafter native sheet dismiss (when still mounted), and shares a global sheet in-flight guard with imperative callers. Contract behavior is documented inREADME.mdand covered by a largeopenLink.test.tssuite.Reviewed by Cursor Bugbot for commit 922ea40. Configure here.