Skip to content

fix(proxyauth): skip proxy authentication for transparently intercepted modes - #8637

Open
ToniAdreal wants to merge 1 commit into
mitmproxy:mainfrom
ToniAdreal:fix-8631-proxyauth-intercept-modes
Open

ToniAdreal wants to merge 1 commit into
mitmproxy:mainfrom
ToniAdreal:fix-8631-proxyauth-intercept-modes

Conversation

@ToniAdreal

Copy link
Copy Markdown

Fixes #8631.

With proxyauth set, requests in transparent, local and WireGuard modes went through the server-style auth branch: no credentials meant a 401, and an origin Authorization header that happened to match the proxy credentials got deleted on the way through. Clients in these modes never present proxy credentials, they are not talking to mitmproxy as a proxy, so there is nothing to authenticate.

This skips proxy authentication in requestheaders and http_connect for transparent, local and WireGuard modes, leaving the flow (and the origin Authorization header) untouched. Regular, upstream, reverse and SOCKS5 modes are unchanged, and the existing reverse-mode tests still pass.

I kept the scope to the three modes named in the issue. Tun mode has the same shape (traffic captured, not addressed to the proxy), happy to extend this to it as well if you would rather cover it here.

Verification: added 6 tests (no-credentials and origin-header cases for each of the three modes, for both requestheaders and http_connect). They fail on main with 401s and pass with this change. Full test_proxyauth.py passes (30 passed), ruff check and ruff format --check are clean.

…ed modes

With proxyauth enabled, requests in transparent, local and WireGuard
modes were run through the server-style auth branch: missing credentials
got a 401, and a valid origin Authorization header was deleted when it
happened to match the proxy credentials. Clients in these modes never
present proxy credentials, so authentication is now skipped there and the
flow passes through untouched. Regular, upstream, reverse and SOCKS5
modes are unchanged.

Fixes mitmproxy#8631.

Signed-off-by: ToniAdreal <[email protected]>
@ToniAdreal
ToniAdreal force-pushed the fix-8631-proxyauth-intercept-modes branch from 8b8ae68 to eeb09ee Compare November 23, 2026 14:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope proxyauth by proxy mode: transparent/local/WireGuard requests get 401 and lose the origin Authorization header

1 participant