Skip to content

gh-144125: email: verify headers are sound in BytesGenerator - #144126

Merged
sethmlarson merged 3 commits into
python:mainfrom
sethmlarson:email-verify-headers-in-bytesgenerator
Jan 23, 2026
Merged

gh-144125: email: verify headers are sound in BytesGenerator#144126
sethmlarson merged 3 commits into
python:mainfrom
sethmlarson:email-verify-headers-in-bytesgenerator

Conversation

@sethmlarson

@sethmlarsonsethmlarson commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

GH-122233 added an implementation to Generator to refuse to serialize (write) headers that are unsafely folded or delimited.

This revision adds the same implementation to BytesGenerator, so it gets the same safety protections for unsafely folded or delimited headers

@sethmlarson
sethmlarson requested a review from a team as a code ownerJanuary 21, 2026 19:15
@sethmlarsonsethmlarson added type-security A security issue stdlib Standard Library Python modules in the Lib/ directory topic-email labels Jan 21, 2026
pythonGH-122233 added an implementation to `Generator`
to refuse to serialize (write) headers that
are unsafely folded or delimited.
This revision adds the same implementation
to `BytesGenerator`, so it gets the same safety protections
for unsafely folded or delimited headers
Co-authored-by: Denis Ledoux <5822488+beledouxdenis@users.noreply.github.com>
Co-authored-by: Petr Viktorin <302922+encukou@users.noreply.github.com>
Co-authored-by: Bas Bloemsaat <1586868+basbloemsaat@users.noreply.github.com>
@sethmlarson
sethmlarsonforce-pushed the email-verify-headers-in-bytesgenerator branch from cd41a69 to 1132e45CompareJanuary 21, 2026 19:17
Comment threadLib/test/test_email/test_generator.py
Comment threadLib/test/test_email/test_policy.py
@bedevere-app

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

@sethmlarson

Copy link
Copy Markdown
ContributorAuthor

@bitdancer I have made the requested changes; please review again

@bedevere-app

Copy link
Copy Markdown

Thanks for making the requested changes!

@bitdancer: please review the changes made to this pull request.

@sethmlarson
sethmlarson merged commit 052e55e into python:mainJan 23, 2026
92 of 100 checks passed
@sethmlarson
sethmlarson deleted the email-verify-headers-in-bytesgenerator branch January 23, 2026 14:59
@sethmlarsonsethmlarson added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jan 23, 2026
@sethmlarsonsethmlarson added the needs backport to 3.14 bugs and security fixes label Jan 23, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @sethmlarson for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @sethmlarson for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @sethmlarson for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@sethmlarsonsethmlarson added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes and removed needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jan 23, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @sethmlarson for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @sethmlarson for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-securityA security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@sethmlarson@bitdancer@hugovk@beledouxdenis