Should the path be normalized?
- Dominant language
- TypeScript
- Stars
- 433
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
I'm using `koa-send` in my Koa server and I have the problem that I get `Malicious Path` from `resolve-path` when the request path is something along the lines of `http://localhost:3000//some/path/image.jpg`.
Would it be a bad idea to `path.normalize` the path in `koa-send` before processing it further? This could for instance be done here https://github.com/koajs/send/blob/master/index.js#L46 before doing `substring` on the path.
Contributor guide
Research direction
Review index.js around line 46 and trace how the request path reaches resolve-path. Determine whether normalizing the path before substring processing preserves the intended koa-send behavior. Done means a request containing a doubled slash, such as //some/path/image.jpg, no longer produces Malicious Path without weakening path safety.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100