67 lines
2.3 KiB
Diff
67 lines
2.3 KiB
Diff
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
|
|
|