carlos / platform Public

design: probe-burst limit shared across the platform (draft for builder check)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev e279a846f8020198da26b8a860adaae13732c151 parent eab053a
1 file changed, +181 −0
  • docs/superpowers/specs/2026-10-31-probe-burst-limit-design.md +181 −0

CI passed — run details

diff --git a/docs/superpowers/specs/2026-10-31-probe-burst-limit-design.md b/docs/superpowers/specs/2026-10-31-probe-burst-limit-design.md
new file mode 100644
index 000000000..806d678cd
--- /dev/null
+++ b/docs/superpowers/specs/2026-10-31-probe-burst-limit-design.md
@@ -0,0 +1,181 @@
+# Probe-burst limit, shared across the platform
+
+Status: draft for Paul, 2026-10-31. Branch `design-probe-burst-491`.
+
+Builds §5.5 of the edge request protection spec
+(`docs/superpowers/specs/2026-10-24-edge-request-protection-design.md`, "the
+protection spec") and amadan #491 (platform-wide probe bans). The protection
+spec's rulings stand; this document only adds what §5.5 left open and the
+platform-wide part.
+
+## 1. What this is for
+
+Paul, 2026-10-31, on honeypots: "if they try to exploit them, we shut them
+down". The conversation settled on no fake vulnerabilities on tenant domains,
+and instead:
+
+1. the probe-burst limit the protection spec designed but nobody has built:
+ a client that works through a list of attack paths is refused further
+ attack paths for a while; and
+2. sharing that verdict, so a client caught on one app is refused on every
+ app on the platform (#491).
+
+Evidence: on 2026-10-31 at 03:58Z one /24 tried about 30 PHP and WordPress
+paths in 5 seconds against paulca-com. Today those are only recorded.
+
+## 2. Goals, non-goals, anti-goals
+
+Goals:
+1. Count, per app and per client, the "not found" answers the edge gives or
+ passes on, and trip a cool-down when a client crosses the threshold.
+2. During a cool-down, refuse that client's requests to catalogue paths the
+ app is not known to serve, on every app on the box.
+3. Tell every other platform edge, so the cool-down applies platform-wide
+ within seconds.
+4. Watch first, like every other protection: record "would have refused"
+ until Paul approves blocking.
+5. Show it: refusals and would-be refusals count on the Protection tab and
+ the operator page, and every refusal carries a reference code.
+
+Non-goals:
+- Refusing anything but catalogue paths. A client in cool-down still gets
+ every ordinary page (protection spec §5.5; #358's ruling that a shared
+ address is never limited pre-emptively).
+- Long-lived bans or reputation lists (protection spec ruling 1; recon: lists
+ blocked ~22% of real visitors).
+- Fake vulnerabilities, tarpits, honeypot responses.
+- Rate limiting in general (#358's).
+- Per-app tuning of the threshold in v1.
+
+Anti-goals (a failure even if it works):
+- **A real visitor refused a real page.** Never refuse a path the app is
+ known to serve.
+- **A tenant able to block other people's visitors.** Only platform edges may
+ start a platform-wide cool-down; a fleet box (tenant hardware) cannot.
+- **A flood turned into load.** Tripping and sharing must stay cheap under a
+ scan: no storage writes, bounded memory, bounded messages.
+- **Silent blocking.** A refusal nobody can explain.
+
+## 3. The limit on one box
+
+Decided in the protection spec §5.5 (unchanged):
+- Threshold 60 not-founds in 60 s, cool-down 10 minutes. The builder checks
+ both against request records before blocking ships (§6).
+- Client key: the request's `clientIP` truncated as #358 does: /32 for IPv4,
+ /64 for IPv6.
+- During a cool-down, refuse requests to paths in the probe catalogue
+ (every group, including admin panels) whose existence on the app is
+ unknown or known absent. Answer `429` with `Retry-After` set to the
+ cool-down's remaining seconds and a reference code. Other requests pass.
+
+Added here:
+- **What counts as a not-found.** A response the edge sends or passes on with
+ status 404, plus any hard or probe tier match (watch or block) whatever the
+ status. A burst-mode rule match (`probe/admin`) counts only if the answer
+ was a 404, since real admins use those paths. *My call.*
+- **Counting is per app, the cool-down is per client.** A client trips by
+ collecting 60 not-founds on one app; the cool-down then covers every app.
+ *My call:* per-app counting keeps one busy shared address from tripping on
+ ordinary 404s spread over many apps, and a scanner works one host at a
+ time anyway.
+- **Known to exist** means, today: a static site's file tree has the path (the
+ probe tier's existing check, protection spec §5.3). The other sources §5.3
+ lists (route lists, technology switches, learned exemptions, allow rules)
+ plug in when they are built. Until then, a non-static app's catalogue paths
+ are unknown and are refused during a cool-down, as §5.5 already accepts.
+- **Where.** The check runs where the hard and probe checks run: before the
+ activator and the cache (protection spec §5.3), so a refused request never
+ wakes an instance. The counting happens in the observer defer, where the
+ final status is known, on the box that answered (the rule the Protection
+ tab's counts already follow: never twice for a tunnelled request).
+- **Memory.** Per-app-per-client counters live in a bounded map with a
+ sliding window; the cool-down set is bounded too. *My call:* 100,000
+ counters and 50,000 cool-downs per box, oldest evicted first; an eviction
+ is counted, never silent.
+
+## 4. Sharing across the platform (#491)
+
+When a box trips a client, it tells every other platform edge, which applies
+the same cool-down, expiring at the same moment.
+
+- **Who.** Only boxes that hold the deployment's mesh key
+ (`control/edge-mesh-key`, `internal/edge/mesh.go`). Fleet boxes do not get
+ that key (the store door refuses it to them), so they can neither send nor
+ accept a notice. Fleet apps are still covered: the hub checks their
+ requests before forwarding them (the Protection tab's counting rule).
+- **Where to.** The other edges' dial points from the published edges files
+ (`control/edges/<box>.json`, read by `internal/edge/homemap.go`). No new
+ polling: the edge already mirrors those.
+- **What.** A small notice: the client key, the absolute expiry, the box that
+ tripped it and the reference code of the trip. Signed with the mesh key
+ under its own label (*my call:* `carlos-burst-notice`, a distinct domain in
+ `hopMAC`'s sense so a notice can never pass as a hop or a door call), with
+ a timestamp checked against `hopSkew` (30 s), and bound to the receiving
+ box's name so it cannot be replayed at another box.
+- **Acceptance.** A receiver accepts a notice only if the signature checks,
+ the expiry is in the future and no more than one cool-down (10 minutes)
+ ahead, and the client key is a valid /32 or /64. It then applies the
+ cool-down exactly as if it had tripped locally, and records which box it
+ came from.
+- **Bounds.** A box does not re-send for a client already cooling. *My call:*
+ at most 120 notices sent per box per minute; past that, trips stay local
+ and the overflow is counted. A receiver accepts at most 600 per minute from
+ all senders, and counts what it drops.
+- **Failure.** A notice that fails to send is not retried: the scanner will
+ trip the other box on its own if it gets there. Sending never blocks
+ serving.
+
+## 5. What people see
+
+- **Visitor.** A refused catalogue request gets `429`, `Retry-After`, and a
+ short plain body with the reference code. A real person almost never sees
+ this (they would have to share an address with an active scanner and ask
+ for a catalogue path the app does not declare).
+- **Logs.** Each trip, each notice received, and each refusal (or
+ would-be refusal in watch mode) is a request record: tier `burst`, with the
+ reference code. Trips and notices are one line each, never one per
+ request beyond the existing per-minute record caps.
+- **Protection tab and operator page.** Refusals count as blocked, would-be
+ refusals as recorded, under a new group (`burst/probe-burst`) with a plain
+ name. The group needs a name in the copy deck and in
+ `protectiongroups.go`.
+- **Reference codes.** `carlos explain` and the console decode a burst code
+ like any other: which box tripped it, when, and that the fix for a real
+ route is to declare it.
+
+All visitor-facing and console text goes through copy review before it is
+written into the code.
+
+## 6. Rollout
+
+1. **Watch.** Ship with the limit counting, tripping, sharing and recording
+ "would have refused", refusing nothing (catalogue default). Dev only:
+ `CARLOS_EDGE_PROTECT=block` refuses for real, so the 429 can be seen end to
+ end.
+2. **Calibrate.** Fold into the protection spec's step-3 calibration report
+ (§8 there): how many clients would have tripped, how many of them also got
+ real pages (a sign of a shared address), whether any trip came from a
+ known crawler, and whether 60 in 60 s and 10 minutes hold up.
+3. **Block.** Paul approves turning it on, with any changed numbers. Then the
+ flagship refuses for real.
+
+Roll dev first, then the flagship, as always.
+
+## 7. Constraints
+
+- **No storage writes** on the request path or per trip; no new polling.
+ Notices travel edge to edge.
+- **Provider-neutral.** Nothing AWS-specific.
+- **Census.** New edge code on the serving path and a new signed message
+ between edges: run `make census-card`; the cross-model reviewer decides.
+- **No tenant names** in code, fixtures, copy or docs.
+- **Production-wired tests:** through a real Edge with the real catalogue, and
+ two real edges exchanging a real signed notice.
+
+## 8. Left to the builder
+
+- The notice's transport (a reserved path on the edge's own listener, or a
+ header on an ordinary request to the receiving box), within §4's rules.
+- Data structures for the counters and the cool-down set, within §3's bounds.
+- Where the burst checks sit in the code, within §3's ordering.
+- The record field names for trips and notices.