Skip to content

fix(forward): never inject a real credential into cleartext http - #7

Closed
praxagent wants to merge 1 commit into
mainfrom
fix/no-cleartext-injection
Closed

praxagent wants to merge 1 commit into
mainfrom
fix/no-cleartext-injection

Conversation

@praxagent

Copy link
Copy Markdown
Owner

The bug

A plain http:// request to an injection host got the real key injected and sent unencrypted. The injector matched on host only, never on scheme.

Anyone on the network path between the proxy and the provider could read it. Any authenticated caller could trigger it, including a prompt-injected Prax asked to fetch http://api.openai.com/....

The fix

  • Cleartext requests to an injection host go out without the credential, as if no key were configured, so the upstream refuses them.
  • A warning is logged that names the scheme and host, never the key.
  • HTTPS is unchanged.

Idea credit: Agent Substrate (Google, CNCF sandbox application cncf/sandbox#523). Its egress credential injection has the same rule: a secret is never put on a cleartext wire.

Verified

Live, in a throwaway mitmproxy/mitmproxy:latest container with a fake key and example.com as the injection host:

before after
http://example.com injected header:X-Test-Key NOT injecting … cleartext http
https://example.com injected injected

Unit: 2 tests. The cleartext test fails without the fix. 65 passed, ruff clean.

Independent of #3–#6; small conflicts are possible in mitm_addon.py, and I'll rebase whichever merges later.

Plain http:// to an injection host got the key injected and sent unencrypted
(reproduced live with a fake key). Now it goes out without the credential,
as if none were configured, with a warning. Idea credit: Agent Substrate's
egress credential injection, which skips cleartext likewise.
@praxagent

Copy link
Copy Markdown
Owner Author

Folded into #8 (stacked PRs re-conflict after every squash merge). Every commit from this branch is in #8 — merge that one.

@praxagent praxagent closed this Oct 2, 2026
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.

1 participant