Repository navigation
Limit anonymous website scans and check for bots - #67
Conversation
Each website visitor can start 3 new scans a day (counted by a keyed hash of their IP, through the allowance from #36). Opening a scan that already exists, or a rescan of one still running, spends nothing. At the limit the form says so calmly, with when more are possible; "Scan again" now shows that message instead of failing the page. On Vercel production, Vercel BotID checks that a scan comes from a browser. Previews (behind Vercel's login, where Drippa's review drives a headless browser) and self-hosted setups skip it. requestScan gets an allowance hook: checked just before a new scan is created, spent once it is. Closes #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drippa Sign-Off: Limit anonymous website scans to 3 a day and add a bot check✅ Delivers ticket #41 — 5 of 5 outcomes What was promised
Proof Steps based on ticket #41, the pull request description and the code change. What Drippa tested (6 steps)Page change — click through it on this pull request's preview. Before you start
DetailsStarting a new scan on the website now counts against a daily allowance of 3 per visitor. The visitor is identified by a keyed hash of their IP, never the IP itself. Opening an existing or recent scan is free, and so is reading a report. On the live site, a bot check runs before anything else; previews and self-hosted setups skip it. When the limit is reached, a message says when scans reset, and on a report it appears under the "Scan again" button instead of an error page. Test coverage: ✅ Well covered — Tests cover the 3-scan limit, free reopening of existing scans, "Scan again" counting, separate visitors, bot refusal, bad input and the message wording. 🔍 Checked: 🎫 Compared against drippa-ai/stackprobe#41 Updated by Drippa • 2026-10-12 19:31 UTC Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Closes #41
Covers both "Done when" lines of #41: the limits and the bot check are tested (the bot check is behind a
BotCheckinterface, faked in tests), and reading reports is never limited.What changes
requestScanallowance hook (core):allowance.check()runs just before a new scan is created and can refuse it;allowance.spend()runs once the scan exists. Returning a running or fresh scan touches neither.lib/start-scan.ts: the website's scan logic, with the server action now a thin wrapper.visitor:<hmac of IP>, usingSTACKPROBE_IP_HASH_SECRETfrom Let agents create and revoke their own API keys #64).--ink-2: a limit isn't a failure.botid, MIT):withBotIdinnext.config.ts;initBotIdininstrumentation-client.tsprotects POSTs, which is how scan forms submit.checkBotId()runs in the action only on Vercel production (VERCEL_ENV=production). Previews skip it: they're behind Vercel's login already, and Drippa's review drives a headless browser there that BotID would refuse.Checked
pnpm lint,pnpm typecheck,pnpm test(385 passing),pnpm buildpass.Notes
NEXT_PUBLIC_VERCEL_ENV, which Vercel exposes by default ("Automatically expose System Environment Variables").🤖 Generated with Claude Code