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

python -m http.server log messages to stderr can emit raw data #100001

Closed
gpshead opened this issue Dec 5, 2022 · 2 comments
Closed

python -m http.server log messages to stderr can emit raw data #100001

gpshead opened this issue Dec 5, 2022 · 2 comments
Assignees
Labels
release-blocker type-bug An unexpected behavior, bug, or error type-security A security issue

Comments

@gpshead
Copy link
Member

gpshead commented Dec 5, 2022

@gpshead gpshead added type-bug An unexpected behavior, bug, or error type-security A security issue labels Dec 5, 2022
@gpshead gpshead self-assigned this Dec 5, 2022
gpshead added a commit that referenced this issue Dec 5, 2022
Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
…ythonGH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
…ythonGH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
…ythonGH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
…ythonGH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington added a commit that referenced this issue Dec 5, 2022
…0002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington added a commit that referenced this issue Dec 5, 2022
…0002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead added a commit to gpshead/cpython that referenced this issue Dec 5, 2022
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
@gpshead gpshead moved this from Todo to In Progress in Release and Deferred blockers 🚫 Dec 5, 2022
@gpshead
Copy link
Member Author

gpshead commented Dec 5, 2022

The existing pending & merged PRs on release branches are sufficient to address the potential security issue and should unblock the release.

PR #100038 makes it possible to still be able to parse a http.server log_message without ambiguity. I've already incorporated it into the not yet merged 3.9/3.8/3.7 backport PRs and will run backports of it to the 3.10 and 3.11 branches.

gpshead added a commit that referenced this issue Dec 5, 2022
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
…H-100038)

Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
(cherry picked from commit 7e29398)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
…H-100038)

Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
(cherry picked from commit 7e29398)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@gpshead
Copy link
Member Author

gpshead commented Dec 5, 2022

I added release-blocker tags to the pending PRs. I'm closing the issue itself now as it's resolved, just awaiting some CI & branch merges.

@gpshead gpshead closed this as completed Dec 5, 2022
Repository owner moved this from In Progress to Done in Release and Deferred blockers 🚫 Dec 5, 2022
miss-islington added a commit that referenced this issue Dec 5, 2022
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
(cherry picked from commit 7e29398)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington added a commit that referenced this issue Dec 5, 2022
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
(cherry picked from commit 7e29398)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead added a commit to gpshead/cpython that referenced this issue Dec 5, 2022
ned-deily pushed a commit that referenced this issue Dec 5, 2022
…H-100002) (GH-100034)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead added a commit that referenced this issue Dec 5, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
(cherry picked from commit bed15f8)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
pythongh-100001: Remove new doc typo, add versionadded.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2022
(cherry picked from commit bed15f8)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
pythongh-100001: Remove new doc typo, add versionadded.
ambv pushed a commit that referenced this issue Dec 6, 2022
…H-100002) (#100033)

* gh-100001: Omit control characters in http.server stderr logs. (GH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

* also escape \s (backport of PR #100038).

* add versionadded and remove extraneous 'to'

Co-authored-by: Gregory P. Smith <greg@krypto.org>
ambv pushed a commit that referenced this issue Dec 6, 2022
…H-100002) (#100032)

* gh-100001: Omit control characters in http.server stderr logs. (GH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

* also escape \s (backport of PR #100038).

* add versionadded and remove extra 'to'

Co-authored-by: Gregory P. Smith <greg@krypto.org>
ambv pushed a commit that referenced this issue Dec 6, 2022
)

(cherry picked from commit bed15f8)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
ambv pushed a commit that referenced this issue Dec 6, 2022
)

(cherry picked from commit bed15f8)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-blocker type-bug An unexpected behavior, bug, or error type-security A security issue
Projects
Development

No branches or pull requests

2 participants