109570 Commits

Author SHA1 Message Date
Łukasz Langa
376d66eb50
Python 3.9.18 v3.9.18 2023-08-24 19:59:28 +02:00
Łukasz Langa
92f9ce726b
Fix invalid string escape 2023-08-24 19:44:27 +02:00
Łukasz Langa
d2cd0a3acb
[3.9] gh-108342: Make ssl TestPreHandshakeClose more reliable (GH-108370) (#108407)
* In preauth tests of test_ssl, explicitly break reference cycles
  invoving SingleConnectionTestServerThread to make sure that the
  thread is deleted. Otherwise, the test marks the environment as
  altered because the threading module sees a "dangling thread"
  (SingleConnectionTestServerThread). This test leak was introduced
  by the test added for the fix of issue gh-108310.
* Use support.SHORT_TIMEOUT instead of hardcoded 1.0 or 2.0 seconds
  timeout.
* SingleConnectionTestServerThread.run() catchs TimeoutError
* Fix a race condition (missing synchronization) in
  test_preauth_data_to_tls_client(): the server now waits until the
  client connect() completed in call_after_accept().
* test_https_client_non_tls_response_ignored() calls server.join()
  explicitly.
* Replace "localhost" with server.listener.getsockname()[0].
(cherry picked from commit 592bacb6fc0833336c0453e818e9b95016e9fd47)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-24 12:09:11 +02:00
Miss Islington (bot)
b8058b3da5
[3.9] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108351)
Explicitly break a reference cycle when SSLSocket._create() raises an
exception. Clear the variable storing the exception, since the
exception traceback contains the variables and so creates a reference
cycle.

