From bcd69ad328a50b56d060e8c2f45c52c7a3be9bb7 Mon Sep 17 00:00:00 2001 From: Spence Pope Date: Fri, 23 Oct 2026 09:32:58 -0400 Subject: [PATCH] Update profile links blocklist (#12168) --- src/analytics/metrics/types.ts | 2 +- .../components/LinkFormDialog.tsx | 17 +------- src/features/profileLinks/providers.test.ts | 31 +++++++-------- src/features/profileLinks/providers.ts | 39 +++++-------------- src/features/profileLinks/record.test.ts | 9 ++++- src/features/profileLinks/record.ts | 2 - 6 files changed, 34 insertions(+), 66 deletions(-) diff --git a/src/analytics/metrics/types.ts b/src/analytics/metrics/types.ts index 306cab913..4c0468290 100644 --- a/src/analytics/metrics/types.ts +++ b/src/analytics/metrics/types.ts @@ -1571,7 +1571,7 @@ export type Events = { * A link couldn't be added, e.g. because its site is blocked. */ 'profile:links:rejected': { - reason: 'blocked' | 'safelink' | 'shortener' | 'insecure' + reason: 'safelink' | 'shortener' | 'insecure' /** * Left out for Safelink blocks, which can be sensitive sites. The other * reasons come from public lists in the app. diff --git a/src/features/profileLinks/components/LinkFormDialog.tsx b/src/features/profileLinks/components/LinkFormDialog.tsx index 5fe5e12bc..6b0a9518a 100644 --- a/src/features/profileLinks/components/LinkFormDialog.tsx +++ b/src/features/profileLinks/components/LinkFormDialog.tsx @@ -143,7 +143,6 @@ function LinkFormInner({ if ( !targetUrl || provider || - validation.isBlocked || validation.isShortener || validation.isInsecure ) { @@ -165,13 +164,7 @@ function LinkFormInner({ return () => { cancelled = true } - }, [ - targetUrl, - provider, - validation.isBlocked, - validation.isShortener, - validation.isInsecure, - ]) + }, [targetUrl, provider, validation.isShortener, validation.isInsecure]) const nextTitle = title.trim() || undefined const isUnchanged = @@ -188,14 +181,6 @@ function LinkFormInner({ setError('invalid') return } - if (validation.isBlocked) { - setError('blocked') - ax.metric('profile:links:rejected', { - reason: 'blocked', - domain: getLinkHost(targetUrl), - }) - return - } if (validation.isShortener) { setError('shortener') ax.metric('profile:links:rejected', { diff --git a/src/features/profileLinks/providers.test.ts b/src/features/profileLinks/providers.test.ts index 98bf12a16..225654dd2 100644 --- a/src/features/profileLinks/providers.test.ts +++ b/src/features/profileLinks/providers.test.ts @@ -3,7 +3,6 @@ import {describe, expect, it} from '@jest/globals' import { getLinkHost, getSupportProvider, - isBlockedProfileLink, isInsecureLink, isShortenerLink, normalizeProfileLinkUrl, @@ -102,25 +101,13 @@ describe('getLinkHost', () => { }) }) -describe('isBlockedProfileLink', () => { - it('blocks listed domains and their subdomains', () => { - expect(isBlockedProfileLink('https://onlyfans.com/kat')).toBe(true) - expect(isBlockedProfileLink('https://www.fansly.com/kat')).toBe(true) - expect(isBlockedProfileLink('https://videy.at/v/abc')).toBe(true) - }) - - it('does not block lookalikes or other sites', () => { - expect(isBlockedProfileLink('https://notonlyfans.com/kat')).toBe(false) - expect(isBlockedProfileLink('https://ko-fi.com/kat')).toBe(false) - }) -}) - describe('isShortenerLink', () => { it('flags general-purpose shorteners and their subdomains', () => { expect(isShortenerLink('https://bit.ly/abc')).toBe(true) expect(isShortenerLink('https://www.tinyurl.com/abc')).toBe(true) expect(isShortenerLink('https://x.gd/abc')).toBe(true) expect(isShortenerLink('https://shorten.world/abc')).toBe(true) + expect(isShortenerLink('https://videy.at/v/abc')).toBe(true) }) it('allows brand short links and lookalikes', () => { @@ -130,6 +117,17 @@ describe('isShortenerLink', () => { }) }) +describe('other sites', () => { + it('can be added as regular links', () => { + for (const input of ['onlyfans.com/kat', 'fansly.com/kat']) { + const result = validateLinkInput(input) + expect(result.url).toBe(`https://${input}`) + expect(result.isShortener).toBe(false) + expect(result.provider).toBe(undefined) + } + }) +}) + describe('isInsecureLink', () => { it('flags plain http links', () => { expect(isInsecureLink('http://example.com')).toBe(true) @@ -143,11 +141,10 @@ describe('validateLinkInput', () => { expect(result.url).toBe('https://ko-fi.com/kat') expect(result.provider?.name).toBe('Ko-fi') expect(result.isEmpty).toBe(false) - expect(result.isBlocked).toBe(false) + expect(result.isShortener).toBe(false) }) - it('flags blocked sites and empty input', () => { - expect(validateLinkInput('onlyfans.com/kat').isBlocked).toBe(true) + it('flags short links and insecure links', () => { expect(validateLinkInput('bit.ly/kat').isShortener).toBe(true) expect(validateLinkInput('http://example.com').isInsecure).toBe(true) expect(validateLinkInput('example.com').isInsecure).toBe(false) diff --git a/src/features/profileLinks/providers.ts b/src/features/profileLinks/providers.ts index dd4983779..a03e5c19a 100644 --- a/src/features/profileLinks/providers.ts +++ b/src/features/profileLinks/providers.ts @@ -122,28 +122,12 @@ export function normalizeProfileLinkUrl(input: string): string | null { } /** - * Sites that can't be added as profile links: adult-content platforms, and - * file and link hosts T&S has seen used the same way as shorteners. T&S owns - * the full list. - */ -export const BLOCKED_DOMAINS = [ - 'aceimg.in', - 'fansly.com', - 'onlyfans.com', - 'onlylinks.cc', - 'slicedrve.in', - 'vdey.in', - 'videy.at', - 'videy.lt', - 'videy.my', -] - -/** - * General-purpose URL shorteners, which hide where a link goes. Per T&S, most - * taps on adult links from profiles went through one. A brand's own short - * links (youtu.be, amzn.to) only lead to that brand, so they aren't listed. + * General-purpose URL shorteners, which hide where a link goes. A brand's own + * short links (youtu.be, amzn.to) only lead to that brand, so they aren't + * listed. */ export const SHORTENER_DOMAINS = [ + 'aceimg.in', 'acel.me', 'adf.ly', 'bit.ly', @@ -161,6 +145,7 @@ export const SHORTENER_DOMAINS = [ 'lnk.ua', 'lnkd.in', 'n9.cl', + 'onlylinks.cc', 'ow.ly', 'psee.io', 'rb.gy', @@ -180,6 +165,7 @@ export const SHORTENER_DOMAINS = [ 'shorturl.at', 'shorturl.lt', 'shorturl.ly', + 'slicedrve.in', 'slnt.to', 'smarturl.lt', 'smarturl.my', @@ -191,6 +177,10 @@ export const SHORTENER_DOMAINS = [ 'tinyurl.com', 'urlr.me', 'v.gd', + 'vdey.in', + 'videy.at', + 'videy.lt', + 'videy.my', 'x.gd', 'zig.ht', ] @@ -244,13 +234,6 @@ export function getSupportProvider(url: string): SupportProvider | undefined { ) } -export function isBlockedProfileLink(url: string): boolean { - const parsed = parseWebUrl(url) - if (!parsed) return false - const host = parsed.hostname.toLowerCase() - return BLOCKED_DOMAINS.some(domain => hostMatchesDomain(host, domain)) -} - /** Plain http links can be tampered with on the way, so only https is allowed. */ export function isInsecureLink(url: string): boolean { return parseWebUrl(url)?.protocol === 'http:' @@ -281,7 +264,6 @@ export type LinkInputValidation = { url: string | null provider: SupportProvider | undefined isEmpty: boolean - isBlocked: boolean isShortener: boolean isInsecure: boolean } @@ -294,7 +276,6 @@ export function validateLinkInput(input: string): LinkInputValidation { url, provider: url ? getSupportProvider(url) : undefined, isEmpty: trimmed.length === 0, - isBlocked: !!url && isBlockedProfileLink(url), isShortener: !!url && isShortenerLink(url), // typing more can't fix an http scheme, so flag it before the host is done isInsecure: /^http:/i.test(trimmed) || (!!url && isInsecureLink(url)), diff --git a/src/features/profileLinks/record.test.ts b/src/features/profileLinks/record.test.ts index b46cf590d..bc9e31e3a 100644 --- a/src/features/profileLinks/record.test.ts +++ b/src/features/profileLinks/record.test.ts @@ -69,7 +69,7 @@ describe('linksFromProfileView', () => { it('skips links the app does not allow', () => { const links = linksFromProfileView([ view('a', 'javascript:alert(1)'), - view('b', 'https://onlyfans.com/kat'), + view('b', 'https://videy.at/v/abc'), view('c', 'https://bit.ly/kat'), view('d', 'http://insecure.example'), view('e', 'https://example.com'), @@ -130,6 +130,13 @@ describe('filterModeratedLinkViews', () => { ).toEqual([]) }) + it('keeps labeled links the viewer has chosen to see', () => { + const link = labeled(labeler, 'porn') + const adultOpts = opts(true) + adultOpts.prefs.labels = {porn: 'ignore'} + expect(filterModeratedLinkViews([link], adultOpts)).toEqual([link]) + }) + it('hides links the owner self-labels as adult content', () => { expect(filterModeratedLinkViews([labeled(DID, 'porn')], opts())).toEqual([]) }) diff --git a/src/features/profileLinks/record.ts b/src/features/profileLinks/record.ts index 4121bb6b3..76ed0c9a2 100644 --- a/src/features/profileLinks/record.ts +++ b/src/features/profileLinks/record.ts @@ -4,7 +4,6 @@ import {splitGraphemes} from 'unicode-segmenter/grapheme' import {type app} from '#/lexicons' import { - isBlockedProfileLink, isInsecureLink, isShortenerLink, normalizeProfileLinkUrl, @@ -20,7 +19,6 @@ function isShowable(url: string, seen: Set): boolean { if ( !normalized || seen.has(normalized) || - isBlockedProfileLink(normalized) || isShortenerLink(normalized) || isInsecureLink(normalized) ) { -- knotmirror 0.0.1