Files
dcf9c5a0be fix(config): expand MCP header env refs without wiping MCP set (#12554)
* fix(config): expand MCP header env refs without wiping MCP set

Project kilo.jsonc with {env:…} in MCP headers caused the whole config
load to fail since 7.4.5, silently removing every MCP. Leave {env:} literal
during untrusted text substitution, expand only remote MCP headers after
parse, and drop individual MCPs with blocked env refs instead of the full set.

Fixes #12319

* fix(config): ban {file:} during MCP header env expansion

Post-parse header expand used trusted substitute without fileScope, so a
decoy in-repo {file:} plus any {env:} could read arbitrary paths into
remote MCP headers. Expand only {env:} and reject residual {file:}.

* fix(config): ban env secret expansion in project MCP headers

Untrusted project MCP headers must not read process.env or authEnv.
Reject {env:} and {file:} per entry with a warning so sibling MCPs still load.

* fix(config): drop global MCP headers on project URL retarget

When a project config overrides a same-named global remote MCP with a
new URL and does not restate headers, do not inherit expanded secret
headers from the global entry. Also fix MCP union narrowing in tests
and stop saying "header env expansion failed" when only validating.

* fix(config): do not mutate caller's patch in mergeConfig

Shallow-copy patch before delete p.mcp so probe-then-write
updateProjectConfig paths keep mcp on the original object.

* fix(config): secure project MCP header loading

* Update packages/opencode/src/config/config.ts

Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>

* fix(config): secure layered MCP transitions

---------

Co-authored-by: arimu1 <19286898+arimu1@users.noreply.github.com>
Co-authored-by: Johnny Eric Amancio <johnnyeric@gmail.com>
Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
2026-08-10 19:45:45 +02:00
..
2026-07-30 14:24:24 +02:00
2026-07-30 14:24:24 +02:00
2026-07-29 02:06:01 +02:00
2026-07-22 13:31:23 +02:00
2026-07-30 14:24:24 +02:00
2026-07-29 02:06:01 +02:00
2026-07-13 18:00:35 +02:00
2026-07-29 02:06:01 +02:00
2026-07-29 02:06:01 +02:00
2026-07-30 14:24:24 +02:00
2026-07-30 14:24:24 +02:00
2026-07-30 14:24:24 +02:00
2026-07-29 02:06:01 +02:00
2026-07-30 14:24:24 +02:00
2026-07-30 14:24:24 +02:00
2026-07-30 14:24:24 +02:00
2026-07-30 14:24:24 +02:00
2026-07-13 19:15:48 +02:00
2026-07-22 13:31:23 +02:00