Commit graph

112471 commits

Author SHA1 Message Date
Petr Viktorin
2a9273a0e4
[3.10] [CVE-2023-27043] gh-102988: Reject malformed addresses in email.parseaddr() (GH-111116) (#123768)
Detect email address parsing errors and return empty tuple to
indicate the parsing error (old API). Add an optional 'strict'
parameter to getaddresses() and parseaddr() functions. Patch by
Thomas Dwyer.

(cherry picked from commit 4a153a1d3b)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-Authored-By: Thomas Dwyer <github@tomd.tel>
2024-09-06 13:14:22 +02:00
Seth Michael Larson
0e006ce344
[3.10] gh-123678: Upgrade libexpat 2.6.3 (#123710)
(cherry picked from commit fdc04ad75a)
2024-09-05 14:27:33 +02:00
Jason R. Coombs
4633177a08
[3.10] gh-123693: Use platform-agnostic semantics when processing zipfile.Path.name. (#123694)
Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-09-05 11:15:03 +02:00
Jason R. Coombs
0aa1ee22ab
[3.10] gh-123270: Replaced SanitizedNames with a more surgical fix. (GH-123354) (#123426)
Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-09-04 22:41:39 +02:00
Miss Islington (bot)
d3f39cefe7
[3.10] gh-112275: Fix HEAD_LOCK deadlock in child process after fork (GH-112336) (#123687)
HEAD_LOCK is called from _PyEval_ReInitThreads->_PyThreadState_DeleteExcept before _PyRuntimeState_ReInitThreads reinit runtime->interpreters.mutex which might be locked before fork.

(cherry picked from commit 522799a05e)

Co-authored-by: ChuBoning <102216855+ChuBoning@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-04 19:26:29 +02:00
Steve Dower
2e861ac1cd
[3.10] gh-119690: Fixes buffer type confusion in _winapi.CreateFile and _winapi.CreateNamedPipe audit events (#119735)
gh-119690: Fixes buffer type confusion in _winapi.CreateFile and _winapi.CreateNamedPipe audit events
2024-09-04 17:57:40 +02:00
Miss Islington (bot)
b2f11ca766
[3.10] gh-123067: Fix quadratic complexity in parsing "-quoted cookie values with backslashes (GH-123075) (#123106)
This fixes CVE-2024-7592.
(cherry picked from commit 44e458357f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-04 17:50:36 +02:00
Serhiy Storchaka
2fa5d70684
[3.10] gh-67693: Fix urlunparse() and urlunsplit() for URIs with path starting with multiple slashes and no authority (GH-113563) (#119026)
(cherry picked from commit e237b25a4f)
2024-09-04 17:43:30 +02:00
Łukasz Langa
06f28dc236
[3.10] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122609)
Per RFC 2047:

> [...] these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects

It seems that the "quoted-word" scheme is a valid way to include
a newline character in a header value, just like we already allow
undecodable bytes or control characters.
They do need to be properly quoted when serialized to text, though.

This should fail for custom fold() implementations that aren't careful
about newlines.

(cherry picked from commit 0976339818)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Bas Bloemsaat <bas@bloemsaat.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-04 17:38:31 +02:00
Seth Michael Larson
743acbe872
[3.10] gh-121285: Remove backtracking when parsing tarfile headers (GH-121286) (#123640)
* Remove backtracking when parsing tarfile headers
* Rewrite PAX header parsing to be stricter
* Optimize parsing of GNU extended sparse headers v0.0

(cherry picked from commit 34ddb64d08)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-09-03 15:07:53 +00:00
Jason R. Coombs
e0264a6111
[3.10] gh-122905: Sanitize names in zipfile.Path. (GH-122906) (#123160)
[3.10] [3.11] gh-122905: Sanitize names in zipfile.Path. (GH-122906) (GH-122925)

* gh-122905: Sanitize names in zipfile.Path. (GH-122906)

Ported from zipp 3.19.1; ref jaraco/zippGH-119.

(cherry picked from commit 9cd0326310)

* [3.11] gh-122905: Sanitize names in zipfile.Path. (GH-122906)

Ported from zipp 3.19.1; ref jaraco/zippGH-119.
(cherry picked from commit 9cd0326310)

(cherry picked from commit 795f2597a4)
2024-08-23 00:24:33 +01:00
Miss Islington (bot)
31302f5fc2
[3.10] gh-122133: Rework pure Python socketpair tests to avoid use of importlib.reload. (GH-122493) (GH-122507)
(cherry picked from commit f071f01b7b)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-08-02 15:10:39 +02:00
Miss Islington (bot)
0b65c8bf53
[3.10] gh-122133: Authenticate socket connection for socket.socketpair() fallback (GH-122134) (#122427)
Authenticate socket connection for `socket.socketpair()` fallback when the platform does not have a native `socketpair` C API.  We authenticate in-process using `getsocketname` and `getpeername` (thanks to Nathaniel J Smith for that suggestion).

(cherry picked from commit 78df1043db)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-30 14:44:16 +02:00
Łukasz Langa
d86ab5dde2
[3.10] gh-121957: Emit audit events for python -i and python -m asyncio (GH-122119) 2024-07-22 13:48:50 +02:00
Ned Deily
48f9d3e3fa
[3.10] gh-112769: test_zlib: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771) (#119565)
[3.10] gh-112769: test_zlib: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok miro@hroncok.cz
2024-05-28 16:57:05 +01:00
Steve Dower
c8f868dc52
[3.10] gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) (GH-118740)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-24 19:26:44 +02:00
Dimitri John Ledkov
333c7dccd8
[3.10] gh-100454: Fix running SSL tests with OpenSSL 3.1+ (GH-100456) (GH-118262)
This fixes Ubuntu pipeline with OpenSSL 3.1+

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2024-05-07 12:00:40 +02:00
Petr Viktorin
c62c9e518b
[3.10] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177) (GH-118229)
The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] https://github.com/python/cpython/issues/61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2024-05-07 11:56:13 +02:00
Seth Michael Larson
2ec7018191
[3.10] gh-116741: Upgrade libexpat to 2.6.2 (GH-117296) (GH-118186)
(cherry picked from commit c9829eec08)
2024-05-07 10:50:19 +02:00
Miss Islington (bot)
9b33629f96
[3.10] gh-114539: Clarify implicit launching of shells by subprocess (GH-117996) (GH-118004)
(cherry picked from commit a4b44d39cd)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-07 10:47:46 +02:00
jkriegshauser
812245ecce
[3.10] gh-116773: Fix overlapped memory corruption crash (GH-116774) (GH-117079)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-03-27 16:24:34 +01:00
Miss Islington (bot)
0a263ccd1f
[3.10] gh-117187: Fix XML tests for vanilla Expat <2.6.0 (GH-117203) (GH-117246)
This fixes XML unittest fallout from the https://github.com/python/cpython/issues/115398 security fix.  When configured using `--with-system-expat` on systems with older pre 2.6.0 versions of libexpat, our unittests were failing.

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2024-03-27 14:44:58 +01:00
Łukasz Langa
83518b3511
Post 3.10.14 2024-03-20 00:40:17 +01:00
Łukasz Langa
976ea78599
Python 3.10.14 2024-03-19 22:46:16 +01:00
Miss Islington (bot)
eac14953a0
[3.10] gh-115197: Stop resolving host in urllib.request proxy bypass (GH-115210) (GH-116070)
Use of a proxy is intended to defer DNS for the hosts to the proxy itself, rather than a potential for information leak of the host doing DNS resolution itself for any reason.  Proxy bypass lists are strictly name based.  Most implementations of proxy support agree.
(cherry picked from commit c43b26d02e)

Co-authored-by: Weii Wang <weii.wang@canonical.com>
2024-03-19 11:53:33 +01:00
Sebastian Pipping
516a6d4237
[3.10] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623) (GH-116270)
Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:

- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`

Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 .

Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-03-07 00:02:55 +01:00
Miss Islington (bot)
b612ec6b19
[3.10] gh-115399: Document CVE-2023-52425 under "XML vulnerabilities" (GH-115400) (GH-115762)
Doc/library/xml.rst: Document CVE-2023-52425 under "XML vulnerabilities"
(cherry picked from commit fbd40ce46e)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2024-02-21 12:43:27 +01:00
Miss Islington (bot)
37324b421b
[3.10] gh-114572: Fix locking in cert_store_stats and get_ca_certs (GH-114573) (#115548)
gh-114572: Fix locking in cert_store_stats and get_ca_certs (GH-114573)

* gh-114572: Fix locking in cert_store_stats and get_ca_certs

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
https://github.com/openssl/openssl/pull/23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

* Work around const-correctness problem

* Add missing X509_STORE_get1_objects failure check

* Add blurb
(cherry picked from commit bce693111b)

Co-authored-by: David Benjamin <davidben@google.com>
2024-02-20 16:35:27 +00:00
Miss Islington (bot)
d0524caed0
[3.10] Upgrade bundled libexpat to 2.6.0 (GH-115399) (GH-115468) (#115473)
Manual backport due to code differences.
(cherry picked from commit e071b0d558)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-02-19 14:58:39 +00:00
Ned Deily
17a6533dbf
[3.10] gh-97032: avoid test_squeezer crash on macOS buildbots (#115508)
avoid test_squeezer crash on macOS buildbots
2024-02-19 13:43:38 +00:00
Miss Islington (bot)
d9c79e1364
[3.10] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164) (#115525)
gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164)

Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b343)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 13:38:49 +00:00
Miss Islington (bot)
6091fbda8b
[3.10] gh-105821: Use a raw f-string in test_httpservers.py (GH-105822) (#115519) 2024-02-16 01:06:00 +00:00
Miss Islington (bot)
0e7ff84038
[3.10] Add missing sections to blurbs (GH-114553) (#115338) 2024-02-14 13:23:26 +00:00
Łukasz Langa
c3108e1214
[3.10] gh-46968: Fix invalid reference to Sound eXchange (SoX) 12.17.7 license (GH-115094) (GH-115096)
(cherry picked from commit b39119916c)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-02-06 19:53:23 +01:00
Miss Islington (bot)
806e6ecb2f
[3.10] gh-111239: Update Windows build to use zlib 1.3.1 (GH-114877) (#115079)
gh-111239: Update Windows build to use zlib 1.3.1 (GH-114877)
(cherry picked from commit 618d7256e7)

Co-authored-by: Zachary Ware <zach@python.org>
2024-02-06 15:40:18 +01:00
Miss Islington (bot)
9afc6d102d
[3.10] gh-113659: Skip hidden .pth files (GH-113660) (GH-114145)
Skip .pth files with names starting with a dot or hidden file attribute.
(cherry picked from commit 74208ed0c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-01-18 14:39:30 +01:00
Miss Islington (bot)
1274896727
[3.10] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (GH-114185)
(cherry picked from commit 9dbfe2dc8e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-01-17 15:02:42 +01:00
Adam Turner
6661b228ba
[3.10] gh-114021: Pin various sphinxcontrib extensions to older versions (GH-114022) (GH-114038)
(cherry picked from commit 94b1d1fa38)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2024-01-17 14:50:24 +01:00
Miss Islington (bot)
30fe5d853b
[3.10] gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016) (GH-113914)
Raise BadZipFile when try to read an entry that overlaps with other entry or
central directory.
(cherry picked from commit 66363b9a7b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-17 14:50:10 +01:00
Serhiy Storchaka
8eaeefe49d
[3.10] gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930) (GH-112840)
(cherry picked from commit 81c16cd94e)

Co-authored-by: Søren Løvborg <sorenl@unity3d.com>
2024-01-17 14:49:56 +01:00
Miss Islington (bot)
32e7acdc05
[3.10] bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503) (GH-112599)
* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
(cherry picked from commit 0daf555c6f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2024-01-17 14:49:40 +01:00
Seth Michael Larson
b6535ea7ec
[3.10] gh-112160: Add 'regen-configure' make target (#112163)
Add 'regen-configure' make target
2023-11-20 23:38:10 +00:00
Łukasz Langa
6c2f34fa77
[3.10] gh-101180: Fix a bug where iso2022_jp_3 and iso2022_jp_2004 codecs read out of bounds (gh-111695) (gh-111779)
(cherry picked from commit c8faa3568a)

Co-authored-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
2023-11-06 15:46:20 +01:00
Steve Dower
dcb16c98be
[3.10] gh-109991: Update Windows build to use OpenSSL 1.1.1w (GH-110090)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2023-10-10 13:46:16 +02:00
Ned Deily
97ce15c5f8
[3.10] gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to use 1.1.1w, 3.0.11, and 3.1.3. (#110007)
gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to use 1.1.1w, 3.0.11, and 3.1.3.

(cherry picked from commit c88037d137)
2023-09-28 15:34:02 +01:00
Miss Islington (bot)
63a7f7765c
[3.10] gh-109002: Ensure only one wheel for each vendored package (GH-109003) (#109007)
Output with one wheel:
```
❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py
Verifying checksum for /Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl.
Expected digest: 7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be
Actual digest:   7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be
::notice file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Successfully verified the checksum of the pip wheel.
```

Output with two wheels:
```
❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py
::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl::Found more than one wheel for package pip.

::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Found more than one wheel for package pip.
```

Output without wheels:
```
❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py
::error file=::Could not find a pip wheel on disk.
```
(cherry picked from commit f8a047941f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-09-06 20:01:13 +02:00
Hugo van Kemenade
fc756f61b9
[3.10] CI: Bump GitHub Actions (GH-108879) (#108892)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-09-05 22:39:13 +02:00
Łukasz Langa
5970435b26
[3.10] Add a dummy .rtfd.yml file to silence invalid failing webhooks (#108908)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-09-05 17:08:51 +02:00
Pablo Galindo
fc382d3dd0 Post 3.10.13 2023-08-24 14:21:57 +01:00
Pablo Galindo
49965601d6 Python 3.10.13 2023-08-24 13:46:25 +01:00