validate that port in Host header is indeed a number
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 443
- Forks
- 206
- PR merge metrics
- No merged PRs in 30d
Description
The port bit in the Host header has been used as a way to attack link generation in applications, as described here:
http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
I think it'd be cheap to validate that the port given in the Host header is indeed an integer, and reject with a bad request if not. I don't think this should be done in middleware but in the request implementation itself.
This issue is spun off from #174
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the request implementation that parses the Host header, using the linked issue context to find the relevant entry point. Confirm how an invalid port is currently handled, then make the behavior reject a non-integer port with a bad request; add or update focused request tests if the existing test layout identifies where this behavior belongs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100