Skip to content

Add Facebook/Meta + TikTok/Bytedance IP ranges to bots list#3411

Merged
steven-tey merged 1 commit intomainfrom
ip-ranges
Feb 3, 2026
Merged

Add Facebook/Meta + TikTok/Bytedance IP ranges to bots list#3411
steven-tey merged 1 commit intomainfrom
ip-ranges

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Feb 3, 2026

Summary by CodeRabbit

  • Improvements
    • Expanded bot detection to include many additional IP ranges for Meta (Facebook) and TikTok (Bytedance), improving recognition and management of automated traffic from these platforms and reducing false positives/negatives in traffic handling.

@vercel
Copy link
Contributor

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dub Ready Ready Preview Feb 3, 2026 11:20pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The pull request expands the IP_RANGES_BOTS array in apps/web/lib/middleware/utils/bots-list.ts by adding numerous Facebook/Meta and TikTok/Bytedance IP range string literals; no logic, signatures, or control flow were changed.

Changes

Cohort / File(s) Summary
Bot IP Range Expansion
apps/web/lib/middleware/utils/bots-list.ts
Added ~429 string literals of IP ranges for Facebook/Meta and TikTok/Bytedance to the exported IP_RANGES_BOTS array; no functional or signature changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through lists both vast and wide,

Meta and TikTok now sit side by side.
Ranges added, neat and bright,
Catching bots by day and night. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Facebook/Meta and TikTok/Bytedance IP ranges to the bots list, which directly matches the 429 lines of IP range additions to the IP_RANGES_BOTS export.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ip-ranges

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@steven-tey
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

✅ Actions performed

Full review triggered.

