Compare commits
No commits in common. 'c9' and 'c8-stream-3.9_bootstrap' have entirely different histories.
c9
...
c8-stream-
@ -1 +1 @@
|
||||
SOURCES/urllib3-1.26.5.tar.gz
|
||||
SOURCES/urllib3-1.25.10.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
2870de19c1a575dab12f5d65080ed65d4957d4b2 SOURCES/urllib3-1.26.5.tar.gz
|
||||
27f239655e42bc6527918c75acd6826ea52f3d11 SOURCES/urllib3-1.25.10.tar.gz
|
||||
|
@ -1,38 +0,0 @@
|
||||
From f1d40fd07f7b5d9cf846a18fb5a920b4be07dfc5 Mon Sep 17 00:00:00 2001
|
||||
From: Hasan Ramezani <hasan.r67@gmail.com>
|
||||
Date: Thu, 20 Jan 2022 15:56:02 +0100
|
||||
Subject: [PATCH] [1.26] Add server_hostname to SSL_KEYWORDS
|
||||
|
||||
---
|
||||
src/urllib3/poolmanager.py | 1 +
|
||||
test/with_dummyserver/test_poolmanager.py | 5 +++++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/urllib3/poolmanager.py b/src/urllib3/poolmanager.py
|
||||
index 3a31a285bf..ca4ec34118 100644
|
||||
--- a/src/urllib3/poolmanager.py
|
||||
+++ b/src/urllib3/poolmanager.py
|
||||
@@ -34,6 +34,7 @@
|
||||
"ca_cert_dir",
|
||||
"ssl_context",
|
||||
"key_password",
|
||||
+ "server_hostname",
|
||||
)
|
||||
|
||||
# All known keyword arguments that could be provided to the pool manager, its
|
||||
diff --git a/test/with_dummyserver/test_poolmanager.py b/test/with_dummyserver/test_poolmanager.py
|
||||
index d877cc99ac..fa07a372a9 100644
|
||||
--- a/test/with_dummyserver/test_poolmanager.py
|
||||
+++ b/test/with_dummyserver/test_poolmanager.py
|
||||
@@ -346,6 +346,11 @@ def test_http_with_ssl_keywords(self):
|
||||
r = http.request("GET", "http://%s:%s/" % (self.host, self.port))
|
||||
assert r.status == 200
|
||||
|
||||
+ def test_http_with_server_hostname(self):
|
||||
+ with PoolManager(server_hostname="example.com") as http:
|
||||
+ r = http.request("GET", "http://%s:%s/" % (self.host, self.port))
|
||||
+ assert r.status == 200
|
||||
+
|
||||
def test_http_with_ca_cert_dir(self):
|
||||
with PoolManager(ca_certs="REQUIRED", ca_cert_dir="/nosuchdir") as http:
|
||||
r = http.request("GET", "http://%s:%s/" % (self.host, self.port))
|
@ -0,0 +1,61 @@
|
||||
From 2d4a3fee6de2fa45eb82169361918f759269b4ec Mon Sep 17 00:00:00 2001
|
||||
From: Seth Michael Larson <sethmichaellarson@gmail.com>
|
||||
Date: Wed, 26 May 2021 10:43:12 -0500
|
||||
Subject: [PATCH] Improve performance of sub-authority splitting in URL
|
||||
|
||||
---
|
||||
src/urllib3/util/url.py | 8 +++++---
|
||||
test/test_util.py | 10 ++++++++++
|
||||
2 files changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
|
||||
index 6ff238fe3c..81a03da9e3 100644
|
||||
--- a/src/urllib3/util/url.py
|
||||
+++ b/src/urllib3/util/url.py
|
||||
@@ -63,12 +63,12 @@
|
||||
BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
|
||||
ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
|
||||
|
||||
-SUBAUTHORITY_PAT = (u"^(?:(.*)@)?(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
|
||||
+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
|
||||
REG_NAME_PAT,
|
||||
IPV4_PAT,
|
||||
IPV6_ADDRZ_PAT,
|
||||
)
|
||||
-SUBAUTHORITY_RE = re.compile(SUBAUTHORITY_PAT, re.UNICODE | re.DOTALL)
|
||||
+_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL)
|
||||
|
||||
UNRESERVED_CHARS = set(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~"
|
||||
@@ -365,7 +365,9 @@ def parse_url(url):
|
||||
scheme = scheme.lower()
|
||||
|
||||
if authority:
|
||||
- auth, host, port = SUBAUTHORITY_RE.match(authority).groups()
|
||||
+ auth, _, host_port = authority.rpartition("@")
|
||||
+ auth = auth or None
|
||||
+ host, port = _HOST_PORT_RE.match(host_port).groups()
|
||||
if auth and normalize_uri:
|
||||
auth = _encode_invalid_chars(auth, USERINFO_CHARS)
|
||||
if port == "":
|
||||
diff --git a/test/test_util.py b/test/test_util.py
|
||||
index a5b68a084b..88409e2d6c 100644
|
||||
--- a/test/test_util.py
|
||||
+++ b/test/test_util.py
|
||||
@@ -438,6 +438,16 @@ def test_netloc(self, url, expected_netloc):
|
||||
fragment="hash",
|
||||
),
|
||||
),
|
||||
+ # Tons of '@' causing backtracking
|
||||
+ ("https://" + ("@" * 10000) + "[", False),
|
||||
+ (
|
||||
+ "https://user:" + ("@" * 10000) + "example.com",
|
||||
+ Url(
|
||||
+ scheme="https",
|
||||
+ auth="user:" + ("%40" * 9999),
|
||||
+ host="example.com",
|
||||
+ ),
|
||||
+ ),
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("url, expected_url", url_vulnerabilities)
|
@ -1,53 +0,0 @@
|
||||
From 5fe72b64a10e9cb5c5e2b9de46401b6c7bb226e9 Mon Sep 17 00:00:00 2001
|
||||
From: Lumir Balhar <lbalhar@redhat.com>
|
||||
Date: Thu, 12 Oct 2023 14:27:36 +0200
|
||||
Subject: [PATCH] CVE-2023-43804
|
||||
|
||||
---
|
||||
src/urllib3/util/retry.py | 2 +-
|
||||
test/test_retry.py | 2 +-
|
||||
test/test_retry_deprecated.py | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/urllib3/util/retry.py b/src/urllib3/util/retry.py
|
||||
index 180e82b..63c02ee 100644
|
||||
--- a/src/urllib3/util/retry.py
|
||||
+++ b/src/urllib3/util/retry.py
|
||||
@@ -217,7 +217,7 @@ class Retry(object):
|
||||
RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503])
|
||||
|
||||
#: Default headers to be used for ``remove_headers_on_redirect``
|
||||
- DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Authorization"])
|
||||
+ DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Cookie", "Authorization"])
|
||||
|
||||
#: Maximum backoff time.
|
||||
BACKOFF_MAX = 120
|
||||
diff --git a/test/test_retry.py b/test/test_retry.py
|
||||
index 3e71efe..e9270bb 100644
|
||||
--- a/test/test_retry.py
|
||||
+++ b/test/test_retry.py
|
||||
@@ -293,7 +293,7 @@ class TestRetry(object):
|
||||
def test_retry_default_remove_headers_on_redirect(self):
|
||||
retry = Retry()
|
||||
|
||||
- assert list(retry.remove_headers_on_redirect) == ["authorization"]
|
||||
+ assert retry.remove_headers_on_redirect == {"authorization", "cookie"}
|
||||
|
||||
def test_retry_set_remove_headers_on_redirect(self):
|
||||
retry = Retry(remove_headers_on_redirect=["X-API-Secret"])
|
||||
diff --git a/test/test_retry_deprecated.py b/test/test_retry_deprecated.py
|
||||
index eafecc4..d18f94c 100644
|
||||
--- a/test/test_retry_deprecated.py
|
||||
+++ b/test/test_retry_deprecated.py
|
||||
@@ -295,7 +295,7 @@ class TestRetry(object):
|
||||
def test_retry_default_remove_headers_on_redirect(self):
|
||||
retry = Retry()
|
||||
|
||||
- assert list(retry.remove_headers_on_redirect) == ["authorization"]
|
||||
+ assert retry.remove_headers_on_redirect == {"authorization", "cookie"}
|
||||
|
||||
def test_retry_set_remove_headers_on_redirect(self):
|
||||
retry = Retry(remove_headers_on_redirect=["X-API-Secret"])
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,94 +0,0 @@
|
||||
From d71ab28f104cac824c6036fa9b35cc2e2dd19bf8 Mon Sep 17 00:00:00 2001
|
||||
From: Lumir Balhar <lbalhar@redhat.com>
|
||||
Date: Tue, 12 Dec 2023 11:06:20 +0100
|
||||
Subject: [PATCH] Security fix for CVE-2023-45803
|
||||
|
||||
---
|
||||
src/urllib3/_collections.py | 18 ++++++++++++++++++
|
||||
src/urllib3/connectionpool.py | 5 +++++
|
||||
src/urllib3/poolmanager.py | 7 +++++--
|
||||
3 files changed, 28 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/urllib3/_collections.py b/src/urllib3/_collections.py
|
||||
index da9857e..bceb845 100644
|
||||
--- a/src/urllib3/_collections.py
|
||||
+++ b/src/urllib3/_collections.py
|
||||
@@ -268,6 +268,24 @@ class HTTPHeaderDict(MutableMapping):
|
||||
else:
|
||||
return vals[1:]
|
||||
|
||||
+ def _prepare_for_method_change(self):
|
||||
+ """
|
||||
+ Remove content-specific header fields before changing the request
|
||||
+ method to GET or HEAD according to RFC 9110, Section 15.4.
|
||||
+ """
|
||||
+ content_specific_headers = [
|
||||
+ "Content-Encoding",
|
||||
+ "Content-Language",
|
||||
+ "Content-Location",
|
||||
+ "Content-Type",
|
||||
+ "Content-Length",
|
||||
+ "Digest",
|
||||
+ "Last-Modified",
|
||||
+ ]
|
||||
+ for header in content_specific_headers:
|
||||
+ self.discard(header)
|
||||
+ return self
|
||||
+
|
||||
# Backwards compatibility for httplib
|
||||
getheaders = getlist
|
||||
getallmatchingheaders = getlist
|
||||
diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py
|
||||
index 4018321..8f9ebb5 100644
|
||||
--- a/src/urllib3/connectionpool.py
|
||||
+++ b/src/urllib3/connectionpool.py
|
||||
@@ -36,6 +36,7 @@ from .exceptions import (
|
||||
from .packages import six
|
||||
from .packages.six.moves import queue
|
||||
from .packages.ssl_match_hostname import CertificateError
|
||||
+from ._collections import HTTPHeaderDict
|
||||
from .request import RequestMethods
|
||||
from .response import HTTPResponse
|
||||
from .util.connection import is_connection_dropped
|
||||
@@ -800,7 +801,11 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
|
||||
redirect_location = redirect and response.get_redirect_location()
|
||||
if redirect_location:
|
||||
if response.status == 303:
|
||||
+ # Change the method according to RFC 9110, Section 15.4.4.
|
||||
method = "GET"
|
||||
+ # And lose the body not to transfer anything sensitive.
|
||||
+ body = None
|
||||
+ headers = HTTPHeaderDict(headers)._prepare_for_method_change()
|
||||
|
||||
try:
|
||||
retries = retries.increment(method, url, response=response, _pool=self)
|
||||
diff --git a/src/urllib3/poolmanager.py b/src/urllib3/poolmanager.py
|
||||
index 3a31a28..7d4c22c 100644
|
||||
--- a/src/urllib3/poolmanager.py
|
||||
+++ b/src/urllib3/poolmanager.py
|
||||
@@ -4,7 +4,7 @@ import collections
|
||||
import functools
|
||||
import logging
|
||||
|
||||
-from ._collections import RecentlyUsedContainer
|
||||
+from ._collections import HTTPHeaderDict, RecentlyUsedContainer
|
||||
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme
|
||||
from .exceptions import (
|
||||
LocationValueError,
|
||||
@@ -381,9 +381,12 @@ class PoolManager(RequestMethods):
|
||||
# Support relative URLs for redirecting.
|
||||
redirect_location = urljoin(url, redirect_location)
|
||||
|
||||
- # RFC 7231, Section 6.4.4
|
||||
if response.status == 303:
|
||||
+ # Change the method according to RFC 9110, Section 15.4.4.
|
||||
method = "GET"
|
||||
+ # And lose the body not to transfer anything sensitive.
|
||||
+ kw["body"] = None
|
||||
+ kw["headers"] = HTTPHeaderDict(kw["headers"])._prepare_for_method_change()
|
||||
|
||||
retries = kw.get("retries")
|
||||
if not isinstance(retries, Retry):
|
||||
--
|
||||
2.43.0
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 3606f6166c000213f1e1e9bace3c12f924dd0132 Mon Sep 17 00:00:00 2001
|
||||
From: Quentin Pradet <quentin.pradet@gmail.com>
|
||||
Date: Wed, 26 Jun 2024 15:56:34 +0200
|
||||
Subject: [PATCH] Merge pull request from GHSA-34jh-p97f-mpxf
|
||||
|
||||
* [1.26] Strip Proxy-Authorization header on redirects
|
||||
|
||||
* Set release date
|
||||
---
|
||||
src/urllib3/util/retry.py | 4 +++-
|
||||
test/test_retry.py | 6 +++++-
|
||||
test/test_retry_deprecated.py | 6 +++++-
|
||||
3 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/urllib3/util/retry.py b/src/urllib3/util/retry.py
|
||||
index 63c02ee..42fa619 100644
|
||||
--- a/src/urllib3/util/retry.py
|
||||
+++ b/src/urllib3/util/retry.py
|
||||
@@ -217,7 +217,9 @@ class Retry(object):
|
||||
RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503])
|
||||
|
||||
#: Default headers to be used for ``remove_headers_on_redirect``
|
||||
- DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Cookie", "Authorization"])
|
||||
+ DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(
|
||||
+ ["Cookie", "Authorization", "Proxy-Authorization"]
|
||||
+ )
|
||||
|
||||
#: Maximum backoff time.
|
||||
BACKOFF_MAX = 120
|
||||
diff --git a/test/test_retry.py b/test/test_retry.py
|
||||
index e9270bb..cf60bf1 100644
|
||||
--- a/test/test_retry.py
|
||||
+++ b/test/test_retry.py
|
||||
@@ -293,7 +293,11 @@ class TestRetry(object):
|
||||
def test_retry_default_remove_headers_on_redirect(self):
|
||||
retry = Retry()
|
||||
|
||||
- assert retry.remove_headers_on_redirect == {"authorization", "cookie"}
|
||||
+ assert retry.remove_headers_on_redirect == {
|
||||
+ "authorization",
|
||||
+ "proxy-authorization",
|
||||
+ "cookie",
|
||||
+ }
|
||||
|
||||
def test_retry_set_remove_headers_on_redirect(self):
|
||||
retry = Retry(remove_headers_on_redirect=["X-API-Secret"])
|
||||
diff --git a/test/test_retry_deprecated.py b/test/test_retry_deprecated.py
|
||||
index d18f94c..a107f7b 100644
|
||||
--- a/test/test_retry_deprecated.py
|
||||
+++ b/test/test_retry_deprecated.py
|
||||
@@ -295,7 +295,11 @@ class TestRetry(object):
|
||||
def test_retry_default_remove_headers_on_redirect(self):
|
||||
retry = Retry()
|
||||
|
||||
- assert retry.remove_headers_on_redirect == {"authorization", "cookie"}
|
||||
+ assert retry.remove_headers_on_redirect == {
|
||||
+ "authorization",
|
||||
+ "proxy-authorization",
|
||||
+ "cookie",
|
||||
+ }
|
||||
|
||||
def test_retry_set_remove_headers_on_redirect(self):
|
||||
retry = Retry(remove_headers_on_redirect=["X-API-Secret"])
|
||||
--
|
||||
2.44.0
|
||||
|
Loading…
Reference in new issue