Guard a login endpoint against brute force: count failures per account and per client IP, lock or block after too many, and unlock after a cooldown or an admin reset.
01POST /login { username, password } with an x-client-ip header checks a few seeded accounts: 200 { username } on success, 401 for a wrong password or unknown username (same body either way), 400 for a malformed request.
02Failed logins are counted per account and per client IP; too many failures lock the account, and too many from one IP block that IP.
03A lock ends by itself after a cooldown, or at once on POST /accounts/:username/unlock (an admin reset that also clears the account's failures).
04GET /accounts/:username/status returns { username, failures, locked, lockedUntil } and GET /ips/:ip/status returns { ip, failures, blocked, retryAfter }; an unknown username is a 404.
05Time comes from the x-now header when present.
What the hidden tests check
Everything the interviewer tells you is checked.
Locks, blocks and windows are probed one millisecond either side of their edges, at controlled times.
4 more details are held back. In a mock interview they come out only when you ask the interviewer the right question; in practice they are listed in the workspace.