OpenBook
  • Problems
  • Tracks
  • How it works
  • Pricing
Start practicingSign In
Problems/Auth & Permissions

26. Login Throttling and Lockout

Medium

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.

40 minute budget0.0% acceptancebrute force · account lockout · rate limiting · sliding window

Requirements

  1. 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.
  2. 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.
  3. 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).
  4. 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.
  5. 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.

Sign in to start

Attempts, files and transcripts are saved to your account so the grader can review how you worked.

Sign inCreate an account
OpenBook

Practice for interviews where you build a feature with an AI assistant.

Early preview. Problems, grading and the interviewer are still changing.

Practice

  • Problems
  • Tracks
  • How it works
  • Pricing

Legal

  • Terms
  • Privacy
© 2026 OpenBook.