Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise ValueError if method contains control characters #1800

Merged
merged 4 commits into from Feb 17, 2020

Conversation

sethmlarson
Copy link
Member

Protects against BPO-39603 which was reported to CPython and Requests. The risk of this being exploited is minimal as attackers will rarely have direct control of the request method, but in that case header injection is possible in http.client, urllib3 and requests.

This change makes that not possible, unfortunately there's not really an exception that fits the bill for this error, but hopefully this situation is rare enough that we don't have to care.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this!

test/with_dummyserver/test_poolmanager.py Outdated Show resolved Hide resolved
src/urllib3/connection.py Outdated Show resolved Hide resolved
Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but do you know why tests are failing? It's not necessarily because of this PR

@sethmlarson
Copy link
Member Author

Yeah it's because putrequest() is now a member on HTTPConnection but the documentation in the Python source code is apparently not Sphinx-compatible so it's throwing an error. Tried to figure out how to make autosphinx skip a single member but to no avail yet. :/

@pquentin
Copy link
Member

The remaining failure is a strange macOS Python 2.7 bug that also happens on master. It claims that it does not find the coverage program. Investigating...

@pquentin
Copy link
Member

#1802 should fix the issue we're seeing here

@sethmlarson sethmlarson reopened this Feb 17, 2020
@sethmlarson
Copy link
Member Author

sethmlarson commented Feb 17, 2020

Cycling the build, thanks for the fix in #1802 @pquentin!

@sethmlarson sethmlarson merged commit 1dd69c5 into urllib3:master Feb 17, 2020
@sethmlarson sethmlarson deleted the method-ctrl-chars branch February 17, 2020 21:34
alfredodeza pushed a commit to anchore/anchore-cli that referenced this pull request Oct 6, 2020
Fixes vulnerability reported and fixed with:

 urllib3/urllib3#1800

Signed-off-by: Alfredo Deza <adeza@anchore.com>
alfredodeza pushed a commit to anchore/anchore-engine that referenced this pull request Oct 6, 2020
zhill pushed a commit to zhill/anchore-engine that referenced this pull request Oct 8, 2020
Dobatymo pushed a commit to Dobatymo/urllib3 that referenced this pull request Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants