Repository navigation
fix(security): confine MCP credential paths; publish only announced records - #1795
Merged
Merged
Conversation
…ecords The gmail-plaintext MCP server runs outside the sandbox and took any credentials_path from a tool call: setup_credentials could write the refresh token where a sandboxed command reads it, and the other tools could load a planted file. A caller path must now be a .json file directly in ~/.config/apache-magpie/ or the directory of $GMAIL_OAUTH_CREDENTIALS, reached without a symlink. vulnogram-api-record-publish accepted any --allow-state and published without checking the advisory had shipped. --allow-state is now limited to REVIEW / READY, and the move refuses (exit 4) a record with no references[] entry tagged vendor-advisory. Generated-by: Claude Opus 5
potiuk
enabled auto-merge (squash)
October 24, 2026 23:39
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.
Summary
Two tools that run outside the agent's sandbox trusted inputs the agent controls:
gmail-plaintextMCP server —credentials_pathwas unconfined. It is a tool argument, so whoever drives the agent chose it:setup_credentialscould write the Gmail refresh token wherever a sandboxed command can read it (defeating the~/.config/apache-magpie*read deny), andcreate_draft/check_authcould load a planted credentials file. A caller-supplied path must now be a.jsonfile directly in~/.config/apache-magpie/or in the directory of$GMAIL_OAUTH_CREDENTIALS(the server's own configuration, not a tool call), with no symlink on the file or its directory. Omitting it keeps the default lookup.vulnogram-api-record-publish— the publish gate was not checked.--allow-stateaccepted any value, so aDRAFTcould be pushed toPUBLIC, and nothing confirmed the advisory had shipped, which is the gate the move stands for.--allow-stateis now limited toREVIEW/READY, and the move refuses (new exit code 4, also in dry-run) a record whosereferences[]has no entry taggedvendor-advisory— the taggenerate-cve-jsongives the archived advisory URL. Theissue-syncpublish step documents both.Type of change
tools/gmail/oauth-draft,tools/cve-tool-vulnogram/oauth-api, and theirmagpie-security-toolscopies)issue-sync/apply-and-push.md: publish preconditions, exit code 4)Test plan
prek runon the changed files passespytestfortools/gmail/oauth-draft(with themcpextra) andtools/cve-tool-vulnogram/oauth-api: all passsetup_credentialsrefuses a path outside the credential directories (relative, wrong suffix, elsewhere) before running the consent flow or writing anything; a symlinked credentials path is refused; a path in the configured directory is accepted; a record with novendor-advisoryreference (or only apatchone) is not published and nothing is POSTed;--allow-state DRAFT|PUBLIC|REJECTEDis rejectedroborevreview cleanRFC-AI-0004 compliance
Gen-AI disclosure: drafted with Claude Code (Opus 5); reviewed by the submitter.
🤖 Generated with Claude Code