Skip to content

🤖 fix: clearer Codex MCP auth warnings and Windows-safe env names for plugin servers - #6690

Merged
ThomasK33 merged 3 commits into
mainfrom
fix/codex-mcp-auth-followups
Oct 15, 2026
Merged

ThomasK33 merged 3 commits into
mainfrom
fix/codex-mcp-auth-followups

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

Four follow-ups from the #6487 reviews for Codex .mcp.json plugin servers. Closes #6646.

Changes

  1. Auth header names (item 1). In openaiMcpAuth.ts, a headerName that is not a valid header name, or is Host, now gets its own warning ("must be a valid HTTP header name other than Host"). Before, it got "needs headerScheme custom_header", even when the scheme was custom_header. A custom_header scheme without a valid name is now dropped as well, not only when the name is missing. Nothing reads these fields yet, because Xum has no api_key support.
  2. OAuth fields on stdio servers (item 2). Xum reads OAuth only for remote servers. A stdio entry with oauth, scopes or oauth_resource now gets a review warning that names them, with or without env_vars. Before, the fields were dropped silently. For this, the loader now reports translation warnings for stdio servers too. The remote OAuth handling moved, unchanged, into remoteOAuthMessages.
  3. Loader variables (item 3). env_vars names that change how the server loads code (LD_PRELOAD, LD_LIBRARY_PATH, DYLD_*, NODE_OPTIONS) still load, but the review names them in a warning (defense in depth).
  4. Windows env names (item 4). On Windows, env names are case-insensitive. The reserved-name check for env_vars and for env keys now ignores case there, so plugin_data cannot shadow PLUGIN_DATA. Duplicate env_vars names that differ only in case are merged, keeping the first spelling. Other platforms are unchanged.

Validation

New tests failed on main and pass now:

  • the header-name warnings and dropped scheme (openaiMcpAuth.test.ts);
  • the stdio OAuth and loader warnings through the real loader (mcpConfig.test.ts);
  • the Windows rules, with process.platform set to win32 in the test, as other tests in the repo do. The same test checks that Linux keeps case-sensitive names.

Risks

Low. Items 1 to 3 only add or reword warnings. Item 4 refuses a server on Windows only when it names a case variant of a reserved variable.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $91.52

… on stdio servers, compare env names without case on Windows
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T08:14:47.549925Z 1b6e5c2 Manual request
🔒 Security Review ✅ Completed 2026-10-15T08:17:02.183340Z 1b6e5c2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: 2454b9b2db

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/services/agentPlugins/openaiMcpAuth.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2454b9b2db

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Round 2 (head 45ae421): loader names are matched without case on Windows.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 45ae421bf0

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 45ae421bf0

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Round 3 (head 1b6e5c2): only a test change since round 2, to replace an untyped matcher that CI's type-aware ESLint flagged.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 1b6e5c2936

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 1b6e5c2936

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit 315ebd0 Oct 15, 2026
90 of 95 checks passed
@ThomasK33
ThomasK33 deleted the fix/codex-mcp-auth-followups branch October 15, 2026 08:41
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Oct 15, 2026
…der#6804)

Closes coder#6713

This PR does the three follow-ups from the coder#6690 readiness review
(plugin env checks).

1. **A. `=` in `env` keys:** `normalizeStdioEntry` (`mcpConfig.ts`) now
refuses an `env` key that is empty or contains `=`, as `env_vars` names
already do. A key such as `PLUGIN_DATA=/x` would set `PLUGIN_DATA` in
the joined env block. On Windows libuv sorts that block, so Xum writing
the reserved values last does not protect them. The `env` checks moved,
unchanged otherwise, into `stdioEnvError`, so that `normalizeStdioEntry`
does not grow (CRAP gate).
2. **B. Case on Windows:** `withForwardedHostEnv`
(`mcpServerManager.ts`) drops a forwarded `env_vars` name whose
`envNameKey` matches an `env` key. On Windows, `TOKEN` and `token` are
one variable, so before this change both keys reached the env block. Now
the `env` value wins, as the docs say. Elsewhere names stay
case-sensitive.
3. **C. Loader list:** `LOADER_ENV_NAME` (`openaiMcpAuth.ts`) adds
`BASH_ENV` (stdio servers start through `bash -c`, which runs the file
it names), plus `LD_AUDIT`, `NODE_PATH` and `PYTHONPATH`. `ENV` is not
added: only interactive shells read it, and `bash -c` is not
interactive. The "Plugin server environment" section of
`docs/config/mcp-servers.mdx` now says that the review warns about these
names and that Windows compares them without case.

## Validation

- Tests first. Both new tests failed before the fix: an `=` key loaded
and the new loader names had no warning (`mcpConfig.test.ts`), and on
win32 both case variants reached the env (`mcpServerManager.test.ts`).
- `mcpConfig`, `openaiMcpAuth` and `mcpServerManager` suites: 443 pass.
`make typecheck`, `make static-check`, `MUX_ESLINT_CONCURRENCY=1 make
lint-eslint` and `make crap-check` pass.

## Risks

Low. A plugin whose `env` has a key with `=` no longer loads that
server. Such a key could not set a usable variable anyway.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model:
`anthropic:claude-opus-5-5` • Thinking: `high`_
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.

🤖 fix: Codex MCP auth header validation and env_vars follow-ups

1 participant