Rate limits plus no wipe on failures
- Status: SHIPPED with block list and Gate 2 proof
- Spec: FR-10, caps table
- Sources:
tosv.cpprate_ok,archive/tosv.pyrate_ok,uploads/paste.txtlines 82 and 107, SPEC.md 0.3
What it is
Login allows 5 tries per 300s per IP, store allows 20 per 300s per
peer, with 429 blocked beyond. Windows are pruned in-memory lists
per key. And the deliberate twin decision, stated twice in the
vision text: failed logins NEVER trigger a wipe, because strangers
will always be knocking.
How TOSV does it
rate_ok stamps epoch seconds onto the key list, drops entries
older than the window, appends now, and compares length to limit,
all under one mutex. Login and store call it before any credential
work, so limited requests cost near zero.
What it protects against
Online guessing and credential stuffing at scale: 5 per 5 minutes per IP turns even a weak pair into years of work, and vault pairs are 96-plus-bit randoms anyway. The no-wipe rule protects against ransom-by-knocking: anyone could otherwise delete the vault by failing logins on purpose.
Attack realism
Very high. Internet-facing logins get sprayed within minutes; the paste text author knew this from experience. Rate caps plus strong randoms is the industry answer (OWASP, NIST 800-63B) and needs no exotic machinery.
Pros
Zero config, zero false-positive wipe risk. Per-IP keys share nothing across attackers. Cheap to pass, expensive to fight.
Cons and how the vault resolves them
- Windows reset on restart. Resolved by pairing low caps with high-entropy creds: even a fresh window gives 5 guesses at 132 bits. Restarts also wipe attacker session state.
- No persistent block list yet (legacy had an unused BLOCK set).
Closed in M5: 20 strikes per 300s blocks an IP for 3600s with an
audited
blockedline, duress evaluated first, Gate 2 proves trip plus bypass. Blocks live in RAM and reset on restart. - NAT shares one key across an office. Accepted: 5 per 300s still blocks spraying while letting humans typo a few times. Per-user keys are tracked if it ever bites.
- 429 reveals the limiter exists. Accepted: limiters are public knowledge; hiding them buys nothing.
Residual risk
Closed: the M5 block list plus cred entropy ends even the nuisance tier. Remaining note: blocks reset on restart by design.