Cap bot user-agent matching at 1KB (#100604)
No known real UA string we're aware of exceeds ~500 bytes (uap-core:
longest 492 B across 30,873 distinct strings; Matomo DeviceDetector:
longest 482 B across 40,348), so oversized UAs are never bots we need to
identify. This bounds regex work on attacker-controlled input as DoS
defense-in-depth, mainly for user-configured `htmlLimitedBots` patterns
which may be more expensive than the built-in one.
A >1KB UA containing a bot token (e.g. `WhatsApp`) is now treated as a
non-bot (streaming metadata served, `isBot()` false).
Hosting providers likely already cap the `User-Agent` header (or any
header value) e.g. [Vercel caps at
16kb](https://vercel.com/docs/errors/request_header_too_large)
<!-- NEXT_JS_LLM -->
---------
Co-authored-by: Claude Code <noreply@anthropic.com>