Commit graph

109544 commits

Author SHA1 Message Date
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 ea232716d3)

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 c22a55c8b4)

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 762745a124)

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

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 46521826cb)

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 1cf3d78c92)
(cherry picked from commit 88fe8d701a)

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 30a6cc418a)

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 11f99323c2)

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 cb60b6131b)

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 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 d8ab0a4dfa)

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 d315722564)
(cherry picked from commit a6f6c3a3d6)

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 49f61068f4)

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 0e4e058602)

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 3e07f827b3)
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 11e3548fd1)

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 b9509ba7a9)

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 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 eed80458e8)

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
Miss Islington (bot)
77796d058e
[3.9] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944) (#97968)
The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls.
 Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a
 segfault if cpython is built with the macOS 13 SDK but run on an earlier
 version of macOS. Prevent this by adding runtime support for detection of
 these system calls ("weaklinking") as is done for other newer syscalls on
 macOS.
(cherry picked from commit 6d0a0191a4)

Co-authored-by: Ned Deily <nad@python.org>
2022-10-06 12:14:32 -07:00
Miss Islington (bot)
358b7a4454
[3.9] gh-96848: Fix -X int_max_str_digits option parsing (GH-96988) (GH-97574)
gh-96848: Fix -X int_max_str_digits option parsing (GH-96988)

Fix command line parsing: reject "-X int_max_str_digits" option with
no value (invalid) when the PYTHONINTMAXSTRDIGITS environment
variable is set to a valid limit.
(cherry picked from commit 41351662bc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-04 11:57:34 -07:00
Miss Islington (bot)
938223e8d1
[3.9] gh-96577: Fixes buffer overrun in _msi module (GH-96633) (GH-96657)
gh-96577: Fixes buffer overrun in _msi module (GH-96633)
(cherry picked from commit 4114bcc9ef)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-04 10:06:17 -07:00
Victor Stinner
41188134bd
[3.9] gh-95778: Mention sys.set_int_max_str_digits() in error message (#96874) (#96877)
When ValueError is raised if an integer is larger than the limit,
mention sys.set_int_max_str_digits() in the error message.

(cherry picked from commit e841ffc915)

Co-authored-by: Ned Deily <nad@python.org>
2022-10-04 10:05:45 -07:00
Miss Islington (bot)
9b409e418a
[3.9] gh-97005: Update libexpat from 2.4.7 to 2.4.9 (gh-97006) (gh-97012)
gh-97005: Update libexpat from 2.4.7 to 2.4.9 (gh-97006)

Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
(cherry picked from commit 10e3d398c3)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
Co-authored-by: Ned Deily <nad@python.org>
2022-10-04 10:04:33 -07:00
Miss Islington (bot)
f65f3a9daf
[3.9] gh-97616: list_resize() checks for integer overflow (GH-97617) (GH-97627)
gh-97616: list_resize() checks for integer overflow (GH-97617)

Fix multiplying a list by an integer (list *= int): detect the
integer overflow when the new allocated length is close to the
maximum size.  Issue reported by Jordan Limor.

list_resize() now checks for integer overflow before multiplying the
new allocated length by the list item size (sizeof(PyObject*)).
(cherry picked from commit a5f092f3c4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-04 10:01:10 -07:00
Miss Islington (bot)
d6ef6805b2
[3.9] gh-97612: Fix shell injection in get-remote-certificate.py (GH-97613) (GH-97632)
gh-97612: Fix shell injection in get-remote-certificate.py (GH-97613)

Fix a shell code injection vulnerability in the
get-remote-certificate.py example script. The script no longer uses a
shell to run "openssl" commands. Issue reported and initial fix by
Caleb Shortt.

Remove the Windows code path to send "quit" on stdin to the "openssl
s_client" command: use DEVNULL on all platforms instead.

Co-authored-by: Caleb Shortt <caleb@rgauge.com>
(cherry picked from commit 83a0f44ffd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-04 10:00:16 -07:00
Miss Islington (bot)
94dbdbbd40
[3.9] gh-87597: Document TimeoutExpired.stdout & .stderr types (GH-97685) (GH-97688)
This documents the behavior that has always been the case since timeout
support was introduced in Python 3.3.
(cherry picked from commit b05dd79649)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-10-04 09:59:07 -07:00
Jason R. Coombs
71edddea86
[3.9] gh-96845: Fix docs around importlib.abc.Traversable (GH-97515) (GH-97761)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2022-10-04 09:58:34 -07:00
Dong-hee Na
ac3d79c2a0
gh-97032: Set tkinter path for macOS CI (GH-97525) 2022-09-24 15:31:12 -04:00
Łukasz Langa
83886261fa
Post 3.9.14 2022-09-06 20:47:37 +02:00
Łukasz Langa
816066f497
Python 3.9.14 2022-09-06 19:26:16 +02:00
Gregory P. Smith
cec1e9dfd7
[3.9] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96502)
* Correctly pre-check for int-to-str conversion (#96537)

Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =)

The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact.

The justification for the current check. The C code check is:
```c
max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10
```

In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is:
$$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$

From this it follows that
$$\frac{M}{3L} < \frac{s-1}{10}$$
hence that
$$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$
So
$$2^{L(s-1)} > 10^M.$$
But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check.

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-09-05 11:21:03 +02:00
Shantanu
d348afa15d
[3.9] gh-91423: Remove bugs.python.org from bugs.rst (GH-91425) (GH-95614)
Co-authored-by: roy reznik <royreznik@gmail.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>.
(cherry picked from commit df81d2892e)
2022-08-04 18:14:04 +02:00
Miss Islington (bot)
03dc951316
gh-95280: Fix test_get_ciphers on systems without RSA key exchange (GH-95282) (GH-95323)
(cherry picked from commit 565403038b)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-29 17:20:06 +02:00
Dong-hee Na
7b8776511a
[3.9] gh-90359: Update documentation to follow PEP 495. (gh-94800). (gh-94835)
(cherry picked from commit 07374cce52)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-07-28 15:31:17 -04:00
Łukasz Langa
017080f0fa
[3.9] gh-94208: Add more TLS version/protocol checks for FreeBSD (GH-94347) (GH-95312)
Three test cases were failing on FreeBSD with latest OpenSSL.
(cherry picked from commit 1bc86c2625)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-27 23:43:02 +02:00
Miss Islington (bot)
cd0a59f1fa
gh-94821: Fix autobind of empty unix domain address (GH-94826) (GH-94875)
When binding a unix socket to an empty address on Linux, the socket is
automatically bound to an available address in the abstract namespace.

    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x0075499'

Since python 3.9, the socket is bound to the one address:

    >>> s.getsockname()
    b'\x00'

And trying to bind multiple sockets will fail with:

    Traceback (most recent call last):
      File "/home/nsoffer/src/cpython/Lib/test/test_socket.py", line 5553, in testAutobind
        s2.bind("")
    OSError: [Errno 98] Address already in use

Added 2 tests:
- Auto binding empty address on Linux
- Failing to bind an empty address on other platforms

Fixes f6b3a07b7d (bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866)
(cherry picked from commit c22f134211)

Co-authored-by: Nir Soffer <nsoffer@redhat.com>
2022-07-26 12:07:41 +02:00
Łukasz Langa
eff4aa5409
[3.9] gh-90355: Add isolated flag if currently isolated (GH-92857) (GH-94570)
Co-authored-by: Carter Dodd <carter.dodd@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit c8556bcf6c)
2022-07-05 18:06:57 +02:00
Miss Islington (bot)
224cd0c3bf
gh-81054: Document that SimpleHTTPRequestHandler follows symbolic links (GH-94416) (GH-94494)
(cherry picked from commit 80aaeabb8b)

Co-authored-by: Sam Ezeh <sam.z.ezeh@gmail.com>
2022-07-01 18:41:54 +02:00
Miss Islington (bot)
66f4593280
gh-91172: Create a workflow for verifying bundled pip and setuptools (GH-31885) (GH-94123)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
(cherry picked from commit d36954b7ea)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2022-06-22 15:58:16 +02:00
Miss Islington (bot)
defaa2b19a
gh-87389: Fix an open redirection vulnerability in http.server. (GH-93879) (GH-94093)
Fix an open redirection vulnerability in the `http.server` module when
an URI path starts with `//` that could produce a 301 Location header
with a misleading target.  Vulnerability discovered, and logic fix
proposed, by Hamza Avvan (@hamzaavvan).

Test and comments authored by Gregory P. Smith [Google].
(cherry picked from commit 4abab6b603)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-06-22 10:42:02 +02:00
Miss Islington (bot)
893adbf001
gh-91810: Fix regression with writing an XML declaration with encoding='unicode' (GH-93426) (GH-93791)
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode' and xml_declaration=None.

If file patch is passed to ElementTree.write() with encoding='unicode',
always open a new file in UTF-8.
(cherry picked from commit d7db9dc3cc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-16 12:16:30 +02:00
Miss Islington (bot)
e8f2fe355b
gh-83728: Add hmac.new default parameter deprecation (GH-91939) (GH-93546)
(cherry picked from commit 56b5daf159)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-06-06 19:10:56 +02:00
Miss Islington (bot)
95c9c2b9cb
gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) (#93147)
Also while there, clarify a few things about why we reduce the hash to 32 bits.

Co-authored-by: Eli Libman <eli@hyro.ai>
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit c1f5c903a7)
2022-05-24 10:52:49 +02:00
Miss Islington (bot)
a43f4e7487
bpo-46879: Fix incorrect sphinx object names in doc (GH-31615) (GH-92976)
(cherry picked from commit 2cdd57f119)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Martin Fischer <martin@push-f.com>
2022-05-19 18:03:55 +02:00