Skip to content

Add experimental local credential broker#28034

Open
winston-openai wants to merge 3 commits into
mainfrom
dev/winston/local-credential-broker
Open

Add experimental local credential broker#28034
winston-openai wants to merge 3 commits into
mainfrom
dev/winston/local-credential-broker

Conversation

@winston-openai

@winston-openai winston-openai commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Why

Codex child processes can inherit injectable local credentials directly, which lets commands read and exfiltrate the real values. This first experimental slice keeps supported workflows working while moving those credentials behind the existing managed network proxy.

What changed

  • add credential_broker = true under [features.network_proxy]
  • discover supported process environment variables during child setup, retain their real values only in the in-memory proxy broker, and replace them with deterministic lookalike dummies
  • preserve recognized provider prefixes, token length, separators, and broad character shape so GitHub and OpenAI clients continue to accept the dummy values
  • inject the selected real credential only into a matching MITM request; a presented dummy selects among multiple credentials of the same kind
  • preserve explicit Authorization headers that do not contain a broker dummy
  • bind GitHub cloud credentials only to GitHub cloud hosts, bind GitHub Enterprise credentials only to an explicit non-cloud GH_HOST, and bind OpenAI keys only to api.openai.com
  • leave unbound GitHub Enterprise credentials usable but unbrokered
  • define credential sources in one proxy-owned table, so each source automatically participates in discovery, dummy cleanup, and shell-snapshot restoration while per-kind header placement stays localized
  • carry an internal dummy-to-environment mapping through shell snapshots, then strip only values that still exactly match broker dummies when commands leave proxy containment; user overrides remain intact
  • replay brokered credential keys through shell snapshots only when the proxy-issued broker marker is exactly 1, preventing ordinary proxy sessions from restoring ambient credentials
  • keep discovery, token shaping, state, MITM selection, and header injection in codex-network-proxy; the small codex-core integration only maps feature config and handles the existing shell snapshot and escalation boundaries

Scope

  • supported credentials: GH_TOKEN, GITHUB_TOKEN, GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN, and OPENAI_API_KEY
  • GitHub cloud credentials match github.com, api.github.com, and *.ghe.com
  • GitHub Enterprise credentials match only the normalized non-cloud GH_HOST
  • OpenAI API keys match only api.openai.com
  • this does not cover SSH agents, kube client certificates, filesystem secret discovery, context-injected secret scrubbing, or removing credentials from snapshot files at rest

Validation

  • just test -p codex-network-proxy (184 passed)
  • just test -p codex-features (52 passed)
  • focused codex-core checks for active broker shell-snapshot replay and inactive broker credential omission
  • scoped Clippy checks for codex-network-proxy, codex-features, and codex-core

@winston-openai winston-openai force-pushed the dev/winston/local-credential-broker branch 6 times, most recently from 5446ca3 to 006a77a Compare June 13, 2026 08:36
@winston-openai winston-openai marked this pull request as ready for review June 16, 2026 01:51
@winston-openai winston-openai requested a review from a team as a code owner June 16, 2026 01:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 006a77a3d6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/network-proxy/src/credential_broker.rs Outdated
Comment thread codex-rs/network-proxy/src/credential_broker.rs
Comment thread codex-rs/network-proxy/src/credential_broker.rs Outdated
Comment thread codex-rs/network-proxy/src/credential_broker.rs Outdated
Comment thread codex-rs/network-proxy/src/credential_broker.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs
@winston-openai winston-openai changed the title Add local credential broker Add experimental local credential broker Jun 17, 2026
winston-openai added a commit that referenced this pull request Jun 17, 2026
@winston-openai winston-openai force-pushed the dev/winston/local-credential-broker branch from f992518 to 732cf55 Compare June 17, 2026 18:45
@winston-openai winston-openai changed the base branch from dev/winston/mitm-command-ca-bundles to main June 17, 2026 18:46
@winston-openai winston-openai force-pushed the dev/winston/local-credential-broker branch 2 times, most recently from 807dfe6 to f52cce3 Compare June 17, 2026 20:03
@winston-openai winston-openai force-pushed the dev/winston/local-credential-broker branch 2 times, most recently from 403dd8e to 99eeb43 Compare June 17, 2026 22:22
@winston-openai winston-openai force-pushed the dev/winston/local-credential-broker branch from 99eeb43 to 9204084 Compare June 18, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant