Swap every header that carries a placeholder - #45
Merged
Conversation
czpython
force-pushed
the
dru-470-every-placeholder
branch
from
September 7, 2026 11:02
512ce1f to
4c2ca17
Compare
The proxy stopped at the first placeholder it found, so a request with two secret headers sent the second placeholder to its destination as it was. The addon now collects every placeholder from the original headers, authorizes each one for the host, and replaces them all at once. One refusal refuses the whole request, an exchange that gives no answer gets a 503 before anything is sent, and two placeholders that resolve to the same header refuse the request. A credential the exchange returns is never scanned as a placeholder. The security and architecture docs say so. Header names compare without case, as mitmproxy keeps them, and the placeholders come from every field of a repeated name, not from the folded value.
czpython
force-pushed
the
dru-470-every-placeholder
branch
from
September 7, 2026 11:04
4c2ca17 to
7805fb7
Compare
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.
What changes
Swap.requestheaderscollects every header whose value carries a placeholder, once, from the original headers.Swap.swapauthorizes each placeholder for the CONNECT host, then deletes the carrying headers and writes the headers the exchange names, all at once.docs/security.mdanddocs/architecture.mdsay the proxy swaps every header that carries a placeholder and that one refusal refuses the whole request.Where this differs from the ticket
Names
None new.
Swap.swaptakes the placeholders it found, a map from header name to placeholder, instead of one pair.Gates
uv run ruff check,uv run ruff format --check,uv run pyright, anduv run pytestare green.Review
Pending.