@steven-tey steven-tey merged commit fe39e7d into main Feb 3, 2026
10 of 12 checks passed
@steven-tey steven-tey deleted the ip-ranges branch February 3, 2026 23:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/web/lib/middleware/utils/bots-list.ts`:
- Around line 400-604: The TikTok / Bytedance IP ranges block currently includes
only IPv4 and appears to be a historical snapshot; update the TikTok / Bytedance
IP ranges array in apps/web/lib/middleware/utils/bots-list.ts by adding the five
IPv6 prefixes (2404:9dc0:cd01::/48, 2404:9dc0:cd03::/48, 2404:9dc0:cd05::/48,
2404:9dc0:cd06::/48, 2404:9dc0:cd07::/48) and add a clear comment above the
block (referencing AS138699) that documents the source, source date (e.g.,
2026-01-29), and whether the list is "historical/full" or "current BGP-announced
only"; if you choose to trim IPv4 to current announcements, replace the large
IPv4 list with the 19 active prefixes obtained from a BGP lookup of AS138699 and
note that choice in the comment.
🧹 Nitpick comments (1)
apps/web/lib/middleware/utils/bots-list.ts (1)

177-399: Normalize overlapping Meta CIDR entries to reduce redundancy.

There are overlapping blocks (e.g., Line 185–191 includes 69.171.224.0/19 plus its /20 subranges; Line 271–279 includes 129.134.26.0/23 plus 129.134.26.0/24). Consider merging/deduping with a CIDR-merge pass so the list stays minimal and avoids redundant checks in IP matching.

Comment on lines +400 to +604
// TikTok / Bytedance IP ranges (see: https://ipinfo.io/AS138699#block-ranges)
"71.18.64.0/21",
"202.52.240.0/21",
"71.18.16.0/22",
"71.18.56.0/22",
"71.18.84.0/22",
"71.18.96.0/22",
"71.18.108.0/22",
"71.18.140.0/22",
"71.18.2.0/23",
"71.18.36.0/23",
"71.18.44.0/23",
"71.18.48.0/23",
"71.18.88.0/23",
"71.18.90.0/23",
"71.18.120.0/23",
"71.18.138.0/23",
"71.18.1.0/24",
"71.18.4.0/24",
"71.18.5.0/24",
"71.18.6.0/24",
"71.18.7.0/24",
"71.18.8.0/24",
"71.18.10.0/24",
"71.18.11.0/24",
"71.18.12.0/24",
"71.18.13.0/24",
"71.18.20.0/24",
"71.18.21.0/24",
"71.18.24.0/24",
"71.18.25.0/24",
"71.18.26.0/24",
"71.18.29.0/24",
"71.18.30.0/24",
"71.18.31.0/24",
"71.18.32.0/24",
"71.18.33.0/24",
"71.18.34.0/24",
"71.18.35.0/24",
"71.18.38.0/24",
"71.18.39.0/24",
"71.18.40.0/24",
"71.18.41.0/24",
"71.18.42.0/24",
"71.18.43.0/24",
"71.18.46.0/24",
"71.18.47.0/24",
"71.18.50.0/24",
"71.18.51.0/24",
"71.18.52.0/24",
"71.18.53.0/24",
"71.18.54.0/24",
"71.18.55.0/24",
"71.18.60.0/24",
"71.18.72.0/24",
"71.18.73.0/24",
"71.18.74.0/24",
"71.18.75.0/24",
"71.18.77.0/24",
"71.18.79.0/24",
"71.18.80.0/24",
"71.18.81.0/24",
"71.18.82.0/24",
"71.18.92.0/24",
"71.18.93.0/24",
"71.18.94.0/24",
"71.18.95.0/24",
"71.18.100.0/24",
"71.18.101.0/24",
"71.18.102.0/24",
"71.18.103.0/24",
"71.18.104.0/24",
"71.18.105.0/24",
"71.18.106.0/24",
"71.18.107.0/24",
"71.18.112.0/24",
"71.18.113.0/24",
"71.18.116.0/24",
"71.18.117.0/24",
"71.18.118.0/24",
"71.18.119.0/24",
"71.18.122.0/24",
"71.18.123.0/24",
"71.18.124.0/24",
"71.18.125.0/24",
"71.18.126.0/24",
"71.18.127.0/24",
"71.18.128.0/24",
"71.18.129.0/24",
"71.18.130.0/24",
"71.18.131.0/24",
"71.18.132.0/24",
"71.18.133.0/24",
"71.18.134.0/24",
"71.18.135.0/24",
"71.18.136.0/24",
"71.18.137.0/24",
"71.18.144.0/24",
"71.18.145.0/24",
"71.18.146.0/24",
"71.18.147.0/24",
"71.18.148.0/24",
"71.18.149.0/24",
"71.18.150.0/24",
"71.18.152.0/24",
"71.18.153.0/24",
"71.18.154.0/24",
"71.18.155.0/24",
"71.18.156.0/24",
"71.18.157.0/24",
"71.18.158.0/24",
"71.18.159.0/24",
"71.18.160.0/24",
"71.18.161.0/24",
"71.18.162.0/24",
"71.18.163.0/24",
"71.18.164.0/24",
"71.18.165.0/24",
"71.18.166.0/24",
"71.18.167.0/24",
"71.18.168.0/24",
"71.18.169.0/24",
"71.18.170.0/24",
"71.18.171.0/24",
"71.18.175.0/24",
"71.18.176.0/24",
"71.18.177.0/24",
"71.18.178.0/24",
"71.18.179.0/24",
"71.18.180.0/24",
"71.18.182.0/24",
"71.18.183.0/24",
"71.18.184.0/24",
"71.18.185.0/24",
"71.18.186.0/24",
"71.18.187.0/24",
"71.18.188.0/24",
"71.18.191.0/24",
"71.18.192.0/24",
"71.18.193.0/24",
"71.18.196.0/24",
"71.18.197.0/24",
"71.18.199.0/24",
"71.18.200.0/24",
"71.18.201.0/24",
"71.18.202.0/24",
"71.18.203.0/24",
"71.18.204.0/24",
"71.18.205.0/24",
"71.18.206.0/24",
"71.18.207.0/24",
"71.18.208.0/24",
"71.18.209.0/24",
"71.18.210.0/24",
"71.18.211.0/24",
"71.18.212.0/24",
"71.18.213.0/24",
"71.18.214.0/24",
"71.18.215.0/24",
"71.18.216.0/24",
"71.18.217.0/24",
"71.18.218.0/24",
"71.18.219.0/24",
"71.18.222.0/24",
"71.18.223.0/24",
"71.18.224.0/24",
"71.18.228.0/24",
"71.18.231.0/24",
"71.18.232.0/24",
"71.18.237.0/24",
"71.18.238.0/24",
"71.18.239.0/24",
"71.18.240.0/24",
"71.18.241.0/24",
"71.18.243.0/24",
"71.18.244.0/24",
"71.18.245.0/24",
"71.18.246.0/24",
"130.44.212.0/24",
"130.44.214.0/24",
"130.44.215.0/24",
"139.177.225.0/24",
"139.177.227.0/24",
"139.177.233.0/24",
"139.177.235.0/24",
"139.177.238.0/24",
"139.177.240.0/24",
"139.177.241.0/24",
"139.177.242.0/24",
"139.177.243.0/24",
"139.177.244.0/24",
"139.177.245.0/24",
"139.177.246.0/24",
"139.177.247.0/24",
"139.177.248.0/24",
"147.160.176.0/24",
"147.160.180.0/24",
"147.160.182.0/24",
"147.160.184.0/24",
"147.160.190.0/24",
"180.240.234.0/24",
"180.240.235.0/24",
"192.64.15.0/24",
"199.103.24.0/24",
"199.103.25.0/24",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the full context of the bots-list.ts file
wc -l apps/web/lib/middleware/utils/bots-list.ts

Repository: dubinc/dub

Length of output: 100


🏁 Script executed:

# Look at the structure and see what's before line 400
head -405 apps/web/lib/middleware/utils/bots-list.ts | tail -10

Repository: dubinc/dub

Length of output: 295


🏁 Script executed:

# Check if IPv6 ranges exist anywhere in the file
grep -i "ipv6\|:" apps/web/lib/middleware/utils/bots-list.ts | head -20

Repository: dubinc/dub

Length of output: 500


🏁 Script executed:

# See the context around lines 400-604 and check for any IPv6
sed -n '395,610p' apps/web/lib/middleware/utils/bots-list.ts | head -30

Repository: dubinc/dub

Length of output: 674


🌐 Web query:

AS138699 ByteDance TikTok announced prefixes IPv4 IPv6 2026

💡 Result:

As of January 29, 2026, AS138699 (TIKTOK PTE. LTD. / ByteDance TikTok) is announcing the following prefixes:

IPv4 (19)

  • 71.18.247.0/24
  • 71.18.248.0/24
  • 71.18.250.0/24
  • 71.18.251.0/24
  • 71.18.252.0/24
  • 71.18.253.0/24
  • 71.18.255.0/24
  • 101.45.192.0/24
  • 101.45.193.0/24
  • 101.45.194.0/24
  • 101.45.195.0/24
  • 101.45.248.0/22
  • 101.45.248.0/24
  • 103.136.220.0/23
  • 103.136.220.0/24
  • 103.136.221.0/24
  • 103.136.222.0/24
  • 103.136.223.0/24
  • 118.26.132.0/24 [1]

IPv6 (5)

  • 2404:9dc0:cd01::/48
  • 2404:9dc0:cd03::/48
  • 2404:9dc0:cd05::/48
  • 2404:9dc0:cd06::/48
  • 2404:9dc0:cd07::/48 [1]

Source: Hurricane Electric BGP Toolkit for AS138699. [1]

References
[1] Hurricane Electric BGP Toolkit — AS138699 (Prefixes Announced v4/v6) (bgp.he.net)

Citations:


🌐 Web query:

AS138699 current CIDR blocks 2025 2026 BGP announcements

💡 Result:

AS138699 (TikTok Pte. Ltd. / ByteDance) — currently originated/announced CIDR blocks (observed Jan 29, 2026)

IPv4 (19)

  • 71.18.247.0/24
  • 71.18.248.0/24
  • 71.18.250.0/24
  • 71.18.251.0/24
  • 71.18.252.0/24
  • 71.18.253.0/24
  • 71.18.255.0/24
  • 101.45.192.0/24
  • 101.45.193.0/24
  • 101.45.194.0/24
  • 101.45.195.0/24
  • 101.45.248.0/24
  • 101.45.248.0/22
  • 103.136.220.0/24
  • 103.136.220.0/23
  • 103.136.221.0/24
  • 103.136.222.0/24
  • 103.136.223.0/24
  • 118.26.132.0/24  [1][2]

IPv6 (5)

  • 2404:9dc0:cd01::/48
  • 2404:9dc0:cd03::/48
  • 2404:9dc0:cd05::/48
  • 2404:9dc0:cd06::/48
  • 2404:9dc0:cd07::/48  [1][2]

Sources: bgp.tools ASN page for AS138699 (prefix list) and Hurricane Electric BGP Toolkit AS138699 page (counts + last update timestamp). [1][2]


🌐 Web query:

ByteDance TikTok IPv6 address ranges ASN

💡 Result:

TikTok / ByteDance ASNs (with IPv6 BGP-announced prefixes)

AS138699 — TIKTOK PTE. LTD. (TIKTOK-AS-AP, bytedance.com) [1][2]
IPv6 prefixes (originated):

  • 2404:9dc0:cd01::/48
  • 2404:9dc0:cd03::/48
  • 2404:9dc0:cd05::/48
  • 2404:9dc0:cd06::/48
  • 2404:9dc0:cd07::/48  [1]

AS396986 — Bytedance Inc. (BYTEDANCE, bytedance.com) [3][4]
IPv6 prefixes (originated) include many /48s under 2605:340::/48 space, e.g.:

  • 2605:340::/48, 2605:340:1::/48
  • 2605:340:100::/48, 2605:340:200::/48, 2605:340:300::/48, 2605:340:301::/48
  • 2605:340:f00b::/48, 2605:340:f00e::/48, 2605:340:f011::/48, 2605:340:f013::/48, … (additional 2605:340:f0xx::/48 also listed) [4]

Sources: Hurricane Electric BGP Toolkit prefix listings + IPinfo ASN org mapping. [1][2][3][4]


Add IPv6 ranges and verify against current BGP announcements for AS138699.

As of January 29, 2026, ByteDance/TikTok (AS138699) is announcing 5 IPv6 prefixes that are not included in this list:

  • 2404:9dc0:cd01::/48
  • 2404:9dc0:cd03::/48
  • 2404:9dc0:cd05::/48
  • 2404:9dc0:cd06::/48
  • 2404:9dc0:cd07::/48

Additionally, the IPv4 ranges in this block appear to be sourced from a historical snapshot; current BGP announcements from AS138699 show only 19 active prefixes, not the 200+ listed here. Consider whether this list intentionally maintains broader coverage (possibly for incoming traffic or legacy infrastructure), or if it should be updated to current announced ranges. Document the source date and scope (IPv4-only vs. IPv6 inclusion) in a comment for future maintenance.

🤖 Prompt for AI Agents
In `@apps/web/lib/middleware/utils/bots-list.ts` around lines 400 - 604, The
TikTok / Bytedance IP ranges block currently includes only IPv4 and appears to
be a historical snapshot; update the TikTok / Bytedance IP ranges array in
apps/web/lib/middleware/utils/bots-list.ts by adding the five IPv6 prefixes
(2404:9dc0:cd01::/48, 2404:9dc0:cd03::/48, 2404:9dc0:cd05::/48,
2404:9dc0:cd06::/48, 2404:9dc0:cd07::/48) and add a clear comment above the
block (referencing AS138699) that documents the source, source date (e.g.,
2026-01-29), and whether the list is "historical/full" or "current BGP-announced
only"; if you choose to trim IPv4 to current announcements, replace the large
IPv4 list with the 19 active prefixes obtained from a BGP lookup of AS138699 and
note that choice in the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant