Clamp the Page Size
Easy About 12 min Katabench Pro
Bound a user-requested page size so a huge value cannot exhaust the server.
The full brief is part of Katabench Pro
Pro opens this kata's brief, its starter code and its grader. To see how the track works first, try Comment Renderer (HTML Injection), which is free.
How it is graded
Functional tests and adversarial payloads both have to pass before the solution is accepted.
What it practices
- Resource exhaustion
- Bound sizes, expansions and regex backtracking so one request cannot exhaust the server.
- Numeric abuse
- Defend arithmetic against overflow, negative amounts and out-of-range values.
Related katas
- Negative Amount Refund Easy Pro Stop a refund whose amount or excess would move money the wrong way.
- Password Reset Token Scope Medium Pro Bind a verified reset token to its subject, purpose, validity window, and one-time state.
- Quantity x Price Overflow Medium Pro Compute an order total that can't be wrapped by integer overflow.
- The Exploding SKU Regex Medium Pro Rewrite the backtracking validation patterns of a catalog import so one poisoned supplier file cannot pin a CPU core.