This test leak was introduced by the test added for the fix of GH-108310.
(cherry picked from commit 64f99350351bc46e016b2286f36ba7cd669b79e3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-23 12:10:49 +02:00
Ned Deily
d31ae21e5d
[3.9] gh-107565: Update multissltests and GitHub CI workflows to use OpenSSL 1.1.1v, 3.0.10, and 3.1.2. (#108123)
[3.9] gh-107565: Update multissltests and GitHub CI workflows to use  OpenSSL 1.1.1v, 3.0.10, and 3.1.2.

(cherry picked from commit 441797d4ffb12acda257370b9e5e19ed8d6e8a71)
2023-08-22 20:28:57 +02:00
Petr Viktorin
42deeab5b2
[3.9] gh-107845: Fix symlink handling for tarfile.data_filter (GH-107846) (#108274)
(cherry picked from commit acbd3f9c5c5f23e95267714e41236140d84fe962)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
2023-08-22 20:28:10 +02:00
Serhiy Storchaka
4a79328195
[3.9] gh-99612: Fix PyUnicode_DecodeUTF8Stateful() for ASCII-only data (GH-99613) (GH-107224) (#107231)
Previously *consumed was not set in this case.
(cherry picked from commit f08e52ccb027f6f703302b8c1a82db9fd3934270).
(cherry picked from commit b8b3e6afc0a48c3cbb7c36d2f73e332edcd6058c)
2023-08-22 20:25:15 +02:00
Łukasz Langa
264b1dacc6
[3.9] gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw (#108320)
gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw

Instances of `ssl.SSLSocket` were vulnerable to a bypass of the TLS handshake
and included protections (like certificate verification) and treating sent
unencrypted data as if it were post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is sent by the
malicious peer and stored in a buffer, and then the malicious peer closes the
socket within a small timing window before the other peers’ TLS handshake can
begin. After this sequence of events the closed socket will not immediately
attempt a TLS handshake due to not being connected but will also allow the
buffered data to be read as if a successful TLS handshake had occurred.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-08-22 19:57:10 +02:00
Erlend E. Aasland
38b489bae8
[3.9] CI: Bump macOS build to use OpenSSL v3.0 (GH-105538) (#105871)
(cherry picked from commit 34e93d3998bab8acd651c50724eb1977f4860a08)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-07-05 13:20:44 +02:00
Miss Islington (bot)
ce93371488
[3.9] [3.11] Add single value agen.athrow(value) signature to the 3.11 docs gh-105269 (GH-105468) (#105477)
(cherry picked from commit acf3916e84158308660ed07c474a564e045d6884)

Co-authored-by: Federico Caselli <CaselIT@users.noreply.github.com>
2023-07-05 13:18:49 +02:00
Łukasz Langa
1528b420b3
Post 3.9.17 2023-06-06 14:17:01 +02:00
Łukasz Langa
0d3cd4eb66
Python 3.9.17 v3.9.17 2023-06-06 11:32:53 +02:00
Miss Islington (bot)
e1c396d164
[3.9] gh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (GH-105185) (#105221)
(cherry picked from commit ee26ca13a129da8cf549409d0a1b2e892ff2b4ec)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-06-05 17:42:16 +02:00
Gregory P. Smith
e15de14c16
[3.9] gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (GH-105174) (GH-105200) (#105205)
Upgrade builds to OpenSSL 1.1.1u.

Also updates _ssl_data_111.h from OpenSSL 1.1.1u, _ssl_data_300.h from 3.0.9.

Manual edits to the _ssl_data_300.h file prevent it from removing any
existing definitions in case those exist in some peoples builds and were
important (avoiding regressions during backporting).

(cherry picked from commit ede89af)

Co-authored-by: Ned Deily <nad@python.org>
2023-06-05 17:41:51 +02:00
Ned Deily
c9bf00b1ad
[3.9] Update GitHub CI workflow for macOS. (GH-105303) 2023-06-05 02:23:32 -04:00
Ned Deily
89507d5378
[3.9] gh-68966: fix versionchanged in docs (GH-105298) 2023-06-04 23:56:15 -04:00
Miss Islington (bot)
d7f8a5fe07
[3.9] gh-102153: Start stripping C0 control and space chars in urlsplit (GH-102508) (GH-104575) (GH-104592) (#104593)
gh-102153: Start stripping C0 control and space chars in `urlsplit` (GH-102508)

`urllib.parse.urlsplit` has already been respecting the WHATWG spec a bit GH-25595.

This adds more sanitizing to respect the "Remove any leading C0 control or space from input" [rule](https://url.spec.whatwg.org/GH-url-parsing:~:text=Remove%20any%20leading%20and%20trailing%20C0%20control%20or%20space%20from%20input.) in response to [CVE-2023-24329](https://nvd.nist.gov/vuln/detail/CVE-2023-24329).

I simplified the docs by eliding the state of the world explanatory
paragraph in this security release only backport.  (people will see
that in the mainline /3/ docs)

(cherry picked from commit 2f630e1ce18ad2e07428296532a68b11dc66ad10)
(cherry picked from commit 610cc0ab1b760b2abaac92bd256b96191c46b941)
(cherry picked from commit f48a96a28012d28ae37a2f4587a780a5eb779946)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2023-05-22 12:42:37 +02:00
Miss Islington (bot)
3d5dd1eee2
[3.9] gh-99889: Fix directory traversal security flaw in uu.decode() (GH-104096) (#104331)
(cherry picked from commit 0aeda297931820436a50b78f4f7f0597274b5df4)

Co-authored-by: Sam Carroll <70000253+samcarroll42@users.noreply.github.com>
2023-05-22 12:41:30 +02:00
Miss Islington (bot)
b53d0ff431
[3.9] gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (GH-104067) (#104120)
Do not expose the local server's on-disk location from `SimpleHTTPRequestHandler` when generating a directory index. (unnecessary information disclosure)

(cherry picked from commit c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-22 12:40:50 +02:00
Steve Dower
d1645ce4f1
[3.9] gh-103935: Use io.open_code() when executing code in trace and profile modules (GH-103947) (#103953)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-05-22 12:40:30 +02:00
Petr Viktorin
98016f7c92
[3.9] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (GH-102953) (#104382)
Backport of c8c3956d905e019101038b018129a4c90c9c9b8f
2023-05-15 18:53:58 +02:00
Kumar Aditya
7cb3a44747
[3.9] GH-102126: fix deadlock at shutdown when clearing thread states (GH-102222) (#102236)
(cherry picked from commit 5f11478ce7fda826d399530af4c5ca96c592f144)
2023-03-28 10:55:36 +02:00
Pradyun Gedam
b5a94301a2
[3.9] gh-101997: Update bundled pip version to 23.0.1 (GH-101998). (#102243)
(cherry picked from commit 89d9ff0f48c51a85920c7372a7df4a2204e32ea5)
2023-03-28 10:52:56 +02:00
Miss Islington (bot)
cb0b009cfb
[3.9] gh-102627: Replace address pointing toward malicious web page (GH-102630) (GH-102666)
(cherry picked from commit 61479d46848bc7a7f9b571b0b09c4a4b4436d839)

Co-authored-by: Blind4Basics <32236948+Blind4Basics@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-03-13 19:28:36 -04:00
Steve Dower
bf99e19b99
[3.9] gh-101726: Update the OpenSSL version to 1.1.1t (GH-101727) (GH-101751)
Fixes CVE-2023-0286 (High) and a couple of Medium security issues.
https://www.openssl.org/news/secadv/20230207.txt

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Ned Deily <nad@python.org>
2023-03-07 18:01:22 -05:00
Dong-hee Na
c25b484e82
[3.9] gh-101981: Fix Ubuntu SSL tests with OpenSSL (3.1.0-beta1) CI i… (#102094)
[3.9] gh-101981: Fix Ubuntu SSL tests with OpenSSL (3.1.0-beta1) CI issue (gh-102079)
2023-02-21 17:33:23 +01:00
Miss Islington (bot)
04cc427025
[3.9] gh-101283: Improved fallback logic for subprocess with shell=True on Windows (GH-101286) (#101709)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2023-02-09 10:59:40 +01:00
Miss Islington (bot)
c33aaa9d55
gh-101422: (docs) TarFile default errorlevel argument is 1, not 0 (GH-101424)
(cherry picked from commit ea232716d3de1675478db3a302629ba43194c967)

Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
2023-01-30 10:21:08 -08:00
Miss Islington (bot)
044fb4fb53
[3.9] Bump Azure Pipelines to ubuntu-22.04 (GH-101089) (#101214)
(cherry picked from commit c22a55c8b4f142ff679880ec954691d5920b7845)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-01-21 20:38:52 +01:00
Steve Dower
fcfa505b80
[3.9] gh-100180: Update Windows installer to OpenSSL 1.1.1s (GH-100903) (#100904) 2023-01-20 23:22:50 +01:00
Kumar Aditya
6954203c9f
[3.9] GH-100892: Fix race in clearing threading.local (GH-100922) (#100939)
[3.9] [3.10] GH-100892: Fix race in clearing `threading.local` (GH-100922).
(cherry picked from commit 762745a124cbc297cf2fe6f3ec9ca1840bb2e873)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 683e9fe30ecd024f5508b2a33316752870100a96)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-20 23:21:40 +01:00
Éric
6be2e0e247
[3.9] gh-95778: add doc missing in some places (GH-100627). (#101066)
(cherry picked from commit 46521826cb1883e29e4640f94089dd92c57efc5b)

Co-authored-by: Éric <earaujo@caravan.coop>
2023-01-20 23:21:00 +01:00
Gregory P. Smith
cf71e19297
[3.9] Correct CVE-2020-10735 documentation (GH-100306). (#100697)
(cherry picked from commit 1cf3d78c92eb07dc09d15cc2e773b0b1b9436825)
(cherry picked from commit 88fe8d701af3316c8869ea18ea1c7acec6f68c04)

Co-authored-by: Jeremy Paige <ucodery@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-01-20 23:20:32 +01:00
Miss Islington (bot)
5ef90eebfd
[3.9] Update copyright year in README (GH-100863) (GH-100865) (GH-100866)
(cherry picked from commit 30a6cc418a60fccb91ba574b552203425e594c47)

Co-authored-by: Ned Deily <nad@python.org>
Co-authored-by: HARSHA VARDHAN <75431678+Thunder-007@users.noreply.github.com>
2023-01-08 22:11:49 -05:00
Benjamin Peterson
08210c62e9
[3.9] Update copyright years to 2023. (gh-100851)
* [3.9] Update copyright years to 2023. (gh-100848).
(cherry picked from commit 11f99323c2ae0ec428c370a335695e3d8d4afc1d)

Co-authored-by: Benjamin Peterson <benjamin@python.org>

* Update additional copyright years to 2023.

Co-authored-by: Ned Deily <nad@python.org>
2023-01-08 17:00:10 -06:00
Miss Islington (bot)
e8f61ede93
Clarify that every thread has its own default context in contextvars (GH-99246)
(cherry picked from commit cb60b6131bc2bb11c48a15f808914d8b242b9fc5)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-12-20 03:57:08 -08:00
Łukasz Langa
db577e29a6
Post 3.9.16 2022-12-06 19:50:26 +01:00
Łukasz Langa
595f9ccb0c
Python 3.9.16 v3.9.16 2022-12-06 18:59:46 +01:00
Miss Islington (bot)
3b81c13ac3
[3.9] gh-100001: Omit control characters in http.server stderr logs. (GH-100002) (#100032)
* gh-100001: Omit control characters in http.server stderr logs. (GH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4dfa48f881b4ac9ab857d2e9de42f72828)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

* also escape \s (backport of PR #100038).

* add versionadded and remove extra 'to'

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-12-06 11:22:12 +01:00
Steve Dower
7b98207aa4
[3.9] gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373) (GH-99493) 2022-11-21 19:13:33 +01:00
Miss Islington (bot)
c09dba57cf
[3.9] gh-98433: Fix quadratic time idna decoding. (GH-99092) (GH-99222) (#99230)
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722564927c7202dd6e111dc79eaf14240b0d)
(cherry picked from commit a6f6c3a3d6f2b580f2d87885c9b8a9350ad7bf15)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-10 16:57:41 +01:00
Miss Islington (bot)
b43496c01a
[3.9] gh-97514: Don't use Linux abstract sockets for multiprocessing (GH-98501) (#98504)
Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
https://github.com/python/cpython/pull/18866 while fixing
https://github.com/python/cpython/issues/84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f61068f49747164988ffc5a442d2a63874fc17)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-10-28 12:08:30 +02:00
Miss Islington (bot)
857efee6d2
[3.9] gh-98517: Fix buffer overflows in _sha3 module (GH-98519) (#98526)
This is a port of the applicable part of XKCP's fix [1] for
CVE-2022-37454 and avoids the segmentation fault and the infinite
loop in the test cases published in [2].

[1]: fdc6fef075
[2]: https://mouha.be/sha-3-buffer-overflow/

Regression test added by: Gregory P. Smith [Google LLC] <greg@krypto.org>
(cherry picked from commit 0e4e058602d93b88256ff90bbef501ba20be9dd3)

Co-authored-by: Theo Buehler <botovq@users.noreply.github.com>
2022-10-28 12:08:06 +02:00
Miss Islington (bot)
71a075aaee
[3.9] gh-98739: Update libexpat from 2.4.9 to 2.5.0 (GH-98742) (#98786)
Update libexpat from 2.4.9 to 2.5.0 to address CVE-2022-43680.

Co-authored-by: Shaun Walbridge <shaun.walbridge@gmail.com>
(cherry picked from commit 3e07f827b359617664ad0880f218f17ae4483299)
2022-10-28 12:07:32 +02:00
Miss Islington (bot)
157a8b8edd
[3.9] gh-96710: Make the test timing more lenient for the int/str DoS regression test. (GH-96717) (#98196)
gh-96710: Make the test timing more lenient for the int/str DoS regression test. (GH-96717)

A regression would still absolutely fail and even a flaky pass isn't
harmful as it'd fail most of the time across our N system test runs.

Windows has a low resolution timer and CI systems are prone to odd
timing so this just gives more leeway to avoid flakiness.
(cherry picked from commit 11e3548fd1d3445ccde971d613633b58d73c3016)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-10-11 23:13:54 +02:00
Miss Islington (bot)
c59a16e2c7
[3.9] gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993) (#98190)
gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993)
(cherry picked from commit b9509ba7a9c668b984dab876c7926fe1dc5aa0ba)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2022-10-11 23:13:18 +02:00
Łukasz Langa
bd4e5320e5
Post 3.9.15 2022-10-11 17:38:29 +02:00
Łukasz Langa
7e28154196
Python 3.9.15 v3.9.15 2022-10-11 16:48:37 +02:00
Miss Islington (bot)
1db2d95284
[3.9] gh-91708: Revert params note in urllib.parse.urlparse table (GH-96699) (#98054)
Revert params note in urllib.parse.urlparse table
(cherry picked from commit eed80458e8e776d15fa862da71dcce58c47e2ca7)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-10-07 13:53:39 -07:00
Łukasz Langa
da1fe3873a
[3.9] gh-94208: Add even more TLS version/protocol checks for FreeBSD (#98037)
Otherwise, buildbot builds would fail since there's no TLS 1.0/1.1 support.
2022-10-07 11:49:28 -07:00