Repository navigation
proxy refuses web pages - #34
Merged
Merged
Conversation
|
try this branch: |
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 local proxy served any request that reached 127.0.0.1:8459, including ones sent by a web page in the user's browser.
fetch('http://127.0.0.1:8459/anthropic/v1/messages', {method: 'POST', mode: 'no-cors', …}). The proxy injected the active account's credential and forwarded it, spending the user's quota. The page can't read the response, but the spend is real.Host. That lets it read the responses too, so it gets free inference on the user's subscription.The handler now refuses, before routing and before any credential lookup:
Hostthat isn't loopback (127.0.0.1,localhost,[::1]), which stops rebinding;Originthat isn't a loopback origin, which stops cross-sitefetch/form posts;Origin(Sec-Fetch-Sitepresent and notnone), which covers<img>/<script>GETs.Native clients (codex, claude, grok, pi, openclaw, hermes) send none of these headers, so nothing changes for them. A page served from loopback, like a local dev tool, keeps working. The
unknown routefingerprintproxyIdentityrelies on is unaffected.Verified: the five new cases in
proxy.test.tsfail on main (three attacks injected the credential) and pass here. The full suite passes on Bun 1.2.20 and 1.4.2.