MCP gateway conversion silently drops a server named `__proto__`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- github-actions, javascript, node.js
- Ambito
- devtools
Direzione di ricerca
Inizia da filterAndTransformServers in actions/setup/js/convert_gateway_config_shared.cjs, dove result[name] = transformServer(name, entry) assegna valori a un oggetto semplice. Confronta con loadCopilotSDKMCPServers in actions/setup/js/copilot_sdk_tool_config.cjs, che usa Object.defineProperty, e con il suo test su __proto__ in copilot_sdk_tool_config.test.cjs. Il lavoro è completato quando un server proto sopravvive in entrambi i cataloghi e il numero di server inclusi corrisponde al numero di server di origine.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The shared gateway-to-Copilot converter copies MCP servers into its result object with a plain property assignment. When a workflow declares an MCP server named __proto__, that assignment mutates the result object's prototype instead of creating an own key, so the server silently disappears from both generated Copilot catalogs: the CLI catalog at $HOME/.copilot/mcp-config.json and the SDK catalog at $RUNNER_TEMP/gh-aw/mcp-config/copilot-sdk.json. The SDK catalog loader in the same repository is explicitly implemented and unit-tested to preserve exactly such names, and the compiler accepts the name, so the producer and the consumer of the same catalog disagree about which servers exist.
Environment
- Repository: github/gh-aw, commit
e507073a5b3dca9ed1e859e9af837561f8652f81; the same converter assignment is still present on the default branch. - Files:
actions/setup/js/convert_gateway_config_copilot.cjs,actions/setup/js/convert_gateway_config_shared.cjs(functionfilterAndTransformServers),actions/setup/js/copilot_sdk_tool_config.cjs(functionloadCopilotSDKMCPServers). - Runtime: Node.js 22.23.5 on Linux.
- Input: a workflow that declares two MCP servers, one of them named
__proto__, and the gateway-output catalog for that configuration.
Expected behavior
A workflow may legally declare an MCP server named __proto__: compilation succeeds and the generated gh-aw-manifest lists it, and the generated gateway configuration contains that server. Conversion should carry the server into the Copilot CLI catalog and the SDK catalog unchanged, and the SDK session loader should register it. That is the contract the repository already asserts in actions/setup/js/copilot_sdk_tool_config.test.cjs with the test named "preserves a literal proto server as an own property without changing the dictionary prototype", and the loader's own comment says it preserves "names such as proto as own keys without invoking inherited setters".
Actual behavior
The compiler accepts the name and emits the server:
compiled manifest mcp server names: ['__proto__', 'github', 'safeoutputs']
gateway configuration emitted for the agent:
"__proto__": {
The converter then drops it and reports an incorrect filter count, because it computes the filtered number by subtraction from the input size:
[info] Converting gateway configuration to Copilot format...
[info] Target domain: host.docker.internal:80
[info] Servers: 1 included, 1 filtered (CLI-mounted)
[info] Converted servers: github
Both generated catalogs contain only the second server:
{
"mcpServers": {
"github": {
"type": "http",
"url": "http://host.docker.internal:80/mcp/github",
"timeout": 30000,
"tools": [
"*"
]
}
}
}
The SDK session therefore cannot register the missing server:
registered server names: ["github"]
__proto__ registered: false
Root cause
filterAndTransformServers in actions/setup/js/convert_gateway_config_shared.cjs builds the converted catalog with a plain object and a dynamic assignment:
const result = {};
for (const [name, value] of Object.entries(servers)) {
if (cliServers.has(name)) continue;
const entry = { ...value };
result[name] = transformServer(name, entry);
}
return result;
When name is __proto__, result["__proto__"] = ... invokes the inherited Object.prototype.__proto__ accessor: it replaces the prototype of result with the transformed server object instead of defining an own enumerable property. JSON.stringify({ mcpServers: result }) only serializes own enumerable properties, so the server is absent from both catalogs that are written from this result. The negative side effect is also visible in the log line "1 included, 1 filtered (CLI-mounted)", which reports a filter that never happened because the count is computed as total minus Object.keys(result).length.
The consumer side already handles the same name correctly: loadCopilotSDKMCPServers in actions/setup/js/copilot_sdk_tool_config.cjs registers each entry with Object.defineProperty(servers, name, { value: server, enumerable: true, configurable: true, writable: true }) and has a dedicated test for __proto__. The converter that produces the catalog read by that loader does not follow the same rule.
Suggested fix
Define own properties in filterAndTransformServers instead of assigning them, for example by building the result from Object.defineProperty(result, name, { value: transformServer(name, entry), enumerable: true, configurable: true, writable: true }), or by returning Object.fromEntries over the filtered entries, which also creates data properties and never invokes inherited setters. Add a regression test that runs a gateway-output catalog containing a __proto__ server through the full conversion pipeline and asserts that the name survives serialization in both the CLI and SDK catalogs, and that the "included" count matches the number of source servers.
- Lingua principale
- Go
- Stelle
- 5.7k
- Fork
- 635
- Merge medio
- 3h 43m
- PR unite (30g)
- 838
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/gh-aw
-
automation backlog:reports documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
ai-inspected
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
github/gh-aw#80646 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
automated-analysis backlog:engineering-quality code-quality cookie refactoring
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
ai-inspected backlog:security
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
github/gh-aw#79301 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: arc-dind generated Copilot CLI staging step fails when source and destination are the same fileApertaai-inspected arc awf backlog:runners-tools community
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
github/gh-aw#78972 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di github/gh-aw
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
unbound-force/replicator#193 ·
I maintainer di solito rispondono entro 2 giorni
-
A Gemini stream that fails partway completes the call with the partial textForse già presa @bnaylor l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
go-steer/core-agent#1600 ·
I maintainer di solito rispondono entro 1 giorno
-
bug raised-by:reviewer
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
medici-finance/assay#7655 ·
I maintainer di solito rispondono entro 1 giorno
-
Add /exit and /quit commandsApertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Edwin-metcalf/MetCode#67 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno