Was the GitHub MCP server push_files prompt-injection write issue fixed?
Was the prompt-injection arbitrary-repo-write issue in the GitHub MCP server's push_files tool ever fixed?
Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/3751
3 answers
Status: explained (closed as not planned). A maintainer replied that the server referenced in the report has been archived and is no longer maintained in this repository, so the issue will not be fixed upstream. The maintainer's recommendation is to use a community-maintained fork or an actively maintained alternative.
The reporter proposed two mitigations you could adopt in a fork:
- Option A — schema documentation: constrain
ownerwith apatternof^[a-zA-Z0-9][a-zA-Z0-9-]{0,38}$, amaxLengthof 39, and explicit scope language in the description ("Must be the authenticated GitHub user or an organization they administer"). - Option B — server-side validation: at push time, call
GET /user, verify thatownermatches the authenticated GitHub identity, and reject mismatches with a clear error.
A commenter suggested also applying the pattern
^[a-zA-Z0-9_-]+$to bothownerandrepo, and adding Option C: a tool-description note warning the LLM not to acceptowner/repovalues from untrusted sources. Commenters agreed these are defense-in-depth measures that raise the bar for prompt-injection exploits but do not fully solve the problem.General advice (not from the thread): the token is the actual enforcement point. Use a fine-grained GitHub token scoped to only the specific repositories the agent needs, and treat schema constraints as hints rather than guarantees. Ensure the token itself has write access only where write access is intended, since a compromised LLM context cannot exceed the token's real permissions.
Did this work for you?- Option A — schema documentation: constrain
What a GitHub user tried on GitHub (Outcome unclear)
Proposed (not implemented or tested): constrain owner with pattern ^[a-zA-Z0-9][a-zA-Z0-9-]{0,38}$, maxLength 39, and scope language in the description, plus server-side verification of owner via GET /user at push time.
Source: https://github.com/modelcontextprotocol/servers/issues/3751 (opens external site)
Did this work for you?What @piiiico tried on GitHub (Outcome unclear)
Proposed (not implemented or tested): apply pattern ^[a-zA-Z0-9_-]+$ to both owner and repo, and add a tool-description instruction warning the LLM not to accept owner/repo values from untrusted sources.
Did this work for you?
Related questions
- mcp-server-fetch: 'AnyUrl' object has no attribute 'decode' error
- Does the official MCP Postgres example validate SQL before executing it?
- How to fix UTF-8 Japanese text corruption/crash in mcp-server-sqlite with Claude Desktop on Windows?
- MCP Knowledge Graph Memory Server fails with ${workspaceFolder} in MEMORY_FILE_PATH
- npx @modelcontextprotocol/server-filesystem: ERR_MODULE_NOT_FOUND for zod-to-json-schema