Commit Graph

99710 Commits

Author SHA1 Message Date
Dong-hee Na 415c4a1270
[3.6] Bring Python into the new year. (GH-24036). (GH-24054)
(cherry picked from commit de6f20a6de)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-01-02 00:27:18 -05:00
Miss Islington (bot) 546baba63a
bpo-42794: Update test_nntplib to use offical group name for testing (GH-24037) (GH-24042)
(cherry picked from commit ec3165320e)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-01-01 13:42:16 -05:00
Miss Islington (bot) 8bef9ebb1b
bpo-40791: Make compare_digest more constant-time. (GH-23438) (GH-23767)
The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.

(This is change GH-1 from https://bugs.python.org/issue40791 .)
(cherry picked from commit 31729366e2)

Co-authored-by: Devin Jeanpierre <jeanpierreda@google.com>
2020-12-14 12:04:57 -05:00
Miss Islington (bot) dae5d728bc
bpo-35560: Remove assertion from format(float, "n") (GH-11288) (GH-23231)
Fix an assertion error in format() in debug build for floating point
formatting with "n" format, zero padding and small width. Release build is
not impacted. Patch by Karthikeyan Singaravelan.
(cherry picked from commit 3f7983a25a)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2020-11-10 14:58:27 -05:00
Serhiy Storchaka a63234c49b
[3.6] bpo-42103: Improve validation of Plist files. (GH-22882) (GH-23118)
* Prevent some possible DoS attacks via providing invalid Plist files
  with extremely large number of objects or collection sizes.
* Raise InvalidFileException for too large bytes and string size instead of returning garbage.
* Raise InvalidFileException instead of ValueError for specific invalid datetime (NaN).
* Raise InvalidFileException instead of TypeError for non-hashable dict keys.
* Add more tests for invalid Plist files..
(cherry picked from commit 34637a0ce2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-11-10 14:57:32 -05:00
larryhastings a75c4c924d
[3.6] Remove 3.5 from Doc version switcher in master. (GH-22886) (#22891)
(cherry picked from commit 283f9a253b)
2020-10-22 08:55:36 -07:00
Miss Skeleton (bot) e912e945f2
bpo-41944: No longer call eval() on content received via HTTP in the CJK codec tests (GH-22566) (GH-22579)
(cherry picked from commit 2ef5caa58f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-10-20 00:46:10 -04:00
Miss Skeleton (bot) a158fb9c51
bpo-42051: Reject XML entity declarations in plist files (GH-22760) (GH-22801) (GH-22804)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
(cherry picked from commit e512bc799e)

Co-authored-by: Ned Deily <nad@python.org>
2020-10-20 00:38:30 -04:00
Ned Deily a69002ce6c
Disable macOS CI tests in azure-pipelines (GH-22639) 2020-10-20 00:18:00 -04:00
Ned Deily aed26482c7
Post release updates 2020-08-17 18:20:24 -04:00
Ned Deily c0a9afe2ac
3.6.12 2020-08-15 02:43:26 -04:00
Miss Islington (bot) f02de961b9
bpo-39603: Prevent header injection in http methods (GH-18485) (GH-21539)
reject control chars in http method in http.client.putrequest to prevent http header injection
(cherry picked from commit 8ca8a2e8fb)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
2020-07-19 05:28:45 -04:00
Miss Islington (bot) 47a2955589
bpo-39017: Avoid infinite loop in the tarfile module (GH-21454) (#21485)
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
(cherry picked from commit 5a8d121a1f)

Co-authored-by: Rishi <rishi_devan@mail.com>
2020-07-15 08:36:36 -04:00
Miss Islington (bot) 6463cf07fe
bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458) (GH-21462)
Automerge-Triggered-By: @tiran
(cherry picked from commit 4f309abf55)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-13 14:18:04 -04:00
Steve Dower 46cbf6148a
[3.6] bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21298) (#21354)
* bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21298)

* bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded.

* Add CVE number

* Updates for 3.6
2020-07-06 14:55:43 -04:00
Tapas Kundu cfc7ff8d05
[3.6] bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033) (GH-21232)
CVE-2020-14422
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
(cherry picked from commit b30ee26e36)

Co-authored-by: Ravi Teja P <rvteja92@gmail.com>

Signed-off-by: Tapas Kundu <tkundu@vmware.com>
2020-06-30 15:30:22 -04:00
Ned Deily 2fce023588
Post release updates 2020-06-27 08:38:30 -04:00
Ned Deily d56cd4006a
3.6.11 2020-06-27 05:14:00 -04:00
Ned Deily 93514bd244
Post release update 2020-06-17 23:54:25 -04:00
Ned Deily d384df407e
3.6.11rc1 2020-06-17 06:59:51 -04:00
Miss Islington (bot) 7df32f844e
bpo-39073: validate Address parts to disallow CRLF (GH-19007) (#19224)
Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks.
(cherry picked from commit 614f17211c)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
2020-05-27 19:17:52 -04:00
Rafael Fontenelle 763b193c96
Add pt-br switcher to the Documentation website (GH-20301) 2020-05-23 04:00:10 -04:00
Miss Islington (bot) f5c1089595
Doc: Python 3.10 in sidebar and version switcher. (GH-20209) (GH-20224)
(cherry picked from commit 19e3e00264)

Co-authored-by: Julien Palard <julien@palard.fr>

Co-authored-by: Julien Palard <julien@palard.fr>
2020-05-19 08:34:55 -04:00
Victor Stinner 69cdeeb93e
bpo-39503: CVE-2020-8492: Fix AbstractBasicAuthHandler (GH-18284) (GH-19304)
The AbstractBasicAuthHandler class of the urllib.request module uses
an inefficient regular expression which can be exploited by an
attacker to cause a denial of service. Fix the regex to prevent the
catastrophic backtracking. Vulnerability reported by Ben Caller
and Matt Schwager.

AbstractBasicAuthHandler of urllib.request now parses all
WWW-Authenticate HTTP headers and accepts multiple challenges per
header: use the realm of the first Basic challenge.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 0b297d4ff1)
2020-04-02 21:15:56 -04:00
Victor Stinner ebeabb5b72
bpo-40156: Copy Codecov configuration from master (GH-19306)
Disable "Codevov patch" job on pull requests.
2020-04-02 20:34:04 -04:00
Miss Islington (bot) 83fc70159b
bpo-38576: Disallow control characters in hostnames in http.client (GH-18995) (GH-19002)
Add host validation for control characters for more CVE-2019-18348 protection.
(cherry picked from commit 9165addc22)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
2020-03-14 18:35:52 -04:00
Miss Islington (bot) 6b6756f128
bpo-39869: Fix typo in 'Instance objects' section. (GH-18889) (GH-18898)
(cherry picked from commit e5e56328af)

Co-authored-by: Antoine <43954001+awecx@users.noreply.github.com>
2020-03-14 18:17:10 -04:00
Serhiy Storchaka cebe9ee988
bpo-39545: Document restrictions on "await" and "async for" in f-strings. (GH-18459) 2020-02-13 18:53:59 -05:00
Elena Oat a2963f0962
bpo-39545: docs: do not use await in f-strings (GH-18434) 2020-02-10 15:28:11 -05:00
Miss Islington (bot) c352e6c744
closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18350)
When called on a closed object, readinto() segfaults on account
of a write to a freed buffer:

    ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core
    ==220553==  Access not within mapped region at address 0x2A
    ==220553==    at 0x48408A0: memmove (vg_replace_strmem.c:1272)
    ==220553==    by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972)
    ==220553==    by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053)
    ==220553==    by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253)

Reproducer:

    reader = open ("/dev/zero", "rb")
    _void  = reader.read (42)
    reader.close ()
    reader.readinto (bytearray (42)) GH-GH-GH- BANG!

The problem exists since 2012 when commit dc469454ec added code
to free the read buffer on close().

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
(cherry picked from commit cb1c0746f2)

Co-authored-by: Philipp Gesang <phg@phi-gamma.net>

Co-authored-by: Philipp Gesang <phg@phi-gamma.net>
2020-02-04 14:06:42 -08:00
Steve Dower 51332c467e
[3.6] bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231) (GH-18233) 2020-01-30 21:12:20 -05:00
Miss Islington (bot) c563f409ea bpo-39421: Fix posible crash in heapq with custom comparison operators (GH-18118) (GH-18146)
(cherry picked from commit 79f89e6e5a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-01-23 09:49:19 -05:00
Miss Islington (bot) fe2445840c Doc: Change Python 2 status to EOL. (GH-17885) (GH-17887)
(cherry picked from commit f4800b8ed3)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-01-07 15:52:13 -05:00
Ned Deily 4171b8e411
Update copyright year in macOS installer license copy (GH-17806) (GH-17810) 2020-01-02 23:13:59 -05:00
Benjamin Peterson a9964b0aca
[3.6] Bring Python into the next decade. (GH-17804)
(cherry picked from commit 946b29ea0b)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-01-02 19:13:57 -08:00
Ned Deily eccc9d30e8 Post release updates 2019-12-18 19:51:13 -05:00
Ned Deily 02dff8b011 3.6.10 2019-12-18 14:26:36 -05:00
Miss Islington (bot) 5a9b69732e bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636) (GH-17638)
(cherry picked from commit bf3aa1060a)

Co-authored-by: Ned Deily <nad@python.org>
2019-12-17 04:26:11 -05:00
Inada Naoki 7699281b72 bpo-39035: travis: Update image to xenial (GH-17622) 2019-12-16 18:20:44 -05:00
Kyle Stanley 50fc84af38 [3.6] Add whatsnew for removal of asyncio.loop.create_datagram_endpoint()'s *reuse_address* parameter (GH-17595). (GH-17632)
(cherry picked from commit f501db2b93)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-12-16 18:19:36 -05:00
Miss Islington (bot) b35ec007b6 Fix warnings in test_asyncio.test_base_events (GH-17577) (#17581)
Co-authored-by: tirkarthi
(cherry picked from commit 1988344a6b)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-12-12 15:08:48 +01:00
Ned Deily bf62515a5b Post release updates 2019-12-11 04:37:54 -05:00
Ned Deily 7ea0551592 3.6.10rc1 2019-12-11 03:28:36 -05:00
Kyle Stanley b23c0840ce [3.6] bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311). (GH-17571)
(cherry picked from commit ab513a38c9)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-12-11 01:54:02 -05:00
Miss Islington (bot) 30afc91f5e bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (GH-17444)
(cherry picked from commit a62ad4730c)

Co-authored-by: Matthew Rollings <1211162+stealthcopter@users.noreply.github.com>
2019-12-02 18:34:31 -05:00
Miss Islington (bot) 0716056c49 bpo-38804: Fix REDoS in http.cookiejar (GH-17157) (#17343)
The regex http.cookiejar.LOOSE_HTTP_DATE_RE was vulnerable to regular
expression denial of service (REDoS).

LOOSE_HTTP_DATE_RE.match is called when using http.cookiejar.CookieJar
to parse Set-Cookie headers returned by a server.
Processing a response from a malicious HTTP server can lead to extreme
CPU usage and execution will be blocked for a long time.

The regex contained multiple overlapping \s* capture groups.
Ignoring the ?-optional capture groups the regex could be simplified to

    \d+-\w+-\d+(\s*\s*\s*)$

Therefore, a long sequence of spaces can trigger bad performance.

Matching a malicious string such as

    LOOSE_HTTP_DATE_RE.match("1-c-1" + (" " * 2000) + "!")

caused catastrophic backtracking.

The fix removes ambiguity about which \s* should match a particular
space.

You can create a malicious server which responds with Set-Cookie headers
to attack all python programs which access it e.g.

    from http.server import BaseHTTPRequestHandler, HTTPServer

    def make_set_cookie_value(n_spaces):
        spaces = " " * n_spaces
        expiry = f"1-c-1{spaces}!"
        return f"b;Expires={expiry}"

    class Handler(BaseHTTPRequestHandler):
        def do_GET(self):
            self.log_request(204)
            self.send_response_only(204)  GH- Don't bother sending Server and Date
            n_spaces = (
                int(self.path[1:])  GH- Can GET e.g. /100 to test shorter sequences
                if len(self.path) > 1 else
                65506  GH- Max header line length 65536
            )
            value = make_set_cookie_value(n_spaces)
            for i in range(99):  GH- Not necessary, but we can have up to 100 header lines
                self.send_header("Set-Cookie", value)
            self.end_headers()

    if __name__ == "__main__":
        HTTPServer(("", 44020), Handler).serve_forever()

This server returns 99 Set-Cookie headers. Each has 65506 spaces.
Extracting the cookies will pretty much never complete.

Vulnerable client using the example at the bottom of
https://docs.python.org/3/library/http.cookiejar.html :

    import http.cookiejar, urllib.request
    cj = http.cookiejar.CookieJar()
    opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
    r = opener.open("http://localhost:44020/")

The popular requests library was also vulnerable without any additional
options (as it uses http.cookiejar by default):

    import requests
    requests.get("http://localhost:44020/")

* Regression test for http.cookiejar REDoS

If we regress, this test will take a very long time.

* Improve performance of http.cookiejar.ISO_DATE_RE

A string like

"444444" + (" " * 2000) + "A"

could cause poor performance due to the 2 overlapping \s* groups,
although this is not as serious as the REDoS in LOOSE_HTTP_DATE_RE was.
(cherry picked from commit 1b779bfb85)

Co-authored-by: bcaller <bcaller@users.noreply.github.com>
2019-11-22 17:09:10 -05:00
Miss Skeleton (bot) 86c17c06c9 Update URL in macOS installer copy of license (GH-16905) (GH-16908)
(cherry picked from commit 01659ca62c)

Co-authored-by: Ned Deily <nad@python.org>
2019-10-23 16:29:55 -04:00
Miss Skeleton (bot) 293fc1730b [3.6] Fix Zope URL (GH-16880) (GH-16904)
(cherry picked from commit dfe726b1ac)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-10-23 15:33:56 -04:00
Miss Islington (bot) 1039f21574 Update doc switcher list for 3.8.0 (GH-16809) (GH-16812)
(cherry picked from commit 3f36043db2)

Co-authored-by: Ned Deily <nad@python.org>
2019-10-15 17:46:19 -04:00
Miss Islington (bot) 819ad37776 Doc: 3.8 is now stable. (GH-16790) (GH-16793)
(cherry picked from commit 4504b4500d)

Co-authored-by: Julien Palard <julien@palard.fr>
2019-10-14 18:21:43 -04:00