gh-143935: Email preserve parens when folding comments (#143936)
authorSeth Michael Larson <seth@python.org>
Mon, 19 Jan 2026 12:38:22 +0000 (06:38 -0600)
committerArnaud Rebillout <arnaudr@debian.org>
Thu, 14 May 2026 03:00:00 +0000 (10:00 +0700)
commiteee1a472da2720685ab980c6d9c00b74cdcdc85a
tree643280a6e3d7b07674c879264819a73dba9a0682
parent18a4a9a7eb43dde6a7e0c18926c1dcd68ed1a363
gh-143935: Email preserve parens when folding comments (#143936)

Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.

Co-authored-by: Denis Ledoux <dle@odoo.com>
Origin: backport, https://github.com/python/cpython/commit/17d1490aa97bd6b98a42b1a9b324ead84e7fd8a2

Gbp-Pq: Name CVE-2025-11468.patch
Lib/email/_header_value_parser.py
Lib/test/test_email/test__header_value_parser.py
Misc/NEWS.d/next/Security/2026-01-16-14-40-31.gh-issue-143935.U2YtKl.rst [new file with mode: 0644]