Path Traversal in Downloads
Medium About 20 min Katabench Pro
Resolve a requested file path so it can't escape the download root.
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
- Path traversal
- Canonicalize file paths and names so requests cannot escape their root.
Related katas
- Filename Sanitizer Easy Free Reduce an uploaded filename to a safe, single path segment.
- Block Private Hosts (SSRF) Medium Free Reject internal hosts so a user-supplied URL cannot make the server call itself or its neighbors.
- Comment Renderer (HTML Injection) Easy Free Fix a stored-XSS hole in a comment renderer without breaking its output.
- Log Forging (CRLF) Easy Free Stop user input from forging extra log lines with embedded newlines.