Pylons / Pylons/webob

validate that port in Host header is indeed a number

Open
#178 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.