Skip to content

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

Merged
larryhastings merged 1 commit into
python:3.5from
vstinner:fix_http_method_35
Sep 4, 2020
Merged

[3.5] bpo-39603: Prevent header injection in http methods (GH-18485)#21946
larryhastings merged 1 commit into
python:3.5from
vstinner:fix_http_method_35

Conversation

@vstinner

@vstinner vstinner commented Aug 24, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

Notes on the backport:

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

@jaraco jaraco left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@orsenthil orsenthil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@vstinner

Copy link
Copy Markdown
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
Copy Markdown

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

@larryhastings

Copy link
Copy Markdown
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.

8 participants