From ef2e31ed04e473b32b77321e6649fd1415c5e427 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 19 Aug 2026 10:44:10 -0500 Subject: [PATCH] Warn that deep links are attacker-triggerable navigations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Any web page can open a custom-scheme URL, and `DeepLinkHandler` turns that into a `navigate()` call — so a route that acts on mount (publishing, following, paying, deleting) is an action any website can fire silently, with no user intent beyond a tap on an unrelated page. The `appUrlOpen` event gives no way to tell a verified universal link from a custom scheme, so the destination has to be treated as attacker-chosen. Document the constraint where it will be read, rather than filtering to `https:` in the component: this skill documents custom schemes as a supported setup, and filtering would silently break them. --- .agents/skills/capacitor/SKILL.md | 14 ++++++++++++++ .../capacitor/files/components/DeepLinkHandler.tsx | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/.agents/skills/capacitor/SKILL.md b/.agents/skills/capacitor/SKILL.md index 8aed38c..70a75ad 100644 --- a/.agents/skills/capacitor/SKILL.md +++ b/.agents/skills/capacitor/SKILL.md @@ -109,6 +109,20 @@ Render `` **inside** `` so `useNavigate()` wor ``` +**A deep link is an untrusted navigation.** Any web page the user visits can +open `myapp://whatever` — no prompt, no gesture beyond the tap that got them to +the page. `DeepLinkHandler` turns that into a `navigate()` call, so a custom +scheme lets an attacker put the user on any route in your app. Universal links +(`https://`) are safer, since the OS only routes them to you after verifying +`apple-app-site-association` / `assetlinks.json`, but the app has no way to tell +the two apart once the event arrives. + +So: **no route may perform a side effect on mount.** A route that publishes an +event, follows a user, sends a payment, or deletes something as soon as it +renders is an action any website can trigger silently. Render a confirmation +the user has to click instead. If your app has no custom scheme, restricting +the handler to `url.protocol === 'https:'` is worth doing as well. + ### 7. Add platforms and build ```bash diff --git a/.agents/skills/capacitor/files/components/DeepLinkHandler.tsx b/.agents/skills/capacitor/files/components/DeepLinkHandler.tsx index ceba475..bc26ffd 100644 --- a/.agents/skills/capacitor/files/components/DeepLinkHandler.tsx +++ b/.agents/skills/capacitor/files/components/DeepLinkHandler.tsx @@ -14,6 +14,17 @@ import { Capacitor } from '@capacitor/core'; * Must be rendered **inside** a `` (so `useNavigate` works). * Safe to render unconditionally — on web it is a no-op. * + * ## Deep links are untrusted input + * + * Any web page the user visits can open `myapp://anything`, which arrives here + * and becomes a `navigate()` call. Universal links are verified by the OS; + * custom schemes are not, and the `appUrlOpen` event does not distinguish + * them. Treat the destination as attacker-chosen: **no route may perform a + * side effect on mount** (publishing an event, following, paying, deleting). + * Such a route is an action any website can trigger without the user knowing. + * Require a click on the page instead. Apps with no custom scheme should also + * reject anything but `url.protocol === 'https:'` below. + * * To enable deep links: * * **iOS (Universal Links):**