From 215dfea515dcdaea7ffb8ab046a0333aa9590d6a Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 22 May 2024 02:31:48 +0200 Subject: [PATCH] Skip proxyauth on client replay, fix #6836 (#6866) * skip proxyauth on client replay, fix #6836 * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 ++ mitmproxy/addons/proxyauth.py | 2 ++ test/mitmproxy/addons/test_proxyauth.py | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 830fc1d7d..4f662f2de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ ([#6819](https://github.com/mitmproxy/mitmproxy/pull/6819), @mhils) * Set the `unbuffered` (stdout/stderr) flag for the `mitmdump` PyInstaller build. ([#6821](https://github.com/mitmproxy/mitmproxy/pull/6821), @Prinzhorn) +* Fix a bug where client replay would not work with proxyauth. + ([#6866](https://github.com/mitmproxy/mitmproxy/pull/6866), @mhils) ## 17 April 2024: mitmproxy 10.3.0 diff --git a/mitmproxy/addons/proxyauth.py b/mitmproxy/addons/proxyauth.py index 13e1ef02e..9250251da 100644 --- a/mitmproxy/addons/proxyauth.py +++ b/mitmproxy/addons/proxyauth.py @@ -76,6 +76,8 @@ class ProxyAuth: # Is this connection authenticated by a previous HTTP CONNECT? if f.client_conn in self.authenticated: f.metadata["proxyauth"] = self.authenticated[f.client_conn] + elif f.is_replay: + pass else: self.authenticate_http(f) diff --git a/test/mitmproxy/addons/test_proxyauth.py b/test/mitmproxy/addons/test_proxyauth.py index 743bc635b..e715e9d11 100644 --- a/test/mitmproxy/addons/test_proxyauth.py +++ b/test/mitmproxy/addons/test_proxyauth.py @@ -239,6 +239,11 @@ class TestProxyAuth: assert not f2.response assert f2.metadata["proxyauth"] == ("test", "test") + f3 = tflow.tflow() + f3.is_replay = True + up.requestheaders(f3) + assert not f2.response + @pytest.mark.parametrize( "spec",