Repository navigation
Conversation
HTTPS sends the proxy credential on the CONNECT only; the tunnelled requests carry none, and auth ran only in the request hook. So setting PROXY_FORWARD_AUTH_TOKEN refused every HTTPS request, right token or not — which is why no deployment runs with it. Authenticate at http_connect and remember the caller per client connection (the shape of mitmproxy's own proxyauth addon). Also: the audit line read the caller after the credential was stripped, so it always said caller=-.
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
With
PROXY_FORWARD_AUTH_TOKENset, the forward proxy refused every HTTPS request, right token or not. Plain HTTP worked.Proxy-Authorizationon theCONNECTonly, and the requests tunnelled through it carry none.requesthook, so it never saw a credential.HTTPS_PROXYcarries no credential, so its proxy runs open on loopback, with the startup warning. The documented hardening could not be switched on without breaking every model call.The fix
http_connectand remember the caller per client connection in aWeakKeyDictionary. This is the shape of mitmproxy's ownproxyauthaddon.caller=-. The caller is now read before the strip. feat: a wire record of what the agent asked the model, outside the agent #3 carries the same one-line fix, so whichever merges second needs a trivial rebase; I'll do it.Verified
Real mitmproxy (
mitmproxy/mitmproxy:latest), throwaway container, no credentials loaded:Unit: 5 new tests. An authenticated tunnel carries its requests; a bad CONNECT is refused; another connection doesn't inherit a tunnel; with no token configured, tunnels stay open; the audit line names the tunnel's caller. 68 passed, ruff clean.
After merge
To actually turn the token on, Prax's
HTTPS_PROXYneedshttp://prax:<token>@…. That is a production.envchange for TJ to decide, and I haven't touched it.