Skip to content

Conversation

bitdancer
Copy link
Member

@bitdancer bitdancer commented Jan 21, 2025

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416)

Co-authored-by: Mike Edmunds [email protected]

@hugovk
Copy link
Member

hugovk commented Feb 17, 2025

@bitdancer The CI is failing for test_email, please could you check it?

@terryjreedy
Copy link
Member

bitdancer is no longer active. @python/email-team Security backport is pending fix of failing test.

@medmunds
Copy link
Contributor

The failing test_address_list_with_list_separator_after_fold was added in 3.11 by PRs #100885 and #119099 as a fix for gh-100884 (and regression gh-118643). The test case is being pulled into 3.10 by this backport, but without the corresponding fix.

gh-100884 has similar security implications to the original issue here, but was not identified as a security issue at the time. (It's also effectively the inverse issue of gh-121284.)

@bitdancer
Copy link
Member Author

@terryjreedy Actually I'm becoming active again, but I'm still ramping back up. I'm still learning about the current way backports are done, and it has taken me a while to get back to this.

medmunds and others added 2 commits March 14, 2025 12:53
…ted-string (pythonGH-122753)

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416)

Co-authored-by: Mike Edmunds <[email protected]>
@bitdancer bitdancer force-pushed the backport-5aaf416-3.10 branch from 54443ce to f35f5c0 Compare March 14, 2025 16:56
@bitdancer
Copy link
Member Author

Tests are passing now.

@ambv ambv merged commit a4ef689 into python:3.10 Apr 3, 2025
15 checks passed
@bedevere-app
Copy link

bedevere-app bot commented Apr 10, 2025

GH-132371 is a backport of this pull request to the 3.9 branch.

@terryjreedy
Copy link
Member

@bitdancer Good to see you back ;-). Are you aware of core-dev discord?

@bitdancer
Copy link
Member Author

@terryjreedy Aware, yes, but I haven't gotten around to trying to figure out how to access it ;)

@terryjreedy
Copy link
Member

Once you have an account, I believe you need an invite from an admin. @hugovk @ambv ?

@hugovk
Copy link
Member

hugovk commented Apr 10, 2025

@bitdancer I've sent an invite to the email on your profile. Welcome!

ambv added a commit that referenced this pull request Jun 2, 2025
…ing (GH-122753) (GH-129111) (GH-132371)

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.

(cherry picked from commit 5aaf416)
(cherry picked from commit a4ef689)

Co-authored-by: R. David Murray <[email protected]>
Co-authored-by: Mike Edmunds <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

6 participants