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 — [CVE-2023-27043] gh-102988: Reject malformed addresses in email.parseaddr() by vstinner · Pull Request #111116 · python/cpython Conversation
|
|
@gpshead @serhiy-storchaka @bitdancer @warsaw: Would you mind to review this security fix? See issue gh-102988 for the context. This PR is a copy of PR #108250 but I added strict=True parameter, so it's possible to get the old behavior. I added tests on both modes, strict=True and strict=False. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
My colleague Lumir Balhar @frenzymadness ran an impact check of PR #108250 on Fedora: in short, there is no impact, the test suite of all Python packages (in Fedora) pass with the change. While there were some build errors, they were unrelated to the email issue. For details, see https://copr.fedorainfracloud.org/coprs/lbalhar/email-CVE/builds/ COPR which as more than 4300 builds. Now with an additional strict parameter, if there is any impacted project, at least there is a way to "opt out". |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@tdwyer: Would you mind to review my change, to see if I preserved your work correctly? (code and tests) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think that we should backport the change to all branches accepting security fixes. Problem: the change refer to version numbers, which as |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ambv @SethMichaelLarson: Would you mind to review this PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Why is this a separate PR from #108250? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| parameter to these two functions: use ``strict=False`` to get the old | ||
| behavior, accept malformed inputs. | ||
| (Contributed by Thomas Dwyer for :gh:`102988` to ameliorate CVE-2023-27043 | ||
| (Contributed by Thomas Dwyer for :gh:`102988` to improve the CVE-2023-27043 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
TIL a new word.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| specialsre = re.compile(r'[][\\()<>@,:;".]') | ||
| escapesre = re.compile(r'[\\"]') | ||
| realname_comma_re = re.compile(r'"[^"]*,[^"]*"') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| realname_comma_re = re.compile(r'"[^"]*,[^"]*"') | |
| realname_comma_re = re.compile(r'"[^",]*+,[^"]*+"') |
It is faster. But I am not sure that the use of such regex is correct.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| def _pre_parse_validation(email_header_fields): | ||
| accepted_values = [] | ||
| for v in email_header_fields: | ||
| s = v.replace('\\(', '').replace('\\)', '') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
But what if that backslash was already escaped with a backslash? For example \\) or \\\\).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I'm not the author of the other PR. I copied the other PR and added strict parameter. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not the author of this PR and I was able to make commits to it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I don't feel comfortable to make significant change of a PR without asking the author. I prefer to create a separated PR and ask for review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Is this behavior a bug or a feature? I don't know how Details |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Oh. getaddresses() expects a sequence, not a string :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Except of The latest major change was done in... 1997 with commit be7c45e
The latest minor change was done in 2019 to fix CVE-2019-16056: commit 8cb65d1 of issue #78336. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Oh, realname_comma_re replaces |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Email addresses have multiple standards:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is it time to backport the change to Python 3.8-3.12? So far, nobody reported any regression in Python 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Of course, I am eager for reviews and comments. So far, the only issue I have heard about was confusion about Also, I left some comments on that commit. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
According to this comment, not yet: #102988 (comment) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…n email.parseaddr() (python#111116) Detect email address parsing errors and return empty tuple to indicate the parsing error (old API). Add an optional 'strict' parameter to getaddresses() and parseaddr() functions. Patch by Thomas Dwyer. Co-Authored-By: Thomas Dwyer <[email protected]>
…n email.parseaddr() (python#111116) Detect email address parsing errors and return empty tuple to indicate the parsing error (old API). Add an optional 'strict' parameter to getaddresses() and parseaddr() functions. Patch by Thomas Dwyer. Co-Authored-By: Thomas Dwyer <[email protected]>
….parseaddr() (python#111116) Detect email address parsing errors and return empty tuple to indicate the parsing error (old API). Add an optional 'strict' parameter to getaddresses() and parseaddr() functions. Patch by Thomas Dwyer. Co-Authored-By: Thomas Dwyer <[email protected]>
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @vstinner, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @vstinner, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @vstinner, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @vstinner, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @vstinner, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-123766 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-123767 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-123768 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-123769 is a backport of this pull request to the 3.9 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-123770 is a backport of this pull request to the 3.8 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
please open a new issue if there's a lingering docs problem. |
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.