:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(flags): close bot ip gaps (#60121)
Matheus Batistacf609ef69aab
diff --git a/rust/feature-flags/scripts/refresh_bot_ips.sh b/rust/feature-flags/scripts/refresh_bot_ips.shnew file mode 100755index 000000000000..4b719b90455b--- /dev/null+++ b/rust/feature-flags/scripts/refresh_bot_ips.sh@@ -0,0 +1,255 @@+#!/usr/bin/env bash+#+# refresh_bot_ips.sh — refresh the bot IP JSONs embedded in the feature-flags+# binary.+#+# WHY THIS SCRIPT EXISTS+# `rust/feature-flags/src/utils/bot_detection.rs` embeds three provider JSONs+# at compile time via `include_str!`. The list of bot IP ranges shifts as+# providers add or remove crawler hosts. Run this script periodically — or+# in response to a missed-bot incident — to pull the latest published list+# and refresh the embedded copies. It also serves as the operator-runnable+# counterpart to the (manual) Yandex update flow.+#+# WHAT IT DOES+# 1. Fetches the three machine-readable provider JSONs into a single staging+# tempdir:+# - Googlebot developers.google.com/search/apis/ipranges/googlebot.json+# - Bingbot www.bing.com/toolbox/bingbot.json+# - Applebot search.developer.apple.com/applebot.json+# Each fetch is validated with `jq empty`. If any fetch or validation+# fails, NOTHING in `src/utils/bot_ips/` is modified.+# 2. Backs up the current JSONs to a second tempdir, then atomically moves+# all three staged JSONs into `src/utils/bot_ips/`.+# 3. Runs `cargo test -p feature-flags utils::bot_detection`. The test suite+# includes coverage (every published CIDR classifies), schema (each JSON+# parses; entries have exactly one of ipv4Prefix/ipv6Prefix), and+# width-floor (per-provider + global) tests. If tests fail, the script+# restores the previous JSONs from backup so the working tree is left+# exactly as it was.+# 4. Prints `git diff --stat` for `bot_ips/` so the operator can see what+# changed, plus a Yandex reminder block. Yandex's IP list page+# (https://yandex.com/ips/) is behind a SmartCaptcha and not machine+# fetchable, so the script cannot refresh it. It dumps the current+# `YANDEX_FALLBACK_CIDRS` const from `bot_detection.rs` and asks the+# operator to compare against the browser-rendered yandex.com/ips/ page+# and edit the const inline if it has drifted.+#+# USAGE+# From the posthog repo (or anywhere — the script resolves its own path):+# ./rust/feature-flags/scripts/refresh_bot_ips.sh+#+# Optional flags:+# --skip-tests Skip the cargo test step (useful for CI or when you+# just want the JSON diff and intend to test separately).+# With this flag, the stage-then-commit step still runs;+# only the test gate is skipped.+# --no-color Disable ANSI colors in output+#+# PREREQUISITES+# - bash, curl, jq, git, cargo on PATH+# - Network reachability to the three provider hosts+#+# EXIT STATUS+# 0 all three fetches succeeded, JSONs are valid, cargo test passed+# (or was skipped); working tree contains the refreshed JSONs.+# 1 one or more fetches failed (network, 4xx, malformed JSON); working+# tree is UNCHANGED.+# 2 `cargo test` failed after the refresh was staged; the previous JSONs+# have been RESTORED from backup so the working tree is unchanged.+# Inspect the printed test output for the failure mode.+#+# AFTER A SUCCESSFUL RUN+# - Review `git diff rust/feature-flags/src/utils/bot_ips/` and the+# emitted Yandex reminder.+# - If a category of bot IP has shifted significantly (Google adds a new+# /16 range, Apple gains an entire new octet, etc.), eyeball whether+# the new entries match the provider's category in+# bot_detection.rs's PROVIDERS table — the category mapping is per+# provider, not per entry, so a single misrouted upstream entry would+# mis-label the metric.+# - `git add` + commit. There is no other documentation to keep in sync —+# this script's header is the single source of truth on refresh.+#+set -euo pipefail++# --- argument parsing ---------------------------------------------------------+SKIP_TESTS=0+USE_COLOR=1+for arg in "$@"; do+ case "$arg" in+ --skip-tests) SKIP_TESTS=1 ;;+ --no-color) USE_COLOR=0 ;;+ -h|--help)+ sed -n '1,/^set -euo/p' "$0" | sed '$d'+ exit 0+ ;;+ *) echo "unknown argument: $arg" >&2; exit 64 ;;+ esac+done++if [[ "$USE_COLOR" -eq 1 ]] && [[ -t 1 ]]; then+ BOLD='\033[1m'; GREEN='\033[32m'; YELLOW='\033[33m'; RED='\033[31m'; RESET='\033[0m'+else+ BOLD=''; GREEN=''; YELLOW=''; RED=''; RESET=''+fi++# --- locate ourselves ---------------------------------------------------------+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"+FF_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"+JSON_DIR="$FF_DIR/src/utils/bot_ips"+BOT_DETECTION_RS="$FF_DIR/src/utils/bot_detection.rs"++if [[ ! -d "$JSON_DIR" ]]; then+ echo -e "${RED}error:${RESET} expected $JSON_DIR to exist; run from a checkout of posthog" >&2+ exit 1+fi+if [[ ! -f "$BOT_DETECTION_RS" ]]; then+ echo -e "${RED}error:${RESET} expected $BOT_DETECTION_RS to exist" >&2+ exit 1+fi++# --- temp dirs + cleanup ------------------------------------------------------+STAGE_DIR="$(mktemp -d)"+BACKUP_DIR="$(mktemp -d)"+# Single trap cleans both temp dirs on any exit path. Set early so even+# pre-fetch failures (e.g. missing curl/jq) don't leak.+trap 'rm -rf "$STAGE_DIR" "$BACKUP_DIR"' EXIT++# --- providers + fetch helper -------------------------------------------------+PROVIDERS=(+ "googlebot|https://developers.google.com/search/apis/ipranges/googlebot.json"+ "bingbot|https://www.bing.com/toolbox/bingbot.json"+ "applebot|https://search.developer.apple.com/applebot.json"+)++# Strip CRLF line endings if present and ensure exactly one trailing newline.+# Microsoft serves bingbot.json with CRLF line endings; without this normalization+# the file would round-trip through git as a perpetual CRLF→LF diff churn.+# Apple's file ships with one trailing newline, Google's with none; the trim ++# re-append step gives all three vendored copies a byte-identical tail shape.+normalize_line_endings() {+ local file="$1"+ [[ -s "$file" ]] || return 0+ local normalized+ normalized="$(mktemp)"+ # `$(...)` captures the CR-stripped content and bash strips any trailing+ # newlines from a command-substitution. `printf '%s\n'` then puts exactly+ # one back. Files here top out at ~25KB so loading into memory is fine.+ local content+ content="$(tr -d '\r' < "$file")"+ printf '%s\n' "$content" > "$normalized"+ mv "$normalized" "$file"+}++# Fetch one provider into $STAGE_DIR/<name>.json. Validates with `jq empty`.+# Returns nonzero on any failure; nothing in $JSON_DIR is touched.+fetch_to_stage() {+ local name="$1"+ local url="$2"+ local staged="$STAGE_DIR/${name}.json"++ echo -e "${BOLD}↳${RESET} fetching $name from $url"+ if ! curl -fsSL --max-time 30 "$url" -o "$staged"; then+ echo -e " ${RED}fetch failed${RESET}" >&2+ return 1+ fi+ if ! jq empty "$staged" 2>/dev/null; then+ echo -e " ${RED}invalid JSON${RESET}" >&2+ return 1+ fi+ normalize_line_endings "$staged"+ local count+ count="$(jq '.prefixes | length' "$staged")"+ echo -e " ${GREEN}ok${RESET} → staged ($count prefixes)"+}++# --- stage all three fetches --------------------------------------------------+echo -e "${BOLD}Staging bot IP JSON refresh in${RESET} $STAGE_DIR"+fail=0+for entry in "${PROVIDERS[@]}"; do+ name="${entry%%|*}"+ url="${entry##*|}"+ fetch_to_stage "$name" "$url" || fail=1+done+if [[ "$fail" -ne 0 ]]; then+ echo -e "${RED}one or more provider fetches failed; nothing on disk changed${RESET}" >&2+ exit 1+fi++# --- backup current JSONs + atomic commit -------------------------------------+# Backup must happen before we move staged files into place so we can restore+# on cargo test failure. `cp -p` preserves mtime so a restore is bit-identical.+for entry in "${PROVIDERS[@]}"; do+ name="${entry%%|*}"+ src="$JSON_DIR/${name}.json"+ if [[ -f "$src" ]]; then+ cp -p "$src" "$BACKUP_DIR/${name}.json"+ fi+done++for entry in "${PROVIDERS[@]}"; do+ name="${entry%%|*}"+ mv "$STAGE_DIR/${name}.json" "$JSON_DIR/${name}.json"+done++# --- show diff ----------------------------------------------------------------+echo+echo -e "${BOLD}Diff vs working tree:${RESET}"+if git -C "$FF_DIR" diff --stat -- "$JSON_DIR" 2>/dev/null | grep -q .; then+ git -C "$FF_DIR" diff --stat -- "$JSON_DIR"+else+ echo " (no changes)"+fi++# --- Yandex reminder ----------------------------------------------------------+echo+echo -e "${YELLOW}${BOLD}Yandex — manual step${RESET}"+echo -e "${YELLOW}yandex.com/ips/ is behind SmartCaptcha; this script cannot refresh it.${RESET}"+echo -e "${YELLOW}Open https://yandex.com/ips/ in a browser, compare against the current${RESET}"+echo -e "${YELLOW}YANDEX_FALLBACK_CIDRS in bot_detection.rs, and edit the const inline${RESET}"+echo -e "${YELLOW}(plus its 'Last reviewed' date) if the list has drifted.${RESET}"+echo+echo "Current YANDEX_FALLBACK_CIDRS:"+# Print the const body (between the opening and closing brackets) so the+# operator can eyeball it without context-switching to the source file.+# Anchor on `^const ` so a later expression-context reference to+# YANDEX_FALLBACK_CIDRS doesn't reopen the block, and `exit` after the+# first `];` to keep the output tight.+awk '+ /^const YANDEX_FALLBACK_CIDRS/ { in_block = 1 }+ in_block { print " " $0 }+ in_block && /^];/ { exit }+' "$BOT_DETECTION_RS"++# --- gate on cargo test -------------------------------------------------------+if [[ "$SKIP_TESTS" -eq 1 ]]; then+ echo+ echo -e "${YELLOW}--skip-tests set; skipping cargo test${RESET}"+ echo -e "${GREEN}done.${RESET} Inspect the diff above and decide whether to commit."+ exit 0+fi++echo+echo -e "${BOLD}Running cargo test -p feature-flags utils::bot_detection ...${RESET}"+if ! (cd "$FF_DIR/.." && cargo test -p feature-flags utils::bot_detection --quiet); then+ echo+ echo -e "${RED}cargo test failed.${RESET} Restoring previous JSONs from backup."+ for entry in "${PROVIDERS[@]}"; do+ name="${entry%%|*}"+ backup="$BACKUP_DIR/${name}.json"+ if [[ -f "$backup" ]]; then+ cp -p "$backup" "$JSON_DIR/${name}.json"+ fi+ done+ echo "Working tree restored to its pre-script state. Inspect the test output above."+ echo "Common causes:"+ echo " - Upstream published a CIDR wider than a per-provider floor in"+ echo " bot_detection.rs PROVIDERS (Apple /24, Bingbot /22, Google /23 v4 / /64 v6)."+ echo " Widening the floor is a deliberate policy decision."+ echo " - Upstream changed JSON shape (entry missing both ipv4Prefix and ipv6Prefix)."+ exit 2+fi++echo+echo -e "${GREEN}done.${RESET} JSONs refreshed, tests green. Review the diff and commit."diff --git a/rust/feature-flags/src/api/endpoint.rs b/rust/feature-flags/src/api/endpoint.rsindex 330b5ccd69eb..8217f2fc21d6 100644--- a/rust/feature-flags/src/api/endpoint.rs+++ b/rust/feature-flags/src/api/endpoint.rs@@ -944,7 +944,10 @@ mod tests {const GOOGLEBOT_UA: &str ="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";- const GOOGLEBOT_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(66, 249, 79, 123));+ // Interior of `66.249.66.0/27` — a densely-covered Googlebot /24 in+ // the published JSON. The classifier is JSON-precise so unpublished+ // /27 gaps (e.g. `.79.96/27`) no longer match.+ const GOOGLEBOT_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(66, 249, 66, 0));const BENIGN_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(8, 8, 8, 8));const BENIGN_UA: &str = "Mozilla/5.0 (Macintosh; Intel Mac OS X) Chrome/120 Safari/537.36";diff --git a/rust/feature-flags/src/utils/bot_detection.rs b/rust/feature-flags/src/utils/bot_detection.rsindex 887fb2f8b965..2d2934cb39c0 100644--- a/rust/feature-flags/src/utils/bot_detection.rs+++ b/rust/feature-flags/src/utils/bot_detection.rs@@ -177,32 +177,136 @@ pub fn classify(user_agent: &str) -> Option<BotCategory> {.map(|idx| BOT_PATTERNS[idx].1)}-/// Published bot IP ranges. Refresh from the provider source-of-truth files:-/// Googlebot: https://developers.google.com/search/apis/ipranges/googlebot.json-/// Bingbot: https://www.bing.com/toolbox/bingbot.json-/// YandexBot: https://yandex.com/ips/-/// Applebot: https://search.developer.apple.com/applebot.json+/// Yandex IP ranges. `yandex.com/ips/` is behind SmartCaptcha and not+/// machine-fetchable, so this list is maintained by hand. Refresh by opening+/// the page in a browser and comparing against the entries below.///-/// Prefer supernets over the dozens of /27s each provider publishes — every-/// CIDR here costs one `Vec` entry + a binary-search comparison.-const BOT_CIDRS: &[(&str, BotCategory)] = &[- // Googlebot- ("66.249.64.0/19", BotCategory::Google),- ("2001:4860:4801::/48", BotCategory::Google),- // Bingbot- ("40.77.139.0/25", BotCategory::Crawler),- ("207.46.13.0/24", BotCategory::Crawler),- ("157.55.39.0/24", BotCategory::Crawler),- // YandexBot+/// Last reviewed: 2026-05-26.+const YANDEX_FALLBACK_CIDRS: &[(&str, BotCategory)] = &[("5.45.207.0/24", BotCategory::Crawler),("5.255.250.0/24", BotCategory::Crawler),("87.250.224.0/19", BotCategory::Crawler),("95.108.128.0/17", BotCategory::Crawler),("213.180.192.0/19", BotCategory::Crawler),- // Applebot- ("17.241.75.0/26", BotCategory::Other),];+/// Machine-fetchable provider lists, embedded at compile time. Refresh via+/// `rust/feature-flags/scripts/refresh_bot_ips.sh`. The whole provider list+/// maps to a single [`BotCategory`] — the category is a metric label, not+/// per-IP metadata.+///+/// `min_v4_prefix` / `min_v6_prefix` tighten the global [`MIN_V4_PREFIX`] /+/// [`MIN_V6_PREFIX`] floors to each provider's realistic ceiling — the widest+/// prefix it currently publishes per family. An upstream refresh that widens+/// past this floor fails the test suite (and server start) before it can ship;+/// bump the floor deliberately once the wider range is confirmed genuine.+struct Provider {+ name: &'static str,+ blob: &'static str,+ category: BotCategory,+ min_v4_prefix: u32,+ min_v6_prefix: u32,+}++const PROVIDERS: &[Provider] = &[+ // Googlebot: widest currently published `/27` v4, `/64` v6.+ Provider {+ name: "googlebot",+ blob: include_str!("bot_ips/googlebot.json"),+ category: BotCategory::Google,+ min_v4_prefix: 27,+ min_v6_prefix: 64,+ },+ // Bingbot: widest currently published `/22`.+ Provider {+ name: "bingbot",+ blob: include_str!("bot_ips/bingbot.json"),+ category: BotCategory::Crawler,+ min_v4_prefix: 22,+ min_v6_prefix: 64,+ },+ // Applebot: widest currently published `/24`.+ Provider {+ name: "applebot",+ blob: include_str!("bot_ips/applebot.json"),+ category: BotCategory::Other,+ min_v4_prefix: 24,+ min_v6_prefix: 64,+ },+];++/// Schema of every provider JSON: `{"prefixes": [{"ipv4Prefix"|"ipv6Prefix": "..."}, ...]}`.+/// Both `ipv4_prefix` and `ipv6_prefix` are `Option` because each entry has+/// exactly one — Google mixes both kinds in a single array, the others are+/// v4-only.+#[derive(serde::Deserialize)]+struct BotIpManifest {+ prefixes: Vec<BotIpEntry>,+}++#[derive(serde::Deserialize)]+struct BotIpEntry {+ #[serde(rename = "ipv4Prefix")]+ ipv4_prefix: Option<String>,+ #[serde(rename = "ipv6Prefix")]+ ipv6_prefix: Option<String>,+}++/// Flatten the three provider JSONs plus the inline Yandex list into a single+/// `(cidr, category)` vector consumed by [`build_ranges`]. Runs once at+/// `LazyLock` initialization (warmed at server start via [`warm_caches`]).+///+/// Panics on malformed embedded JSON, an entry that has both or neither of+/// `ipv4Prefix` / `ipv6Prefix`, or an entry that exceeds the provider's own+/// width floor (see [`Provider::min_v4_prefix`] / `min_v6_prefix`). The+/// per-provider floor catches upstream drift earlier than the global floor+/// in [`build_ranges`] would; both checks run as defense-in-depth.+fn load_published_cidrs() -> Vec<(String, BotCategory)> {+ let mut out = Vec::new();+ for provider in PROVIDERS {+ let manifest: BotIpManifest = serde_json::from_str(provider.blob)+ .unwrap_or_else(|e| panic!("malformed bot IP JSON for {}: {e}", provider.name));+ for (idx, entry) in manifest.prefixes.into_iter().enumerate() {+ let cidr = match (entry.ipv4_prefix, entry.ipv6_prefix) {+ (Some(v4), None) => v4,+ (None, Some(v6)) => v6,+ _ => panic!(+ "bot IP JSON {} entry {idx} must have exactly one of \+ ipv4Prefix / ipv6Prefix",+ provider.name,+ ),+ };+ enforce_provider_floor(provider, &cidr);+ out.push((cidr, provider.category));+ }+ }+ for (cidr, category) in YANDEX_FALLBACK_CIDRS {+ out.push(((*cidr).to_string(), *category));+ }+ out+}++/// Per-provider width-floor check. Fails fast if an upstream refresh+/// publishes a CIDR wider than the provider's documented ceiling — caught+/// at `LazyLock` init / server start, not silently shipped.+fn enforce_provider_floor(provider: &Provider, cidr: &str) {+ let parsed = parse_cidr(cidr)+ .unwrap_or_else(|| panic!("invalid CIDR from provider {}: {cidr}", provider.name));+ let host_bits = (parsed.end - parsed.start + 1).trailing_zeros();+ let (max_host_bits, floor_prefix) = if parsed.is_v4 {+ (32 - provider.min_v4_prefix, provider.min_v4_prefix)+ } else {+ (128 - provider.min_v6_prefix, provider.min_v6_prefix)+ };+ assert!(+ host_bits <= max_host_bits,+ "provider {} CIDR {cidr} is broader than its per-provider floor (/{}); \+ widen the floor deliberately if upstream genuinely publishes this",+ provider.name,+ floor_prefix,+ );+}+/// Half-open is tempting but inclusive `[start, end]` is what fits CIDR/// semantics and lets v4 share the lookup with v6 by widening to `u128`.#[derive(Debug, Clone, Copy)]@@ -219,22 +323,24 @@ struct BotIpRanges {v6: Box<[IpRange]>,}-static BOT_IP_RANGES: LazyLock<BotIpRanges> = LazyLock::new(|| build_ranges(BOT_CIDRS));+static BOT_IP_RANGES: LazyLock<BotIpRanges> =+ LazyLock::new(|| build_ranges(&load_published_cidrs()));-/// Minimum CIDR prefix in `BOT_CIDRS` — bounds how many addresses a-/// single entry classifies as bots. Enforced by `build_ranges`, surfaced-/// at server start via `warm_caches()`.+/// Minimum CIDR prefix accepted from any provider list — bounds how many+/// addresses a single entry classifies as bots. Enforced by `build_ranges`,+/// surfaced at server start via `warm_caches()`.///-/// Current widest entries: `/17` (Yandex v4), `/48` (Googlebot v6).+/// Current widest entries: `/17` (Yandex v4), `/64` (Googlebot v6 — JSON+/// publishes per-/64 ranges, not a supernet).const MIN_V4_PREFIX: u32 = 16;const MIN_V6_PREFIX: u32 = 32;-fn build_ranges(cidrs: &[(&str, BotCategory)]) -> BotIpRanges {+fn build_ranges(cidrs: &[(String, BotCategory)]) -> BotIpRanges {let mut v4 = Vec::new();let mut v6 = Vec::new();for (cidr, category) in cidrs {let parsed =- parse_cidr(cidr).unwrap_or_else(|| panic!("invalid CIDR in BOT_CIDRS: {cidr}"));+ parse_cidr(cidr).unwrap_or_else(|| panic!("invalid CIDR from provider list: {cidr}"));// `2^host_bits = end - start + 1` for an inclusive [start, end].let host_bits = (parsed.end - parsed.start + 1).trailing_zeros();let max_host_bits = if parsed.is_v4 {@@ -244,7 +350,7 @@ fn build_ranges(cidrs: &[(&str, BotCategory)]) -> BotIpRanges {};assert!(host_bits <= max_host_bits,- "BOT_CIDRS entry {cidr} is broader than the minimum prefix \+ "provider CIDR {cidr} is broader than the minimum prefix \(/{} v4, /{} v6); refusing to classify that many addresses as bots",MIN_V4_PREFIX,MIN_V6_PREFIX,@@ -540,28 +646,78 @@ mod tests {use std::net::Ipv4Addr;#[rstest]- // Googlebot IPv4 range 66.249.64.0/19 (66.249.64.0 — 66.249.95.255).- #[case("66.249.64.0", BotCategory::Google)]- #[case("66.249.79.123", BotCategory::Google)]- #[case("66.249.95.255", BotCategory::Google)]+ // Googlebot: published /27s inside the historical 66.249.x.x block.+ // Pick from 66.249.66.x because that /24 is densely covered (every+ // /27 in .0–.224); any single-/27 drift in a refresh still leaves+ // these representative samples passing.+ #[case("66.249.66.0", BotCategory::Google)]+ #[case("66.249.66.31", BotCategory::Google)]+ // Googlebot: GCP-hosted /28 (192.178.x and 34.x publish-time ranges).+ #[case("192.178.4.0", BotCategory::Google)]+ #[case("34.100.182.96", BotCategory::Google)]// Bingbot.#[case("207.46.13.42", BotCategory::Crawler)]#[case("40.77.139.5", BotCategory::Crawler)]// YandexBot.#[case("95.108.200.10", BotCategory::Crawler)]+ // Applebot — regression for the IP customer saw (17.246.19.0/24 was+ // published but not blocked because the const carried only+ // 17.241.75.0/26). Cover every Apple second-octet block.+ #[case("17.22.237.0", BotCategory::Other)]+ #[case("17.241.75.0", BotCategory::Other)]+ #[case("17.241.75.255", BotCategory::Other)]+ #[case("17.246.19.0", BotCategory::Other)]+ #[case("17.246.19.255", BotCategory::Other)]+ #[case("17.246.23.128", BotCategory::Other)]fn classify_ip_matches_known_bot_ranges(#[case] ip: &str, #[case] expected: BotCategory) {let parsed: IpAddr = ip.parse().unwrap();assert_eq!(classify_ip(parsed), Some(expected));}#[rstest]- // Just outside Googlebot's /19 on either side.+ // Googlebot — just outside the historical 66.249.64.0/27 → 79.224/27+ // span on either side.#[case("66.249.63.255")]- #[case("66.249.96.0")]- // Common public DNS / CDN ranges that aren't on the bot list.+ #[case("66.249.80.0")]+ // Googlebot — first IP below the lowest 192.178.x /27 and the first+ // unpublished /27 inside 192.178.5.0/24 (only .5.0/27 is in the JSON).+ #[case("192.178.3.255")]+ #[case("192.178.5.32")]+ // Googlebot GCP-hosted /28 boundaries (34.100.182.96/28 → .96–.111).+ #[case("34.100.182.95")]+ #[case("34.100.182.112")]+ // Bingbot — one above 40.77.139.0/25 (which ends at .127), one below+ // 207.46.13.0/24, and one above its end.+ #[case("40.77.139.128")]+ #[case("207.46.12.255")]+ #[case("207.46.14.0")]+ // YandexBot — adjacent to the /24 and the /19 boundaries.+ #[case("5.45.206.255")]+ #[case("5.45.208.0")]+ #[case("87.250.223.255")]+ #[case("87.251.0.0")]+ // Applebot — adjacent to the IP that triggered this fix+ // (17.246.19.0/24) plus surrounding-block boundaries.+ #[case("17.246.18.255")]+ #[case("17.246.20.0")]+ #[case("17.246.16.0")] // gap between 17.246.15.0/24 and .19.0/24+ #[case("17.241.74.255")]+ #[case("17.241.76.0")]+ #[case("17.22.236.255")]+ #[case("17.22.238.0")]+ // Apple-owned /8 but far from any published Applebot block —+ // these were never bot ranges and never should be.+ #[case("17.0.0.1")]+ #[case("17.142.0.1")]+ #[case("17.248.1.1")]+ // Common public DNS / CDN ranges that aren't on any bot list.#[case("8.8.8.8")]#[case("1.1.1.1")]#[case("104.16.0.1")]+ // Documented test-net ranges (RFC 5737) — guaranteed non-bot.+ #[case("192.0.2.1")]+ #[case("198.51.100.1")]+ #[case("203.0.113.1")]// Private RFC1918.#[case("10.0.0.1")]#[case("192.168.1.1")]@@ -572,18 +728,37 @@ mod tests {assert_eq!(classify_ip(parsed), None);}- #[test]- fn googlebot_ipv6_range_matches() {- // 2001:4860:4801::/48 is a Googlebot IPv6 supernet.- let ip: IpAddr = "2001:4860:4801:42::1".parse().unwrap();- assert_eq!(classify_ip(ip), Some(BotCategory::Google));+ #[rstest]+ // Each of these is a published Googlebot /64 in googlebot.json —+ // lowest, mid, and the highest currently published (`:b6::/64`).+ #[case("2001:4860:4801:2::1")]+ #[case("2001:4860:4801:42::1")]+ #[case("2001:4860:4801:b6::ffff")]+ fn googlebot_ipv6_published_64s_match(#[case] ip: &str) {+ let parsed: IpAddr = ip.parse().unwrap();+ assert_eq!(classify_ip(parsed), Some(BotCategory::Google));+ }++ #[rstest]+ // Gaps inside Google's 2001:4860:4801::/48 that are NOT published as+ // /64s. The classifier is JSON-precise (no /48 supernet), so these+ // must NOT match — they may be used by non-bot Google services and+ // would be a false positive.+ #[case("2001:4860:4801::1")] // :0::/64 (unpublished)+ #[case("2001:4860:4801:43::1")] // gap between :42::/64 and :44::/64+ #[case("2001:4860:4801:b7::1")] // one above the highest :b6::/64+ #[case("2001:4860:4801:ff::1")] // far above any published /64+ #[case("2001:4860:4802::1")] // outside the historical /48 entirely+ fn googlebot_ipv6_unpublished_blocks_are_not_bots(#[case] ip: &str) {+ let parsed: IpAddr = ip.parse().unwrap();+ assert_eq!(classify_ip(parsed), None);}#[test]fn ipv4_mapped_ipv6_normalizes_to_ipv4_match() {- // `::ffff:66.249.79.123` represents Googlebot via IPv4-mapped form;+ // `::ffff:66.249.66.0` represents Googlebot via IPv4-mapped form;// upstream proxies sometimes hand us this shape.- let mapped = Ipv4Addr::new(66, 249, 79, 123).to_ipv6_mapped();+ let mapped = Ipv4Addr::new(66, 249, 66, 0).to_ipv6_mapped();assert_eq!(classify_ip(IpAddr::V6(mapped)), Some(BotCategory::Google));}@@ -658,15 +833,101 @@ mod tests {fn every_published_cidr_parses() {// build_ranges panics on a bad CIDR; touching LazyLock would// have already done this, but be explicit for future drift.- for (cidr, _) in BOT_CIDRS {- assert!(parse_cidr(cidr).is_some(), "failed to parse {cidr}");+ for (cidr, _) in load_published_cidrs() {+ assert!(parse_cidr(&cidr).is_some(), "failed to parse {cidr}");}}+ /// Coverage test — every CIDR in every provider JSON (plus the inline+ /// Yandex fallback) MUST classify as the expected category for both the+ /// network address and the last address in the range. This is the test+ /// that would have caught the original Applebot regression: as long as+ /// `17.246.19.0/24` is in `applebot.json`, classifying `17.246.19.0`+ /// (and `17.246.19.255`) returns `Some(BotCategory::Other)`.+ ///+ /// Failure mode tells the operator either upstream changed shape or the+ /// `PROVIDERS` category mapping is out of sync.#[test]- fn published_cidrs_respect_width_floor() {- for (cidr, _) in BOT_CIDRS {- let parsed = parse_cidr(cidr).expect("BOT_CIDRS entry parses");+ fn every_published_cidr_is_classified() {+ for (cidr, expected) in load_published_cidrs() {+ let parsed = parse_cidr(&cidr).expect("provider CIDR parses");+ let net = if parsed.is_v4 {+ IpAddr::V4(Ipv4Addr::from(parsed.start as u32))+ } else {+ IpAddr::V6(std::net::Ipv6Addr::from(parsed.start))+ };+ let last = if parsed.is_v4 {+ IpAddr::V4(Ipv4Addr::from(parsed.end as u32))+ } else {+ IpAddr::V6(std::net::Ipv6Addr::from(parsed.end))+ };+ assert_eq!(+ classify_ip(net),+ Some(expected),+ "{cidr}: network address {net} did not classify as {expected:?}",+ );+ assert_eq!(+ classify_ip(last),+ Some(expected),+ "{cidr}: last address {last} did not classify as {expected:?}",+ );+ }+ }++ /// Schema test — every embedded provider JSON deserializes and every+ /// entry has exactly one of `ipv4Prefix` / `ipv6Prefix`. Guards against+ /// an upstream format change silently producing a smaller, partially+ /// loaded list (the load path would skip entries with both keys absent+ /// without this guard).+ #[test]+ fn each_provider_json_is_well_formed() {+ for provider in PROVIDERS {+ let manifest: BotIpManifest = serde_json::from_str(provider.blob)+ .unwrap_or_else(|e| panic!("{} JSON failed to parse: {e}", provider.name));+ assert!(+ !manifest.prefixes.is_empty(),+ "{} JSON has no prefixes — likely an upstream outage \+ or shape change",+ provider.name,+ );+ for (idx, entry) in manifest.prefixes.iter().enumerate() {+ assert!(+ entry.ipv4_prefix.is_some() ^ entry.ipv6_prefix.is_some(),+ "{} entry {idx} must have exactly one of \+ ipv4Prefix / ipv6Prefix",+ provider.name,+ );+ }+ }+ }++ /// Per-provider floor: each provider's published CIDRs must fit+ /// within its own declared min-prefix. Exercises the real+ /// [`enforce_provider_floor`] (rather than re-deriving its arithmetic)+ /// so a bug in that check is caught here, not just at `LazyLock` init.+ #[test]+ fn each_provider_respects_its_own_width_floor() {+ for provider in PROVIDERS {+ let manifest: BotIpManifest =+ serde_json::from_str(provider.blob).expect("provider JSON parses");+ for entry in manifest.prefixes {+ let cidr = entry+ .ipv4_prefix+ .or(entry.ipv6_prefix)+ .expect("entry has exactly one prefix");+ // Panics (failing the test) if the entry is wider than the+ // provider's declared floor.+ enforce_provider_floor(provider, &cidr);+ }+ }+ }++ /// Yandex stays on the global floor (its widest entry is `/17`,+ /// inside the `/16` ceiling).+ #[test]+ fn yandex_respects_global_width_floor() {+ for (cidr, _) in YANDEX_FALLBACK_CIDRS {+ let parsed = parse_cidr(cidr).expect("yandex CIDR parses");let host_bits = (parsed.end - parsed.start + 1).trailing_zeros();let max_host_bits = if parsed.is_v4 {32 - MIN_V4_PREFIX@@ -675,7 +936,7 @@ mod tests {};assert!(host_bits <= max_host_bits,- "{cidr} exceeds the BOT_CIDRS width floor",+ "{cidr} exceeds the global width floor",);}}@@ -683,13 +944,33 @@ mod tests {#[test]#[should_panic(expected = "broader than the minimum prefix")]fn build_ranges_rejects_overly_broad_v4_cidr() {- drop(build_ranges(&[("66.0.0.0/8", BotCategory::Google)]));+ drop(build_ranges(&[(+ "66.0.0.0/8".to_string(),+ BotCategory::Google,+ )]));}#[test]#[should_panic(expected = "broader than the minimum prefix")]fn build_ranges_rejects_overly_broad_v6_cidr() {- drop(build_ranges(&[("2001::/16", BotCategory::Google)]));+ drop(build_ranges(&[(+ "2001::/16".to_string(),+ BotCategory::Google,+ )]));+ }++ /// Per-provider floor panics with a provider-specific message before+ /// the global floor would have. Construct a synthetic Applebot entry+ /// at `/16` (within the global `/16` floor but well past Applebot's+ /// own `/24` floor) and assert the per-provider check fires.+ #[test]+ #[should_panic(expected = "broader than its per-provider floor")]+ fn enforce_provider_floor_rejects_over_widening() {+ let applebot = PROVIDERS+ .iter()+ .find(|p| p.name == "applebot")+ .expect("applebot provider present");+ enforce_provider_floor(applebot, "17.0.0.0/16");}}@@ -697,7 +978,7 @@ mod tests {use super::*;use std::net::Ipv4Addr;- const GOOGLEBOT_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(66, 249, 79, 123));+ const GOOGLEBOT_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(66, 249, 66, 0));const NON_BOT_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(8, 8, 8, 8));#[test]diff --git a/rust/feature-flags/src/utils/bot_ips/applebot.json b/rust/feature-flags/src/utils/bot_ips/applebot.jsonnew file mode 100644index 000000000000..6a98b47a0732--- /dev/null+++ b/rust/feature-flags/src/utils/bot_ips/applebot.json@@ -0,0 +1,41 @@+{+ "creationTime": "2023-10-27T10:00:00.000000",+ "prefixes": [+ {+ "ipv4Prefix": "17.241.208.160/27"+ },+ {+ "ipv4Prefix": "17.241.193.160/27"+ },+ {+ "ipv4Prefix": "17.241.200.160/27"+ },+ {+ "ipv4Prefix": "17.22.237.0/24"+ },+ {+ "ipv4Prefix": "17.22.245.0/24"+ },+ {+ "ipv4Prefix": "17.22.253.0/24"+ },+ {+ "ipv4Prefix": "17.241.75.0/24"+ },+ {+ "ipv4Prefix": "17.241.219.0/24"+ },+ {+ "ipv4Prefix": "17.241.227.0/24"+ },+ {+ "ipv4Prefix": "17.246.15.0/24"+ },+ {+ "ipv4Prefix": "17.246.19.0/24"+ },+ {+ "ipv4Prefix": "17.246.23.0/24"+ }+ ]+}diff --git a/rust/feature-flags/src/utils/bot_ips/bingbot.json b/rust/feature-flags/src/utils/bot_ips/bingbot.jsonnew file mode 100644index 000000000000..d480ed5a709e--- /dev/null+++ b/rust/feature-flags/src/utils/bot_ips/bingbot.json@@ -0,0 +1,89 @@+{+ "creationTime": "2024-01-03T10:00:00.121331",+ "prefixes": [+ {+ "ipv4Prefix": "157.55.39.0/24"+ },+ {+ "ipv4Prefix": "207.46.13.0/24"+ },+ {+ "ipv4Prefix": "40.77.167.0/24"+ },+ {+ "ipv4Prefix": "13.66.139.0/24"+ },+ {+ "ipv4Prefix": "13.66.144.0/24"+ },+ {+ "ipv4Prefix": "52.167.144.0/24"+ },+ {+ "ipv4Prefix": "13.67.10.16/28"+ },+ {+ "ipv4Prefix": "13.69.66.240/28"+ },+ {+ "ipv4Prefix": "13.71.172.224/28"+ },+ {+ "ipv4Prefix": "139.217.52.0/28"+ },+ {+ "ipv4Prefix": "191.233.204.224/28"+ },+ {+ "ipv4Prefix": "20.36.108.32/28"+ },+ {+ "ipv4Prefix": "20.43.120.16/28"+ },+ {+ "ipv4Prefix": "40.79.131.208/28"+ },+ {+ "ipv4Prefix": "40.79.186.176/28"+ },+ {+ "ipv4Prefix": "52.231.148.0/28"+ },+ {+ "ipv4Prefix": "20.79.107.240/28"+ },+ {+ "ipv4Prefix": "51.105.67.0/28"+ },+ {+ "ipv4Prefix": "20.125.163.80/28"+ },+ {+ "ipv4Prefix": "40.77.188.0/22"+ },+ {+ "ipv4Prefix": "65.55.210.0/24"+ },+ {+ "ipv4Prefix": "199.30.24.0/23"+ },+ {+ "ipv4Prefix": "40.77.202.0/24"+ },+ {+ "ipv4Prefix": "40.77.139.0/25"+ },+ {+ "ipv4Prefix": "20.74.197.0/28"+ },+ {+ "ipv4Prefix": "20.15.133.160/27"+ },+ {+ "ipv4Prefix": "40.77.177.0/24"+ },+ {+ "ipv4Prefix": "40.77.178.0/23"+ }+ ]+}diff --git a/rust/feature-flags/src/utils/bot_ips/googlebot.json b/rust/feature-flags/src/utils/bot_ips/googlebot.jsonnew file mode 100644index 000000000000..a544af7c1b78--- /dev/null+++ b/rust/feature-flags/src/utils/bot_ips/googlebot.json@@ -0,0 +1,938 @@+{+ "creationTime": "2026-05-26T14:45:50.000000",+ "prefixes": [+ {+ "ipv6Prefix": "2001:4860:4801:10::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:11::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:12::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:13::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:14::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:15::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:16::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:17::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:18::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:19::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:1a::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:1b::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:1c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:1d::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:1e::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:1f::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:20::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:21::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:22::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:23::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:24::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:25::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:26::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:27::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:28::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:29::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2a::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2b::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2d::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2e::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:2f::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:30::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:31::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:32::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:33::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:34::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:35::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:36::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:37::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:38::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:39::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:3a::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:3b::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:3c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:3d::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:3e::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:3f::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:40::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:41::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:42::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:44::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:45::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:46::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:47::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:48::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:49::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:4a::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:4b::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:4c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:4d::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:4e::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:50::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:51::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:52::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:53::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:54::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:55::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:56::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:57::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:58::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:59::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:60::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:61::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:62::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:63::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:64::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:65::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:66::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:67::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:68::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:69::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:6a::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:6b::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:6c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:6d::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:6e::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:6f::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:70::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:71::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:72::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:73::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:74::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:75::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:76::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:77::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:78::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:79::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:7a::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:7b::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:7c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:7d::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:80::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:81::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:82::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:83::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:84::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:85::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:86::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:87::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:88::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:90::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:91::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:92::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:93::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:94::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:95::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:96::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:97::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a0::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a1::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a2::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a3::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a4::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a5::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a6::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a7::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a8::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:a9::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:aa::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:ab::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:ac::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:ad::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:ae::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b0::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b1::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b2::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b3::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b4::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b5::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:b6::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:c::/64"+ },+ {+ "ipv6Prefix": "2001:4860:4801:f::/64"+ },+ {+ "ipv4Prefix": "192.178.4.0/27"+ },+ {+ "ipv4Prefix": "192.178.4.128/27"+ },+ {+ "ipv4Prefix": "192.178.4.160/27"+ },+ {+ "ipv4Prefix": "192.178.4.192/27"+ },+ {+ "ipv4Prefix": "192.178.4.224/27"+ },+ {+ "ipv4Prefix": "192.178.4.32/27"+ },+ {+ "ipv4Prefix": "192.178.4.64/27"+ },+ {+ "ipv4Prefix": "192.178.4.96/27"+ },+ {+ "ipv4Prefix": "192.178.5.0/27"+ },+ {+ "ipv4Prefix": "192.178.6.0/27"+ },+ {+ "ipv4Prefix": "192.178.6.128/27"+ },+ {+ "ipv4Prefix": "192.178.6.160/27"+ },+ {+ "ipv4Prefix": "192.178.6.192/27"+ },+ {+ "ipv4Prefix": "192.178.6.224/27"+ },+ {+ "ipv4Prefix": "192.178.6.32/27"+ },+ {+ "ipv4Prefix": "192.178.6.64/27"+ },+ {+ "ipv4Prefix": "192.178.6.96/27"+ },+ {+ "ipv4Prefix": "192.178.7.0/27"+ },+ {+ "ipv4Prefix": "192.178.7.128/27"+ },+ {+ "ipv4Prefix": "192.178.7.160/27"+ },+ {+ "ipv4Prefix": "192.178.7.192/27"+ },+ {+ "ipv4Prefix": "192.178.7.224/27"+ },+ {+ "ipv4Prefix": "192.178.7.32/27"+ },+ {+ "ipv4Prefix": "192.178.7.64/27"+ },+ {+ "ipv4Prefix": "192.178.7.96/27"+ },+ {+ "ipv4Prefix": "34.100.182.96/28"+ },+ {+ "ipv4Prefix": "34.101.50.144/28"+ },+ {+ "ipv4Prefix": "34.118.254.0/28"+ },+ {+ "ipv4Prefix": "34.118.66.0/28"+ },+ {+ "ipv4Prefix": "34.126.178.96/28"+ },+ {+ "ipv4Prefix": "34.146.150.144/28"+ },+ {+ "ipv4Prefix": "34.147.110.144/28"+ },+ {+ "ipv4Prefix": "34.151.74.144/28"+ },+ {+ "ipv4Prefix": "34.152.50.64/28"+ },+ {+ "ipv4Prefix": "34.154.114.144/28"+ },+ {+ "ipv4Prefix": "34.155.98.32/28"+ },+ {+ "ipv4Prefix": "34.165.18.176/28"+ },+ {+ "ipv4Prefix": "34.175.160.64/28"+ },+ {+ "ipv4Prefix": "34.176.130.16/28"+ },+ {+ "ipv4Prefix": "34.22.85.0/27"+ },+ {+ "ipv4Prefix": "34.64.82.64/28"+ },+ {+ "ipv4Prefix": "34.65.242.112/28"+ },+ {+ "ipv4Prefix": "34.80.50.80/28"+ },+ {+ "ipv4Prefix": "34.88.194.0/28"+ },+ {+ "ipv4Prefix": "34.89.10.80/28"+ },+ {+ "ipv4Prefix": "34.89.198.80/28"+ },+ {+ "ipv4Prefix": "34.96.162.48/28"+ },+ {+ "ipv4Prefix": "35.247.243.240/28"+ },+ {+ "ipv4Prefix": "66.249.64.0/27"+ },+ {+ "ipv4Prefix": "66.249.64.128/27"+ },+ {+ "ipv4Prefix": "66.249.64.160/27"+ },+ {+ "ipv4Prefix": "66.249.64.192/27"+ },+ {+ "ipv4Prefix": "66.249.64.224/27"+ },+ {+ "ipv4Prefix": "66.249.64.32/27"+ },+ {+ "ipv4Prefix": "66.249.64.64/27"+ },+ {+ "ipv4Prefix": "66.249.64.96/27"+ },+ {+ "ipv4Prefix": "66.249.65.0/27"+ },+ {+ "ipv4Prefix": "66.249.65.128/27"+ },+ {+ "ipv4Prefix": "66.249.65.160/27"+ },+ {+ "ipv4Prefix": "66.249.65.192/27"+ },+ {+ "ipv4Prefix": "66.249.65.224/27"+ },+ {+ "ipv4Prefix": "66.249.65.32/27"+ },+ {+ "ipv4Prefix": "66.249.65.64/27"+ },+ {+ "ipv4Prefix": "66.249.65.96/27"+ },+ {+ "ipv4Prefix": "66.249.66.0/27"+ },+ {+ "ipv4Prefix": "66.249.66.128/27"+ },+ {+ "ipv4Prefix": "66.249.66.160/27"+ },+ {+ "ipv4Prefix": "66.249.66.192/27"+ },+ {+ "ipv4Prefix": "66.249.66.224/27"+ },+ {+ "ipv4Prefix": "66.249.66.32/27"+ },+ {+ "ipv4Prefix": "66.249.66.64/27"+ },+ {+ "ipv4Prefix": "66.249.66.96/27"+ },+ {+ "ipv4Prefix": "66.249.67.0/27"+ },+ {+ "ipv4Prefix": "66.249.67.32/27"+ },+ {+ "ipv4Prefix": "66.249.67.64/27"+ },+ {+ "ipv4Prefix": "66.249.68.0/27"+ },+ {+ "ipv4Prefix": "66.249.68.128/27"+ },+ {+ "ipv4Prefix": "66.249.68.160/27"+ },+ {+ "ipv4Prefix": "66.249.68.192/27"+ },+ {+ "ipv4Prefix": "66.249.68.32/27"+ },+ {+ "ipv4Prefix": "66.249.68.64/27"+ },+ {+ "ipv4Prefix": "66.249.68.96/27"+ },+ {+ "ipv4Prefix": "66.249.69.0/27"+ },+ {+ "ipv4Prefix": "66.249.69.128/27"+ },+ {+ "ipv4Prefix": "66.249.69.160/27"+ },+ {+ "ipv4Prefix": "66.249.69.192/27"+ },+ {+ "ipv4Prefix": "66.249.69.224/27"+ },+ {+ "ipv4Prefix": "66.249.69.32/27"+ },+ {+ "ipv4Prefix": "66.249.69.64/27"+ },+ {+ "ipv4Prefix": "66.249.69.96/27"+ },+ {+ "ipv4Prefix": "66.249.70.0/27"+ },+ {+ "ipv4Prefix": "66.249.70.128/27"+ },+ {+ "ipv4Prefix": "66.249.70.160/27"+ },+ {+ "ipv4Prefix": "66.249.70.192/27"+ },+ {+ "ipv4Prefix": "66.249.70.224/27"+ },+ {+ "ipv4Prefix": "66.249.70.32/27"+ },+ {+ "ipv4Prefix": "66.249.70.64/27"+ },+ {+ "ipv4Prefix": "66.249.70.96/27"+ },+ {+ "ipv4Prefix": "66.249.71.0/27"+ },+ {+ "ipv4Prefix": "66.249.71.128/27"+ },+ {+ "ipv4Prefix": "66.249.71.160/27"+ },+ {+ "ipv4Prefix": "66.249.71.192/27"+ },+ {+ "ipv4Prefix": "66.249.71.224/27"+ },+ {+ "ipv4Prefix": "66.249.71.32/27"+ },+ {+ "ipv4Prefix": "66.249.71.64/27"+ },+ {+ "ipv4Prefix": "66.249.71.96/27"+ },+ {+ "ipv4Prefix": "66.249.72.0/27"+ },+ {+ "ipv4Prefix": "66.249.72.128/27"+ },+ {+ "ipv4Prefix": "66.249.72.160/27"+ },+ {+ "ipv4Prefix": "66.249.72.192/27"+ },+ {+ "ipv4Prefix": "66.249.72.224/27"+ },+ {+ "ipv4Prefix": "66.249.72.32/27"+ },+ {+ "ipv4Prefix": "66.249.72.64/27"+ },+ {+ "ipv4Prefix": "66.249.72.96/27"+ },+ {+ "ipv4Prefix": "66.249.73.0/27"+ },+ {+ "ipv4Prefix": "66.249.73.128/27"+ },+ {+ "ipv4Prefix": "66.249.73.160/27"+ },+ {+ "ipv4Prefix": "66.249.73.192/27"+ },+ {+ "ipv4Prefix": "66.249.73.224/27"+ },+ {+ "ipv4Prefix": "66.249.73.32/27"+ },+ {+ "ipv4Prefix": "66.249.73.64/27"+ },+ {+ "ipv4Prefix": "66.249.73.96/27"+ },+ {+ "ipv4Prefix": "66.249.74.0/27"+ },+ {+ "ipv4Prefix": "66.249.74.128/27"+ },+ {+ "ipv4Prefix": "66.249.74.160/27"+ },+ {+ "ipv4Prefix": "66.249.74.192/27"+ },+ {+ "ipv4Prefix": "66.249.74.224/27"+ },+ {+ "ipv4Prefix": "66.249.74.32/27"+ },+ {+ "ipv4Prefix": "66.249.74.64/27"+ },+ {+ "ipv4Prefix": "66.249.74.96/27"+ },+ {+ "ipv4Prefix": "66.249.75.0/27"+ },+ {+ "ipv4Prefix": "66.249.75.128/27"+ },+ {+ "ipv4Prefix": "66.249.75.160/27"+ },+ {+ "ipv4Prefix": "66.249.75.192/27"+ },+ {+ "ipv4Prefix": "66.249.75.224/27"+ },+ {+ "ipv4Prefix": "66.249.75.32/27"+ },+ {+ "ipv4Prefix": "66.249.75.64/27"+ },+ {+ "ipv4Prefix": "66.249.75.96/27"+ },+ {+ "ipv4Prefix": "66.249.76.0/27"+ },+ {+ "ipv4Prefix": "66.249.76.128/27"+ },+ {+ "ipv4Prefix": "66.249.76.160/27"+ },+ {+ "ipv4Prefix": "66.249.76.192/27"+ },+ {+ "ipv4Prefix": "66.249.76.224/27"+ },+ {+ "ipv4Prefix": "66.249.76.32/27"+ },+ {+ "ipv4Prefix": "66.249.76.64/27"+ },+ {+ "ipv4Prefix": "66.249.76.96/27"+ },+ {+ "ipv4Prefix": "66.249.77.0/27"+ },+ {+ "ipv4Prefix": "66.249.77.128/27"+ },+ {+ "ipv4Prefix": "66.249.77.160/27"+ },+ {+ "ipv4Prefix": "66.249.77.192/27"+ },+ {+ "ipv4Prefix": "66.249.77.224/27"+ },+ {+ "ipv4Prefix": "66.249.77.32/27"+ },+ {+ "ipv4Prefix": "66.249.77.64/27"+ },+ {+ "ipv4Prefix": "66.249.77.96/27"+ },+ {+ "ipv4Prefix": "66.249.78.0/27"+ },+ {+ "ipv4Prefix": "66.249.78.128/27"+ },+ {+ "ipv4Prefix": "66.249.78.160/27"+ },+ {+ "ipv4Prefix": "66.249.78.32/27"+ },+ {+ "ipv4Prefix": "66.249.78.64/27"+ },+ {+ "ipv4Prefix": "66.249.78.96/27"+ },+ {+ "ipv4Prefix": "66.249.79.0/27"+ },+ {+ "ipv4Prefix": "66.249.79.128/27"+ },+ {+ "ipv4Prefix": "66.249.79.160/27"+ },+ {+ "ipv4Prefix": "66.249.79.192/27"+ },+ {+ "ipv4Prefix": "66.249.79.224/27"+ },+ {+ "ipv4Prefix": "66.249.79.32/27"+ },+ {+ "ipv4Prefix": "66.249.79.64/27"+ }+ ]+}diff --git a/rust/feature-flags/tests/test_bot_filtering.rs b/rust/feature-flags/tests/test_bot_filtering.rsindex d3a71098726f..74198409094a 100644--- a/rust/feature-flags/tests/test_bot_filtering.rs+++ b/rust/feature-flags/tests/test_bot_filtering.rs@@ -19,8 +19,11 @@ const GOOGLEBOT_UA: &str =/// Reproduces the customer scenario: CloudFront rewrites the UA to its own/// brand string before the request reaches us, so the UA matcher cannot fire.const CLOUDFRONT_UA: &str = "Amazon CloudFront";-/// Inside the published Googlebot /19 (66.249.64.0/19).-const GOOGLEBOT_FORWARDED_IP: &str = "66.249.79.123";+/// Inside a published Googlebot /27 (`66.249.66.0/27`). The classifier is+/// JSON-precise — 66.249.x.x is published as discrete /27s, with gaps+/// (e.g. .79.96/27 is NOT published), so we pin a stable interior IP from a+/// densely-covered /24.+const GOOGLEBOT_FORWARDED_IP: &str = "66.249.66.0";/// Public-DNS IP, used as a benign baseline.const BENIGN_FORWARDED_IP: &str = "8.8.8.8";