Skip to content

feat(chat): warn before opening a link from a message - #1555

Merged
bmc08gt merged 1 commit into
code/cashfrom
feat/external-link-warning
Sep 24, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
feat/external-link-warning

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • One check. classifyLink(url) returns first-party or external-with-host. A host passes only on an exact match against the first-party list, so evilflipcash.com and flipcash.com.evil.tld warn. The displayed host is lowercased and run through IDN.toASCII, so a lookalike with a Cyrillic "а" shows as xn--.... A URL with no host, such as mailto:, shows its scheme instead.
  • Chat only. MessengerScreen provides ExternalLinkUriHandler as LocalUriHandler around MessageList, which covers the LinkAnnotation.Url spans in message text. Links the app sends the user to on purpose, like token socials, terms and the cash card, open as before.
  • Shared host list. LinkCardClassifier.CARD_HOSTS now 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

ExternalLinksTest covers 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. LinkCardClassifierTest still passes against the shared list.

@bmc08gt bmc08gt self-assigned this Sep 24, 2026
@github-actions github-actions Bot added type: feature New functionality area: ui Compose UI, theme, components, resources area: notifications Push notifications, in-app messaging and removed type: feature New functionality labels Sep 24, 2026
@bmc08gt
bmc08gt force-pushed the feat/external-link-warning branch from 14b6e28 to 78e5c2a Compare September 24, 2026 18:42
@bmc08gt bmc08gt changed the title feat(links): warn before opening a non-Flipcash link feat(chat): warn before opening a link from a message Sep 24, 2026
@github-actions github-actions Bot added the type: feature New functionality label Sep 24, 2026
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
bmc08gt force-pushed the feat/external-link-warning branch from 78e5c2a to 10c1264 Compare September 24, 2026 18:43
@bmc08gt
bmc08gt merged commit 17349d8 into code/cash Sep 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: notifications Push notifications, in-app messaging area: ui Compose UI, theme, components, resources type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant