reject-data-source.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. import { TTL } from '../lib/cache-filesystem';
  2. export const DEBUG_DOMAIN_TO_FIND: string | null = null; // example.com | null
  3. type HostsSource = [main: string, mirrors: string[] | null, includeAllSubDomain: boolean, ttl: number];
  4. export const HOSTS: HostsSource[] = [
  5. // have not been updated for more than a year, so we set a 14 days cache ttl
  6. ['https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt', null, true, TTL.TWO_WEEKS()],
  7. ['https://raw.githubusercontent.com/jerryn70/GoodbyeAds/master/Extension/GoodbyeAds-Xiaomi-Extension.txt', null, false, TTL.ONE_WEEK()],
  8. ['https://raw.githubusercontent.com/jerryn70/GoodbyeAds/master/Extension/GoodbyeAds-Huawei-AdBlock.txt', null, false, TTL.ONE_WEEK()],
  9. ['https://raw.githubusercontent.com/durablenapkin/block/master/luminati.txt', null, true, TTL.THREE_HOURS()],
  10. ['https://raw.githubusercontent.com/durablenapkin/block/master/tvstream.txt', null, true, TTL.THREE_HOURS()]
  11. ];
  12. export const HOSTS_EXTRA: HostsSource[] = [
  13. // This stupid hosts blocks t.co, so we determine that this is also bullshit, so it is also extra
  14. [
  15. 'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext',
  16. ['https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/thirdparties/pgl.yoyo.org/as/serverlist'],
  17. true,
  18. TTL.THREE_HOURS()
  19. ],
  20. // Dan Pollock's hosts file, 0.0.0.0 version is 30 KiB smaller
  21. ['https://someonewhocares.org/hosts/zero/hosts', null, true, TTL.THREE_HOURS()],
  22. // ad-wars is not actively maintained, so we set a 7 days cache ttl
  23. ['https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts', null, false, TTL.TWO_WEEKS()]
  24. ];
  25. export const DOMAIN_LISTS: HostsSource[] = [
  26. // CoinBlockerList
  27. // Although the hosts file is still actively maintained, the hosts_browser file is not updated since 2021-07, so we set a 14 days cache ttl
  28. ['https://zerodot1.gitlab.io/CoinBlockerLists/list_browser.txt', [], true, TTL.TWO_WEEKS()]
  29. ];
  30. export const DOMAIN_LISTS_EXTRA: HostsSource[] = [
  31. // BarbBlock
  32. // The barbblock list has never been updated since 2019-05, so we set a 14 days cache ttl
  33. [
  34. 'https://paulgb.github.io/BarbBlock/blacklists/domain-list.txt',
  35. ['https://raw.githubusercontent.com/paulgb/BarbBlock/refs/heads/main/blacklists/domain-list.txt'],
  36. true,
  37. TTL.TWO_WEEKS()
  38. ],
  39. // DigitalSide Threat-Intel - OSINT Hub
  40. // Update once per day
  41. ['https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt', [], true, TTL.ONE_DAY()],
  42. // AdGuard CNAME Filter Combined
  43. // Update on a 7 days basis, so we add a 3 hours cache ttl
  44. ['https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_ads_justdomains.txt', [], true, TTL.THREE_DAYS()],
  45. ['https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_trackers_justdomains.txt', [], true, TTL.THREE_DAYS()],
  46. ['https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_clickthroughs_justdomains.txt', [], true, TTL.THREE_DAYS()],
  47. ['https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_microsites_justdomains.txt', [], true, TTL.THREE_DAYS()],
  48. // ['https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_mail_trackers_justdomains.txt', [], true, TTL.THREE_DAYS()],
  49. // Curben's PUP Domains Blocklist
  50. // The PUP filter has paused the update since 2023-05, so we set a 14 days cache ttl, and move it to extra
  51. // [
  52. // 'https://pup-filter.pages.dev/pup-filter-domains.txt',
  53. // [
  54. // // 'https://malware-filter.pages.dev/pup-filter-domains.txt',
  55. // // 'https://malware-filter.gitlab.io/malware-filter/pup-filter-domains.txt',
  56. // 'https://malware-filter.gitlab.io/pup-filter/pup-filter-domains.txt'
  57. // // 'https://curbengh.github.io/pup-filter/pup-filter-domains.txt',
  58. // // 'https://malware-filter.pages.dev/pup-filter-domains.txt'
  59. // ],
  60. // true, TTL.TWO_WEEKS()
  61. // ],
  62. // Curben's UrlHaus Malicious URL Blocklist
  63. [
  64. 'https://urlhaus-filter.pages.dev/urlhaus-filter-domains.txt',
  65. [
  66. 'https://malware-filter.pages.dev/urlhaus-filter-domains.txt',
  67. 'https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-domains.txt',
  68. 'https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-domains.txt',
  69. 'https://curbengh.github.io/urlhaus-filter/urlhaus-filter-domains.txt'
  70. ],
  71. true, TTL.THREE_HOURS()
  72. ],
  73. // Spam404
  74. // Not actively maintained, let's use a 10 days cache ttl
  75. ['https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt', [], true, TTL.TEN_DAYS()]
  76. ];
  77. export const PHISHING_HOSTS_EXTRA: HostsSource[] = [
  78. ['https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/hosts.txt', [], true, TTL.THREE_DAYS()]
  79. ];
  80. export const PHISHING_DOMAIN_LISTS_EXTRA: HostsSource[] = [
  81. [
  82. 'https://phishing-filter.pages.dev/phishing-filter-domains.txt',
  83. [
  84. 'https://malware-filter.pages.dev/phishing-filter-domains.txt',
  85. 'https://malware-filter.gitlab.io/phishing-filter/phishing-filter-domains.txt',
  86. 'https://malware-filter.gitlab.io/malware-filter/phishing-filter-domains.txt',
  87. 'https://curbengh.github.io/phishing-filter/phishing-filter-domains.txt'
  88. ],
  89. true, TTL.THREE_HOURS()
  90. ],
  91. [
  92. 'https://phishing.army/download/phishing_army_blocklist.txt',
  93. [],
  94. true, TTL.THREE_HOURS()
  95. ]
  96. ];
  97. type AdGuardFilterSource = [main: string, mirrors: string[] | null, ttl: number, allowThirdParty?: boolean];
  98. export const ADGUARD_FILTERS: AdGuardFilterSource[] = [
  99. // no coin list adguard list is more maintained than its hosts
  100. ['https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt', [], TTL.TWO_WEEKS()],
  101. // EasyList
  102. [
  103. 'https://easylist.to/easylist/easylist.txt',
  104. [
  105. 'https://easylist-downloads.adblockplus.org/easylist.txt',
  106. 'https://secure.fanboy.co.nz/easylist.txt',
  107. 'https://ublockorigin.github.io/uAssetsCDN/thirdparties/easylist.txt',
  108. 'https://ublockorigin.pages.dev/thirdparties/easylist.txt',
  109. 'https://raw.githubusercontent.com/easylist/easylist/gh-pages/easylist.txt'
  110. ],
  111. TTL.TWLVE_HOURS()
  112. ],
  113. // EasyPrivacy
  114. [
  115. 'https://easylist.to/easylist/easyprivacy.txt',
  116. [
  117. 'https://easylist-downloads.adblockplus.org/easyprivacy.txt',
  118. 'https://secure.fanboy.co.nz/easyprivacy.txt',
  119. 'https://ublockorigin.github.io/uAssetsCDN/thirdparties/easyprivacy.txt',
  120. 'https://ublockorigin.pages.dev/thirdparties/easyprivacy.txt',
  121. 'https://raw.githubusercontent.com/easylist/easylist/gh-pages/easyprivacy.txt'
  122. ],
  123. TTL.TWLVE_HOURS()
  124. ],
  125. // AdGuard DNS Filter
  126. [
  127. 'https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt',
  128. [
  129. 'https://filters.adtidy.org/extension/ublock/filters/15_optimized.txt',
  130. 'https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt'
  131. ],
  132. TTL.TWLVE_HOURS()
  133. ],
  134. // AdGuard Base Filter
  135. ['https://filters.adtidy.org/extension/ublock/filters/2_without_easylist.txt', null, TTL.THREE_HOURS()],
  136. // AdGuard Mobile AD
  137. ['https://filters.adtidy.org/extension/ublock/filters/11_optimized.txt', null, TTL.THREE_HOURS()],
  138. // AdGuard Tracking Protection
  139. ['https://filters.adtidy.org/extension/ublock/filters/3_optimized.txt', null, TTL.THREE_HOURS()],
  140. // AdGuard Chinese filter (EasyList China + AdGuard Chinese filter)
  141. ['https://filters.adtidy.org/extension/ublock/filters/224_optimized.txt', null, TTL.THREE_HOURS()],
  142. // GameConsoleAdblockList
  143. // Update almost once per 1 to 3 months, let's set a 10 days cache ttl
  144. ['https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt', null, TTL.TEN_DAYS()],
  145. // PiHoleBlocklist
  146. // Update almost once per 3 months, let's set a 10 days cache ttl
  147. [
  148. 'https://perflyst.github.io/PiHoleBlocklist/SmartTV-AGH.txt',
  149. [
  150. 'https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt'
  151. ],
  152. TTL.TEN_DAYS()
  153. ],
  154. // uBlock Origin Unbreak
  155. [
  156. 'https://ublockorigin.github.io/uAssetsCDN/filters/unbreak.min.txt',
  157. [
  158. 'https://ublockorigin.pages.dev/filters/unbreak.min.txt'
  159. ],
  160. TTL.THREE_HOURS()
  161. ]
  162. ];
  163. export const ADGUARD_FILTERS_WHITELIST: AdGuardFilterSource[] = [
  164. [
  165. 'https://adguardteam.github.io/AdGuardSDNSFilter/Filters/exceptions.txt',
  166. [
  167. 'https://raw.githubusercontent.com/AdguardTeam/AdGuardSDNSFilter/master/Filters/exceptions.txt'
  168. ],
  169. TTL.THREE_HOURS()
  170. ],
  171. [
  172. 'https://adguardteam.github.io/AdGuardSDNSFilter/Filters/exclusions.txt',
  173. [
  174. 'https://raw.githubusercontent.com/AdguardTeam/AdGuardSDNSFilter/master/Filters/exclusions.txt'
  175. ],
  176. TTL.THREE_HOURS()
  177. ]
  178. ];
  179. export const ADGUARD_FILTERS_EXTRA: AdGuardFilterSource[] = [
  180. // AdGuard Annoyances filter
  181. ['https://filters.adtidy.org/extension/ublock/filters/14_optimized.txt', null, TTL.THREE_HOURS(), true],
  182. // AdGuard Cookie Notices, included in Annoyances filter
  183. // ['https://filters.adtidy.org/extension/ublock/filters/18_optimized.txt', null, TTL.THREE_HOURS(), true],
  184. // EasyList Germany filter, not even included in extra for now
  185. // [
  186. // 'https://easylist.to/easylistgermany/easylistgermany.txt',
  187. // [
  188. // 'https://easylist-downloads.adblockplus.org/easylistgermany.txt'
  189. // ],
  190. // TTL.TWLVE_HOURS()
  191. // ],
  192. // AdGuard Japanese filter
  193. ['https://filters.adtidy.org/extension/ublock/filters/7_optimized.txt', null, TTL.THREE_HOURS()],
  194. // uBlock Origin Filter List
  195. [
  196. 'https://ublockorigin.github.io/uAssetsCDN/filters/filters.min.txt',
  197. [
  198. 'https://ublockorigin.pages.dev/filters/filters.min.txt'
  199. ],
  200. TTL.THREE_HOURS()
  201. ],
  202. // AdGuard Popup Overlay - included in Annoyances filter
  203. // ['https://filters.adtidy.org/extension/ublock/filters/19_optimized.txt', null, TTL.THREE_HOURS(), true],
  204. // AdGuard Mobile Banner
  205. // almost all generic rule
  206. // ['https://filters.adtidy.org/extension/ublock/filters/20_optimized.txt', null, TTL.THREE_HOURS()],
  207. // uBlock Origin Badware Risk List
  208. [
  209. 'https://ublockorigin.github.io/uAssetsCDN/filters/badware.min.txt',
  210. [
  211. 'https://ublockorigin.pages.dev/filters/badware.min.txt'
  212. ],
  213. TTL.THREE_HOURS()
  214. ],
  215. // uBlock Origin Privacy List
  216. [
  217. 'https://ublockorigin.github.io/uAssetsCDN/filters/privacy.min.txt',
  218. [
  219. 'https://ublockorigin.pages.dev/filters/privacy.min.txt'
  220. ],
  221. TTL.THREE_HOURS()
  222. ],
  223. // uBlock Origin Resource Abuse: merged in uBlock Origin Privacy List
  224. // [
  225. // 'https://ublockorigin.github.io/uAssetsCDN/filters/resource-abuse.txt',
  226. // ['https://ublockorigin.pages.dev/filters/resource-abuse.txt']
  227. // ],
  228. // uBlock Origin Annoyances
  229. [
  230. 'https://ublockorigin.github.io/uAssetsCDN/filters/annoyances.min.txt',
  231. ['https://ublockorigin.pages.dev/filters/annoyances.min.txt'],
  232. TTL.THREE_HOURS()
  233. ],
  234. // EasyList Annoyances
  235. [
  236. 'https://ublockorigin.github.io/uAssetsCDN/thirdparties/easylist-annoyances.txt',
  237. ['https://ublockorigin.pages.dev/thirdparties/easylist-annoyances.txt'],
  238. TTL.THREE_HOURS()
  239. ],
  240. // Dandelion Sprout's Annoyances
  241. ['https://filters.adtidy.org/extension/ublock/filters/250_optimized.txt', null, TTL.THREE_HOURS(), true],
  242. // EasyList - Newsletters
  243. [
  244. 'https://ublockorigin.github.io/uAssetsCDN/thirdparties/easylist-newsletters.txt',
  245. ['https://ublockorigin.pages.dev/thirdparties/easylist-newsletters.txt'],
  246. TTL.THREE_HOURS()
  247. ],
  248. // EasyList - Notifications
  249. [
  250. 'https://ublockorigin.github.io/uAssets/thirdparties/easylist-notifications.txt',
  251. ['https://ublockorigin.pages.dev/thirdparties/easylist-notifications.txt'],
  252. TTL.THREE_HOURS()
  253. ],
  254. // Fanboy Cookie Monster (EasyList Cookie List)
  255. [
  256. 'https://ublockorigin.github.io/uAssets/thirdparties/easylist-cookies.txt',
  257. [
  258. 'https://ublockorigin.pages.dev/thirdparties/easylist-cookies.txt',
  259. 'https://secure.fanboy.co.nz/fanboy-cookiemonster_ubo.txt'
  260. ],
  261. TTL.TWLVE_HOURS()
  262. ]
  263. ];
  264. // In a hostile network like when an ad blocker is present, apps might be crashing, and these errors need to be
  265. // The reason for unblocking crashlytics is to not make developers life worse by breaking crash reporting.
  266. // In a hostile network like when an ad blocker is present, apps might be crashing, and these errors need to be
  267. // reported to devs, otherwise they won't learn about the issue and won't fix it.
  268. // Also, it is not a common third-party analytics tracker, Crashlytics is not used for collecting users' data.
  269. export const CRASHLYTICS_WHITELIST = [
  270. // VSCode Telemetry, see https://sts.online.visualstudio.com/api/swagger/index.html
  271. 'sts.online.visualstudio.com',
  272. // Sentry
  273. '.ingest.sentry.io',
  274. // bugsnag
  275. '.sessions.bugsnag.com',
  276. '.notify.bugsnag.com',
  277. // influxdata
  278. '.cloud.influxdata.com',
  279. '.cloud1.influxdata.com',
  280. '.cloud2.influxdata.com',
  281. // split.io A/B flag
  282. 'streaming.split.io',
  283. 'telemetry.split.io',
  284. 'sdk.split.io',
  285. // Google
  286. // -ds.metric.gstatic.com are specifically exempted from reject, but it could use secondary proxy policy
  287. '.metric.gstatic.com',
  288. // Misc
  289. 'telemetry.1passwordservices.com',
  290. 'events.tableplus.com',
  291. 'telemetry.nextjs.org',
  292. 'telemetry.vercel.com',
  293. 'stats.setapp.com',
  294. 'stats.setapp.macpaw.dev',
  295. '.app-analytics-services.com',
  296. '.telemetry.services.yofi.ai',
  297. '.cdn.pubnub.com',
  298. '.data.debugbear.com',
  299. '.cdn.applicationinsights.io',
  300. '.applicationinsights.azure.com',
  301. '.applicationinsights.azure.cn',
  302. '.api.loganalytics.io',
  303. '.bugly.qcloud.com',
  304. '.cdn.signalfx.com',
  305. '.crash-reports.browser.yandex.net',
  306. '.crashlytics2.l.google.com',
  307. '.crashlyticsreports-pa.googleapis.com',
  308. '.e.crashlytics.com',
  309. '.events.backtrace.io',
  310. 'auth.split.io',
  311. 'events.split.io',
  312. 'streaming.split.io',
  313. '.in.appcenter.ms',
  314. '.loggly.com',
  315. '.logz.io',
  316. '.opentelemetry.io',
  317. '.raygun.io', // dashboard lives at raygun.com
  318. '.rum.cronitor.io',
  319. '.settings.crashlytics.com',
  320. '.sny.monosnap.com',
  321. '.lr-ingest.com',
  322. '.cdn.rollbar.com',
  323. '.api.instabug.com',
  324. '.ensighten.com',
  325. 'api.crashguard.me'
  326. ];
  327. export const PREDEFINED_WHITELIST = [
  328. ...CRASHLYTICS_WHITELIST,
  329. '.localhost',
  330. '.local',
  331. '.localdomain',
  332. '.broadcasthost',
  333. '.ip6-loopback',
  334. '.ip6-localnet',
  335. '.ip6-mcastprefix',
  336. '.ip6-allnodes',
  337. '.ip6-allrouters',
  338. '.ip6-allhosts',
  339. '.mcastprefix',
  340. '.skk.moe',
  341. '.cdn.cloudflare.net', // Surge/Clash doesn't support CNAME
  342. 'analytics.google.com',
  343. '.cloud.answerhub.com',
  344. 'ae01.alicdn.com',
  345. '.whoami.akamai.net',
  346. '.whoami.ds.akahelp.net',
  347. 'pxlk9.net.', // This one is malformed from EasyList, which I will manually add instead
  348. '.instant.page', // No, it doesn't violate anyone's privacy. I will whitelist it
  349. '.piwik.pro',
  350. 'mixpanel.com',
  351. 'cdn.mxpnl.com',
  352. '.heapanalytics.com',
  353. '.segment.com',
  354. '.segmentify.com',
  355. '.t.co', // pgl yoyo add t.co to the blacklist
  356. '.survicate.com', // AdGuardDNSFilter
  357. '.perfops.io', // AdGuardDNSFilter
  358. '.d2axgrpnciinw7.cloudfront.net', // ADGuardDNSFilter
  359. '.sb-cd.com', // AdGuard
  360. '.storage.yandexcloud.net', // phishing list
  361. '.login.microsoftonline.com', // phishing list
  362. 'api.xiaomi.com', // https://github.com/jerryn70/GoodbyeAds/issues/281
  363. 'api.io.mi.com', // https://github.com/jerryn70/GoodbyeAds/issues/281
  364. '.cdn.userreport.com', // https://github.com/AdguardTeam/AdGuardSDNSFilter/issues/1158
  365. '.ip-api.com',
  366. '.fastly-analytics.com',
  367. '.digitaloceanspaces.com',
  368. 's3.nl-ams.scw.cloud',
  369. '.geolocation-db.com',
  370. '.uploads.codesandbox.io',
  371. '.vlscppe.microsoft.com', // Affect Windows ISO download https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_trackers.txt
  372. '.statsig.com', // OpenAI use this for A/B testing
  373. '.pstmrk.it', // Fuck Peter Lowe Hosts
  374. '.clicks.mlsend.com', // Fuck Peter Lowe Hosts
  375. 'email.accounts.bitly.com', // Fuck Peter Lowe Hosts
  376. 'adsense.google.com', // Fuck Peter Lowe Hosts
  377. 'api.vip.miui.com', // Fuck Goodbye Xiaomi Ads
  378. 'api.comm.miui.com', // Xiaomi MIUI phone number database update URL
  379. '.ai.api.xiaomi.com', // Fuck Goodbye Xiaomi Ads
  380. 'm.stripe.com', // EasyPrivacy only blocks m.stripe.com wwith $third-party,
  381. // yet stupid AdGuardDNSFilter blocks all of it. Stupid AdGuard
  382. '.w3s.link', // stupid phishing.army, introduce both "*.ipfs.w3s.link" and ".w3s.link" to the block list
  383. '.r2.dev', // Despite 5000+ r2 instances used for phishing, yet cloudflare refuse to do anything. we have no choice but whitelist this.
  384. 'mlsend.com', // Fuck Peter Lowe Hosts
  385. 'ab.chatgpt.com', // EasyPrivacy blocks this
  386. 'jnn-pa.googleapis.com', // ad-wars
  387. 'imasdk.googleapis.com', // ad-wars
  388. '.l.qq.com', // ad-wars
  389. '.in-addr.arpa', // rDNS
  390. '.ip6.arpa', // rDNS
  391. '.clients.your-server.de', // rDNS .static.183.213.201.138.clients.your-server.de
  392. '.bc.googleusercontent.com', // rDNS 218.178.172.34.bc.googleusercontent.com
  393. '.host.secureserver.net', // rDNS .64.149.167.72.host.secureserver.net,
  394. '.ip.linodeusercontent.com', // rDNS 45-79-169-153.ip.linodeusercontent.com
  395. '.shoppy.gg', // Spam404
  396. 'transcend-cdn.com', // AdGuard Annoyances
  397. 'store1.gofile.io', // Dandelion Sprout's Annoyances List
  398. 'ad.12306.cn' // https://github.com/jdlingyu/ad-wars
  399. ];