Skip to content

Commit b896b57

Browse files
mceplbmwiedemann
authored andcommitted
Update python315 to version 3.15.0~a3 / rev 5 via SR 1329830
https://build.opensuse.org/request/show/1329830 by user mcepl + anag_factory - Add CVE-2024-6923-follow-up-EOL-email-headers.patch which is a follow-up to the previous fix of CVE-2024-6923 further encoding EOL possibly hidden in email headers (bsc#1257181). - Add CVE-2025-11468-email-hdr-fold-comment.patch preserving parens when folding comments in email headers (bsc#1257029, CVE-2025-11468). - Add CVE-2026-0672-http-hdr-inject-cookie-Morsel.patch, which rejects control characters in http cookies (bsc#1257031, CVE-2026-0672). - Remodel python-3.3.0b1-fix_date_time_compiler.patch to be upstreamable (make it dependent on the environment variable $UNVERSIONED_COMPILER; gh#python/cpython#144121). - Rename skip-test_thread_time.patch to longer-time-test_thread_time.patch and replace its content with gh#python/cpython!143558 Petr Viktorin in g
1 parent 6b2ca12 commit b896b57

13 files changed

Lines changed: 535 additions & 41 deletions

‎packages/p/python315/.files‎

260 Bytes
Binary file not shown.

