Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
147c8511dd | ||
|
|
74ea7cf7a6 | ||
|
|
3022253346 | ||
|
|
b639e66c81 | ||
|
|
d3d504436e |
7
.github/workflows/run-tests.yml
vendored
7
.github/workflows/run-tests.yml
vendored
@@ -12,14 +12,13 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy-3.8", "pypy-3.9"]
|
||||
os: [ubuntu-22.04, macOS-latest, windows-latest]
|
||||
include:
|
||||
# pypy-3.7 on Mac OS currently fails trying to compile
|
||||
# brotlipy. Moving pypy3 to only test linux.
|
||||
# pypy-3.7 on Windows and Mac OS currently fails trying to compile
|
||||
# cryptography. Moving pypy-3.7 to only test linux.
|
||||
- python-version: pypy-3.7
|
||||
os: ubuntu-latest
|
||||
experimental: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
29
HISTORY.md
29
HISTORY.md
@@ -6,6 +6,33 @@ dev
|
||||
|
||||
- \[Short description of non-trivial change.\]
|
||||
|
||||
2.31.0 (2023-05-22)
|
||||
-------------------
|
||||
|
||||
**Security**
|
||||
- Versions of Requests between v2.3.0 and v2.30.0 are vulnerable to potential
|
||||
forwarding of `Proxy-Authorization` headers to destination servers when
|
||||
following HTTPS redirects.
|
||||
|
||||
When proxies are defined with user info (https://user:pass@proxy:8080), Requests
|
||||
will construct a `Proxy-Authorization` header that is attached to the request to
|
||||
authenticate with the proxy.
|
||||
|
||||
In cases where Requests receives a redirect response, it previously reattached
|
||||
the `Proxy-Authorization` header incorrectly, resulting in the value being
|
||||
sent through the tunneled connection to the destination server. Users who rely on
|
||||
defining their proxy credentials in the URL are *strongly* encouraged to upgrade
|
||||
to Requests 2.31.0+ to prevent unintentional leakage and rotate their proxy
|
||||
credentials once the change has been fully deployed.
|
||||
|
||||
Users who do not use a proxy or do not supply their proxy credentials through
|
||||
the user information portion of their proxy URL are not subject to this
|
||||
vulnerability.
|
||||
|
||||
Full details can be read in our [Github Security Advisory](https://github.com/psf/requests/security/advisories/GHSA-j8r2-6x86-q33q)
|
||||
and [CVE-2023-32681](https://nvd.nist.gov/vuln/detail/CVE-2023-32681).
|
||||
|
||||
|
||||
2.30.0 (2023-05-03)
|
||||
-------------------
|
||||
|
||||
@@ -73,7 +100,7 @@ dev
|
||||
cert verification. All Requests 2.x versions before 2.28.0 are affected. (#6074)
|
||||
- Fixed urllib3 exception leak, wrapping `urllib3.exceptions.SSLError` with
|
||||
`requests.exceptions.SSLError` for `content` and `iter_content`. (#6057)
|
||||
- Fixed issue where invalid Windows registry entires caused proxy resolution
|
||||
- Fixed issue where invalid Windows registry entries caused proxy resolution
|
||||
to raise an exception rather than ignoring the entry. (#6149)
|
||||
- Fixed issue where entire payload could be included in the error message for
|
||||
JSONDecodeError. (#6036)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
__title__ = "requests"
|
||||
__description__ = "Python HTTP for Humans."
|
||||
__url__ = "https://requests.readthedocs.io"
|
||||
__version__ = "2.30.0"
|
||||
__build__ = 0x023000
|
||||
__version__ = "2.31.0"
|
||||
__build__ = 0x023100
|
||||
__author__ = "Kenneth Reitz"
|
||||
__author_email__ = "me@kennethreitz.org"
|
||||
__license__ = "Apache 2.0"
|
||||
|
||||
@@ -324,7 +324,9 @@ class SessionRedirectMixin:
|
||||
except KeyError:
|
||||
username, password = None, None
|
||||
|
||||
if username and password:
|
||||
# urllib3 handles proxy authorization for us in the standard adapter.
|
||||
# Avoid appending this to TLS tunneled requests where it may be leaked.
|
||||
if not scheme.startswith('https') and username and password:
|
||||
headers["Proxy-Authorization"] = _basic_auth_str(username, password)
|
||||
|
||||
return new_proxies
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-e .[socks]
|
||||
pytest>=2.8.0,<=6.2.5
|
||||
pytest-cov
|
||||
pytest-httpbin==1.0.0
|
||||
pytest-httpbin==2.0.0
|
||||
pytest-mock==2.0.0
|
||||
httpbin==0.7.0
|
||||
trustme
|
||||
|
||||
2
setup.py
2
setup.py
@@ -65,7 +65,7 @@ requires = [
|
||||
"certifi>=2017.4.17",
|
||||
]
|
||||
test_requirements = [
|
||||
"pytest-httpbin==0.0.7",
|
||||
"pytest-httpbin==2.0.0",
|
||||
"pytest-cov",
|
||||
"pytest-mock",
|
||||
"pytest-xdist",
|
||||
|
||||
@@ -647,6 +647,26 @@ class TestRequests:
|
||||
|
||||
assert sent_headers.get("Proxy-Authorization") == proxy_auth_value
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"url,has_proxy_auth",
|
||||
(
|
||||
('http://example.com', True),
|
||||
('https://example.com', False),
|
||||
),
|
||||
)
|
||||
def test_proxy_authorization_not_appended_to_https_request(self, url, has_proxy_auth):
|
||||
session = requests.Session()
|
||||
proxies = {
|
||||
'http': 'http://test:pass@localhost:8080',
|
||||
'https': 'http://test:pass@localhost:8090',
|
||||
}
|
||||
req = requests.Request('GET', url)
|
||||
prep = req.prepare()
|
||||
session.rebuild_proxies(prep, proxies)
|
||||
|
||||
assert ('Proxy-Authorization' in prep.headers) is has_proxy_auth
|
||||
|
||||
def test_basicauth_with_netrc(self, httpbin):
|
||||
auth = ("user", "pass")
|
||||
wrong_auth = ("wronguser", "wrongpass")
|
||||
|
||||
Reference in New Issue
Block a user