Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const original = fs.readFileSync(jsonFilePath, "utf-8");

const updated = JSON.stringify(JSON.parse(original), null, 2) + '\n';

function validateJsonSelector(selector, item, verify, source) {
if (selector.includes('\\"')) {
console.error("JSON selector contains escaped quotes; use JSON string escaping only:", item, verify, source);
process.exit(1);
}
}

if (process.argv[2] === "--generate") {
fs.writeFileSync(jsonFilePath, updated);
process.exit(0);
Expand Down Expand Up @@ -97,6 +104,7 @@ if (process.argv[2] === "--generate") {
console.error("Cidr source `selector` must be a string for http-json type", item, verify, source);
process.exit(1);
}
validateJsonSelector(source.selector, item, verify, source);
}
}
} else if (verify.type === "dns") {
Expand Down Expand Up @@ -151,6 +159,7 @@ if (process.argv[2] === "--generate") {
console.error("IP source `selector` must be a string for http-json type", item, verify, source);
process.exit(1);
}
validateJsonSelector(source.selector, item, verify, source);
}
// http-text sources don't need a selector
}
Expand Down
60 changes: 30 additions & 30 deletions well-known-bots.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -109,7 +109,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -150,7 +150,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -188,7 +188,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -227,7 +227,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/special-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -269,7 +269,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/special-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -334,12 +334,12 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
},
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers-google.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -378,7 +378,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/special-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -442,7 +442,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/special-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -483,7 +483,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -523,7 +523,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -566,7 +566,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -605,7 +605,7 @@
{
"type": "http-json",
"url": "https://www.bing.com/toolbox/bingbot.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -2097,7 +2097,7 @@
{
"type": "http-json",
"url": "https://www.bing.com/toolbox/bingbot.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -5428,7 +5428,7 @@
{
"type": "http-json",
"url": "https://www.bing.com/toolbox/bingbot.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -9984,12 +9984,12 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
},
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers-google.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -11778,7 +11778,7 @@
{
"type": "http-json",
"url": "https://openai.com/gptbot.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -11810,7 +11810,7 @@
{
"type": "http-json",
"url": "https://openai.com/chatgpt-user.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -11959,7 +11959,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/special-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -13157,7 +13157,7 @@
{
"type": "http-json",
"url": "https://claude.com/crawling/bots.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -13195,7 +13195,7 @@
{
"type": "http-json",
"url": "https://claude.com/crawling/bots.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -13230,7 +13230,7 @@
{
"type": "http-json",
"url": "https://claude.com/crawling/bots.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -13431,7 +13431,7 @@
{
"type": "http-json",
"url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -13551,7 +13551,7 @@
{
"type": "http-json",
"url": "https://openai.com/searchbot.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -13709,7 +13709,7 @@
{
"type": "http-json",
"url": "https://ip-ranges.datadoghq.com/synthetics.json",
"selector": "$.synthetics[\\\"prefixes_ipv4\\\",\\\"prefixes_ipv6\\\"][*]"
"selector": "$.synthetics[\"prefixes_ipv4\",\"prefixes_ipv6\"][*]"
}
]
}
Expand Down Expand Up @@ -13743,7 +13743,7 @@
{
"type": "http-json",
"url": "https://hydrozen.io/config/iplist.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
}
Expand Down Expand Up @@ -13903,7 +13903,7 @@
{
"type": "http-json",
"url": "https://geedo.com/product-search/product-search-ip.json",
"selector": "$.prefixes[*][\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv4Prefix\"]"
}
]
},
Expand Down Expand Up @@ -13942,7 +13942,7 @@
{
"type": "http-json",
"url": "https://www.bing.com/toolbox/bingbot.json",
"selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"
"selector": "$.prefixes[*][\"ipv6Prefix\",\"ipv4Prefix\"]"
}
]
},
Expand Down