The login endpoint is the only place an attacker can guess. Everything else gates on a session that the login endpoint issued. Get this one route right and the rest of the layer follows.
Why each line matters
| Line | What it defends against |
|---|---|
| Pre-check blacklist | Even before bcrypt cost is paid; saves CPU on known-bad IPs |
| Pre-check attempt count | Blocks the 6th attempt before it can succeed by guess |
| Constant-time delay on fail | Removes timing as an oracle (PIN length, bcrypt cost) |
| Increment on fail, clear on success | Counter resets so a few legitimate typos don't lock you out forever |
| HttpOnly, Secure, SameSite=strict | Standard cookie hardening (Track 2) |