Repository navigation
feat(chat): warn before opening a link from a message - #1555
Merged
Merged
Conversation
bmc08gt
force-pushed
the
feat/external-link-warning
branch
from
September 24, 2026 18:42
14b6e28 to
78e5c2a
Compare
A link in a chat message opens whatever URL the sender typed, straight into the browser. A drainer site reached that way gets no domain check first. The chat transcript now provides a UriHandler that runs each LinkAnnotation.Url through one host check. A host that exactly matches the first-party list opens directly; anything else shows "You're leaving Flipcash" with the host lowercased and in punycode, Cancel as the primary button and a text-only Open Link as the secondary. The list moves from LinkCardClassifier.CARD_HOSTS to core so the card classifier and the warning read the same set. Links the app opens on purpose, such as token socials, terms and the cash card, don't go through the check.
bmc08gt
force-pushed
the
feat/external-link-warning
branch
from
September 24, 2026 18:43
78e5c2a to
10c1264
Compare
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.
A link in a chat message opens whatever URL the sender typed, straight into the browser. A drainer site reached that way gets no domain check first. This adds the iOS "You're leaving Flipcash" alert in front of chat message links whose host isn't first-party.
How it works
classifyLink(url)returns first-party or external-with-host. A host passes only on an exact match against the first-party list, soevilflipcash.comandflipcash.com.evil.tldwarn. The displayed host is lowercased and run throughIDN.toASCII, so a lookalike with a Cyrillic "а" shows asxn--.... A URL with no host, such asmailto:, shows its scheme instead.MessengerScreenprovidesExternalLinkUriHandlerasLocalUriHandleraroundMessageList, which covers theLinkAnnotation.Urlspans in message text. Links the app sends the user to on purpose, like token socials, terms and the cash card, open as before.LinkCardClassifier.CARD_HOSTSnow reads the same list from core, so the card classifier and the warning can't drift apart.Copy
The alert matches iOS: title "You're leaving Flipcash", body "This link opens {host}. Flipcash will never ask for your Access Key on a website", Cancel as the primary button, a text-only Open Link as the secondary. "Access Key" is the term the app already uses for the recovery phrase. iOS bolds the host; here it's plain text, since the alert body takes a
String.Tests
ExternalLinksTestcovers each first-party host, the lookalike and punycode hosts, userinfo (flipcash.com@evil.com) and backslash URLs, which are checked against the host the browser would open.LinkCardClassifierTeststill passes against the shared list.