GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — gh-121650 : detect newlines in headers by basbloemsaat · Pull Request #121812 · python/cpython Conversation
|
I missed headers that were parsed from a message, as in original issue. I updated the fix and the tests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed that this fixes #121650. I'm pretty sure this is a security fix (as you could previously inject email headers using this method), so this should need a backport all the way to 3.8
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@warsaw, @bitdancer, @maxking: as the email experts, do you have any comments? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good to me! Thank you for digging into it!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I take back the review. There's more to this, unfortunately :( Here's another reproducer: from email import message_from_string from email.policy import default email_in = """\ To: [email protected] From: External Sender <[email protected]> =?UTF-8?Q?embedded_newline=0A?=Smuggled-Data: Bad Subject: foo <bar> Here's an Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 <html> <head><title>An embeded newline</title></head> <body> <p>I sent you an embedded newline in the subject. How do you like that?!</p> </body> </html> """ msg = message_from_string(email_in, policy=default) print(msg) for header, value in msg.items(): del msg[header] msg[header] = value email_out = str(msg) print(email_out) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I'll look into this... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…com:basbloemsaat/cpython into fix-issue-121650-detect-newlines-in-headers
There was an error while loading. Please reload this page.
|
@encukou I tried all header types. This eliminates all newlines. Two notes:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
After reading up on the email module, I propose to fix the issue in a different part of the code: see #122233. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing in favour of #122233. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.