‎packages/p/python315/.rev‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,31 @@ with 20251123 (so 20251206 we have in Factory, should be
8282
covered).</comment>
8383
<requestid>1325861</requestid>
8484
</revision>
85+
<revision rev="5" vrev="3">
86+
<srcmd5>f02e6d5e05ca7668c81f84a379e98401</srcmd5>
87+
<version>3.15.0~a3</version>
88+
<time>1769793736</time>
89+
<user>anag_factory</user>
90+
<comment>- Add CVE-2024-6923-follow-up-EOL-email-headers.patch which is
91+
a follow-up to the previous fix of CVE-2024-6923 further
92+
encoding EOL possibly hidden in email headers (bsc#1257181).
93+
- Add CVE-2025-11468-email-hdr-fold-comment.patch preserving
94+
parens when folding comments in email headers (bsc#1257029,
95+
CVE-2025-11468).
96+
- Add CVE-2026-0672-http-hdr-inject-cookie-Morsel.patch, which
97+
rejects control characters in http cookies (bsc#1257031,
98+
CVE-2026-0672).
99+
100+
- Remodel python-3.3.0b1-fix_date_time_compiler.patch to be
101+
upstreamable (make it dependent on the environment variable
102+
$UNVERSIONED_COMPILER; gh#python/cpython#144121).
103+
104+
- Rename skip-test_thread_time.patch to
105+
longer-time-test_thread_time.patch and replace its content with
106+
gh#python/cpython!143558
107+
108+
Petr Viktorin in gh-121650.; CVE-2024-6923, bsc#1228780,
109+
bsc#1257181)</comment>
110+
<requestid>1329830</requestid>
111+
</revision>
85112
</revisionlist>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
From 1132e45e8b588cd89bd168583afa37ba7c9f0afa Mon Sep 17 00:00:00 2001
2+
From: Denis Ledoux <[email protected]>
3+
Date: Mon, 27 Oct 2025 17:47:59 +0100
4+
Subject: [PATCH 1/3] gh-144125: email: verify headers are sound in
5+
BytesGenerator
6+
7+
GH-122233 added an implementation to `Generator`
8+
to refuse to serialize (write) headers that
9+
are unsafely folded or delimited.
10+
11+
This revision adds the same implementation
12+
to `BytesGenerator`, so it gets the same safety protections
13+
for unsafely folded or delimited headers
14+
15+
Co-authored-by: Denis Ledoux <[email protected]>
16+
Co-authored-by: Petr Viktorin <[email protected]>
17+
Co-authored-by: Bas Bloemsaat <[email protected]>
18+
---
19+
Lib/email/generator.py | 12 +++++++++-
20+
Lib/test/test_email/test_generator.py | 4 ++-
21+
Lib/test/test_email/test_policy.py | 6 ++++-
22+
Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst | 4 +++
23+
4 files changed, 23 insertions(+), 3 deletions(-)
24+
create mode 100644 Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst
25+
26+
Index: Python-3.15.0a3/Lib/email/generator.py
27+
===================================================================
28+
--- Python-3.15.0a3.orig/Lib/email/generator.py 2026-01-27 17:26:06.289940190 +0100
29+
+++ Python-3.15.0a3/Lib/email/generator.py 2026-01-27 17:26:14.361081031 +0100
30+
@@ -22,6 +22,7 @@
31+
NLCRE = re.compile(r'\r\n|\r|\n')
32+
fcre = re.compile(r'^From ', re.MULTILINE)
33+
NEWLINE_WITHOUT_FWSP = re.compile(r'\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]')
34+
+NEWLINE_WITHOUT_FWSP_BYTES = re.compile(br'\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]')
35+
36+
37+
class Generator:
38+
@@ -429,7 +430,16 @@
39+
# This is almost the same as the string version, except for handling
40+
# strings with 8bit bytes.
41+
for h, v in msg.raw_items():
42+
- self._fp.write(self.policy.fold_binary(h, v))
43+
+ folded = self.policy.fold_binary(h, v)
44+
+ if self.policy.verify_generated_headers:
45+
+ linesep = self.policy.linesep.encode()
46+
+ if not folded.endswith(linesep):
47+
+ raise HeaderWriteError(
48+
+ f'folded header does not end with {linesep!r}: {folded!r}')
49+
+ if NEWLINE_WITHOUT_FWSP_BYTES.search(folded.removesuffix(linesep)):
50+
+ raise HeaderWriteError(
51+
+ f'folded header contains newline: {folded!r}')
52+
+ self._fp.write(folded)
53+
# A blank line always separates headers from body
54+
self.write(self._NL)
55+
56+
Index: Python-3.15.0a3/Lib/test/test_email/test_generator.py
57+
===================================================================
58+
--- Python-3.15.0a3.orig/Lib/test/test_email/test_generator.py 2026-01-27 17:26:08.009520772 +0100
59+
+++ Python-3.15.0a3/Lib/test/test_email/test_generator.py 2026-01-27 17:26:14.363103139 +0100
60+
@@ -313,7 +313,7 @@
61+
self.assertEqual(s.getvalue(), self.typ(expected))
62+
63+
def test_verify_generated_headers(self):
64+
- """gh-121650: by default the generator prevents header injection"""
65+
+ # gh-121650: by default the generator prevents header injection
66+
class LiteralHeader(str):
67+
name = 'Header'
68+
def fold(self, **kwargs):
69+
@@ -334,6 +334,8 @@
70+
71+
with self.assertRaises(email.errors.HeaderWriteError):
72+
message.as_string()
73+
+ with self.assertRaises(email.errors.HeaderWriteError):
74+
+ message.as_bytes()
75+
76+
77+
class TestBytesGenerator(TestGeneratorBase, TestEmailBase):
78+
Index: Python-3.15.0a3/Lib/test/test_email/test_policy.py
79+
===================================================================
80+
--- Python-3.15.0a3.orig/Lib/test/test_email/test_policy.py 2026-01-27 17:26:08.021649854 +0100
81+
+++ Python-3.15.0a3/Lib/test/test_email/test_policy.py 2026-01-27 17:26:14.363238384 +0100
82+
@@ -296,7 +296,7 @@
83+
policy.fold("Subject", subject)
84+
85+
def test_verify_generated_headers(self):
86+
- """Turning protection off allows header injection"""
87+
+ # Turning protection off allows header injection
88+
policy = email.policy.default.clone(verify_generated_headers=False)
89+
for text in (
90+
'Header: Value\r\nBad: Injection\r\n',
91+
@@ -319,6 +319,10 @@
92+
message.as_string(),
93+
f"{text}\nBody",
94+
)
95+
+ self.assertEqual(
96+
+ message.as_bytes(),
97+
+ f"{text}\nBody".encode(),
98+
+ )
99+
100+
# XXX: Need subclassing tests.
101+
# For adding subclassed objects, make sure the usual rules apply (subclass
102+
Index: Python-3.15.0a3/Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst
103+
===================================================================
104+
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
105+
+++ Python-3.15.0a3/Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst 2026-01-27 17:26:14.362392400 +0100
106+
@@ -0,0 +1,4 @@
107+
+:mod:`~email.generator.BytesGenerator` will now refuse to serialize (write) headers
108+
+that are unsafely folded or delimited; see
109+
+:attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas
110+
+Bloemsaat and Petr Viktorin in :gh:`121650`).
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
From 0b64fd5f8854703eb47ed89a3b0d472a13d0d651 Mon Sep 17 00:00:00 2001
2+
From: Denis Ledoux <[email protected]>
3+
Date: Thu, 6 Nov 2025 17:42:34 +0100
4+
Subject: [PATCH 1/5] email: correctly indent with a least one space folded
5+
comments
6+
7+
---
8+
Lib/email/_header_value_parser.py | 15 ++++++
9+
Lib/test/test_email/test__header_value_parser.py | 23 ++++++++++
10+
Misc/NEWS.d/next/Security/2026-01-16-14-40-31.gh-issue-143935.U2YtKl.rst | 6 ++
11+
3 files changed, 43 insertions(+), 1 deletion(-)
12+
13+
Index: Python-3.15.0a3/Lib/email/_header_value_parser.py
14+
===================================================================
15+
--- Python-3.15.0a3.orig/Lib/email/_header_value_parser.py 2026-01-29 13:44:51.429261309 +0100
16+
+++ Python-3.15.0a3/Lib/email/_header_value_parser.py 2026-01-29 13:45:04.109091639 +0100
17+
@@ -101,6 +101,12 @@
18+
return str(value).replace('\\', '\\\\').replace('"', '\\"')
19+
20+
21+
+def make_parenthesis_pairs(value):
22+
+ """Escape parenthesis and backslash for use within a comment."""
23+
+ return str(value).replace('\\', '\\\\') \
24+
+ .replace('(', '\\(').replace(')', '\\)')
25+
+
26+
+
27+
def quote_string(value):
28+
escaped = make_quoted_pairs(value)
29+
return f'"{escaped}"'
30+
@@ -943,7 +949,7 @@
31+
return ' '
32+
33+
def startswith_fws(self):
34+
- return True
35+
+ return self and self[0] in WSP
36+
37+
38+
class ValueTerminal(Terminal):
39+
@@ -2963,6 +2969,13 @@
40+
[ValueTerminal(make_quoted_pairs(p), 'ptext')
41+
for p in newparts] +
42+
[ValueTerminal('"', 'ptext')])
43+
+ if part.token_type == 'comment':
44+
+ newparts = (
45+
+ [ValueTerminal('(', 'ptext')] +
46+
+ [ValueTerminal(make_parenthesis_pairs(p), 'ptext')
47+
+ if p.token_type == 'ptext' else p
48+
+ for p in newparts] +
49+
+ [ValueTerminal(')', 'ptext')])
50+
if not part.as_ew_allowed:
51+
wrap_as_ew_blocked += 1
52+
newparts.append(end_ew_not_allowed)
53+
Index: Python-3.15.0a3/Lib/test/test_email/test__header_value_parser.py
54+
===================================================================
55+
--- Python-3.15.0a3.orig/Lib/test/test_email/test__header_value_parser.py 2026-01-29 13:44:53.065308861 +0100
56+
+++ Python-3.15.0a3/Lib/test/test_email/test__header_value_parser.py 2026-01-29 13:45:04.109478618 +0100
57+
@@ -3294,6 +3294,29 @@
58+
with self.subTest(to=to):
59+
self._test(parser.get_address_list(to)[0], folded, policy=policy)
60+
61+
+ def test_address_list_with_long_unwrapable_comment(self):
62+
+ policy = self.policy.clone(max_line_length=40)
63+
+ cases = [
64+
+ # (to, folded)
65+
+ ('(loremipsumdolorsitametconsecteturadipi)<[email protected]>',
66+
+ '(loremipsumdolorsitametconsecteturadipi)<[email protected]>\n'),
67+
+ ('<[email protected]>(loremipsumdolorsitametconsecteturadipi)',
68+
+ '<[email protected]>(loremipsumdolorsitametconsecteturadipi)\n'),
69+
+ ('(loremipsum dolorsitametconsecteturadipi)<[email protected]>',
70+
+ '(loremipsum dolorsitametconsecteturadipi)<[email protected]>\n'),
71+
+ ('<[email protected]>(loremipsum dolorsitametconsecteturadipi)',
72+
+ '<[email protected]>(loremipsum\n dolorsitametconsecteturadipi)\n'),
73+
+ ('(Escaped \\( \\) chars \\\\ in comments stay escaped)<[email protected]>',
74+
+ '(Escaped \\( \\) chars \\\\ in comments stay\n escaped)<[email protected]>\n'),
75+
+ ('((loremipsum)(loremipsum)(loremipsum)(loremipsum))<[email protected]>',
76+
+ '((loremipsum)(loremipsum)(loremipsum)(loremipsum))<[email protected]>\n'),
77+
+ ('((loremipsum)(loremipsum)(loremipsum) (loremipsum))<[email protected]>',
78+
+ '((loremipsum)(loremipsum)(loremipsum)\n (loremipsum))<[email protected]>\n'),
79+
+ ]
80+
+ for (to, folded) in cases:
81+
+ with self.subTest(to=to):
82+
+ self._test(parser.get_address_list(to)[0], folded, policy=policy)
83+
+
84+
# XXX Need tests with comments on various sides of a unicode token,
85+
# and with unicode tokens in the comments. Spaces inside the quotes
86+
# currently don't do the right thing.
87+
Index: Python-3.15.0a3/Misc/NEWS.d/next/Security/2026-01-16-14-40-31.gh-issue-143935.U2YtKl.rst
88+
===================================================================
89+
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
90+
+++ Python-3.15.0a3/Misc/NEWS.d/next/Security/2026-01-16-14-40-31.gh-issue-143935.U2YtKl.rst 2026-01-29 13:45:04.109846601 +0100
91+
@@ -0,0 +1,6 @@
92+
+Fixed a bug in the folding of comments when flattening an email message
93+
+using a modern email policy. Comments consisting of a very long sequence of
94+
+non-foldable characters could trigger a forced line wrap that omitted the
95+
+required leading space on the continuation line, causing the remainder of
96+
+the comment to be interpreted as a new header field. This enabled header
97+
+injection with carefully crafted inputs.

0 commit comments

Comments
 (0)