Repository navigation
fix(security): fail closed on chatgpt-web-codex CDP proxy without token (#14486) - #15825
Merged
Merged
Conversation
…en and provision it end to end (#14486) cdp-proxy.mjs returned true from hasValidToken() when CDP_PROXY_TOKEN was empty, forwarding unauthenticated CDP (full browser control) on the default deploy. It now rejects everything without a token. To keep the executor working, the browser container auto-generates a secret into a volume shared read-only with the app in both compose files (or uses CDP_PROXY_TOKEN), and the vendored connectOverCDP calls send X-Omni-Cdp-Token. The token is never logged.
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
This was referenced Oct 10, 2026
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.
Closes #14486
Finding 1 (
/api/cli/connect+ CHANGEME) was already fixed by #14491/#15043 and is untouched. This PR is Finding 2.Root cause
docker/chatgpt-web-codex-browser/cdp-proxy.mjshasValidToken()returnedtruewhenCDP_PROXY_TOKENwas empty (the compose default), so anyone reaching port 9223 got unauthenticated CDP (full control of the logged-in browser session). Unlike the siblingcdp-bridge.py, it failed open.Fix (all three parts together)
cdp-proxy.mjsnow fails CLOSED with no token (constant-time compare, warning text updated, token never logged).docker-compose.ymlanddocker-compose.prod.yml: withCDP_PROXY_TOKENempty, the browser container auto-generates a secret intoCDP_PROXY_TOKEN_FILEon a named volume shared read-only with the app container (prod also gets the same wiring). Nointernal: truenetwork (would cut egress)..env.exampledocumented.open-sse/vendor/codex-chatgpt-web/cdp-auth.ts; allconnectOverCDPcall sites inbrowser-login.tsandbrowser-worker.tsnow passX-Omni-Cdp-Token(fromCDP_PROXY_TOKENor the shared file), so the executor keeps working.CDP_PROXY_LISTEN_PORT/CDP_PROXY_UPSTREAM_PORTenv overrides (defaults unchanged) so the new test does not collide with the security(defaults): 16 verified insecure defaults from the insecure-defaults pipeline (cloud-sync HMAC fail-open, CLI token salt, keyless listeners, compose/podman defaults) #13679 test ports.Tests
tests/unit/cdp-proxy-fail-closed-no-token-14486.test.ts: RED on unfixed proxy (2 fail: forwarded upstream with no token; token-file case), GREEN after (2 pass).tests/unit/chatgpt-web-codex-cdp-token-header-14486.test.ts: header options from env / token file / none (3 pass).cdp-proxy-auth-gate-13679(2) andchatgpt-web-codex(41) pass.Gates
file-size, complexity, cognitive-complexity, typecheck:core, check:open-sse-typecheck, eslint (with suppressions), prettier, husky pre-commit.
Note: browser-worker.ts is frozen for size; one blank line removed to keep it line-neutral.