Link Scheme Allowlist
Easy About 15 min Katabench Pro
Render a user-supplied link only when its scheme is one you trust, instead of blocklisting the dangerous ones.
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 Filename Sanitizer, which is free.
How it is graded
Functional tests and adversarial payloads both have to pass before the solution is accepted.
What it practices
- URL and origin validation
- Validate redirect targets, hosts, CORS origins and link schemes without suffix tricks.
- Allowlist validation
- Accept only known-good values, fields and types instead of chasing bad ones.
Related katas
- CORS Origin Reflection Medium Pro Decide the Access-Control-Allow-Origin value by exact allowlist, not a suffix match an attacker can satisfy.
- Filename Sanitizer Easy Free Reduce an uploaded filename to a safe, single path segment.
- Mass Assignment Guard Easy Free Decide which submitted fields may be applied to a record using an allowlist, not a blocklist.
- Upload Content-Type Allowlist Easy Pro Accept only the exact content types you actually support, instead of any value that looks close enough.