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

[3.5] bpo-39603: Prevent header injection in http methods (GH-18485) #21946

Merged
merged 1 commit into from
Sep 4, 2020
Merged

[3.5] bpo-39603: Prevent header injection in http methods (GH-18485) #21946

merged 1 commit into from
Sep 4, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Aug 24, 2020

reject control chars in http method in http.client.putrequest to prevent http header injection

(cherry picked from commit 8ca8a2e)

https://bugs.python.org/issue39603

reject control chars in http method in http.client.putrequest to prevent http header injection

(cherry picked from commit 8ca8a2e)
@vstinner
Copy link
Member Author

Notes on the backport:

  • I replaced f-string with %r formatting.
  • I modified test_main() to include HttpMethodTests test case.

Copy link
Member

@jaraco jaraco left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@orsenthil orsenthil left a comment

Choose a reason for hiding this comment

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

LGTM.

@vstinner
Copy link
Member Author

@larryhastings: The CI passed and 3 core dev approved the PR. Would you mind to merge it?

@larryhastings larryhastings merged commit 524b8de into python:3.5 Sep 4, 2020
@bedevere-bot
Copy link

@larryhastings: Please replace # with GH- in the commit message next time. Thanks!

@larryhastings
Copy link
Contributor

Thanks for the backport! This miiiiight be the last checkin for 3.5 ever... we'll see!

@vstinner vstinner deleted the fix_http_method_35 branch September 4, 2020 09:44
encukou pushed a commit to encukou/cpython that referenced this pull request Sep 30, 2020
00354 #
Reject control chars in HTTP method in httplib.putrequest to prevent
HTTP header injection

Backported from Python 3.5-3.10 (and adjusted for py2's single-module httplib):
- https://bugs.python.org/issue39603
- python#18485 (3.10)
- python#21946 (3.5)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
hroncok pushed a commit to fedora-python/cpython that referenced this pull request Apr 19, 2021
00354 #
Reject control chars in HTTP method in httplib.putrequest to prevent
HTTP header injection

Backported from Python 3.5-3.10 (and adjusted for py2's single-module httplib):
- https://bugs.python.org/issue39603
- python#18485 (3.10)
- python#21946 (3.5)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
hroncok pushed a commit to fedora-python/cpython that referenced this pull request May 19, 2021
00354 #
Reject control chars in HTTP method in httplib.putrequest to prevent
HTTP header injection

Backported from Python 3.5-3.10 (and adjusted for py2's single-module httplib):
- https://bugs.python.org/issue39603
- python#18485 (3.10)
- python#21946 (3.5)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
stratakis pushed a commit to stratakis/cpython that referenced this pull request Jul 18, 2022
00354 #
Reject control chars in HTTP method in httplib.putrequest to prevent
HTTP header injection

Backported from Python 3.5-3.10 (and adjusted for py2's single-module httplib):
- https://bugs.python.org/issue39603
- python#18485 (3.10)
- python#21946 (3.5)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
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

8 participants