CVE-2023-27043 Unicode follow-up: add parseaddr regression test (Python 3.7)#82
Open
icanhasmath wants to merge 1 commit into3.7.17.xfrom
Open
CVE-2023-27043 Unicode follow-up: add parseaddr regression test (Python 3.7)#82icanhasmath wants to merge 1 commit into3.7.17.xfrom
icanhasmath wants to merge 1 commit into3.7.17.xfrom
Conversation
The 2.7-branch Unicode refactor for CVE-2023-27043 (c98f6b9) does not port to Python 3: its code change uses the Python-2-only `unicode` name and UTF-8-encodes to bytes, both of which are no-ops / errors on 3.x where `str` is already Unicode. Port only the test intent. Verified against the current 3.7.17.x parseaddr: strict mode accepts ASCII and non-ASCII input and agrees with non-strict mode, so no source change to Lib/email/utils.py is required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
c98f6b9d0f8).isinstance(addr, (str, unicode))+addr.encode('utf-8')) is Python-2-only and wouldNameErroron 3.x, so no source change toLib/email/utils.pyis required or applied here.parseaddr(strict=True)regression test covering ASCII and non-ASCII ("Sürname, Firstname" <to@example.com>), asserting (a) non-empty result and (b) strict-mode agrees with non-strict-mode — the same shape as the 2.7 test.Verification
Loaded the current
3.7.17.xLib/email/utils.pyunder a Python 3 interpreter (pure-Python module, safely isolated from stdlib) and ran the four test cases. All pass both assertions, confirming the existing CVE-2023-27043 fix on 3.7.17.x already handles Unicode correctly because Python 3stris natively Unicode.Test plan
./python -m test test_email -k test_parseaddr_unicodepasses on Linuxtest_emailsuite still passes (no regressions in neighboring tests)🤖 Generated with Claude Code