Skip to content

fix(security): confine MCP credential paths; publish only announced records - #1795

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/credential-path-and-publish-gate
Oct 24, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/credential-path-and-publish-gate

Conversation

@potiuk

@potiuk potiuk commented Oct 24, 2026

Copy link
Copy Markdown
Member

Summary

Two tools that run outside the agent's sandbox trusted inputs the agent controls:

  • gmail-plaintext MCP server — credentials_path was unconfined. It is a tool argument, so whoever drives the agent chose it: setup_credentials could write the Gmail refresh token wherever a sandboxed command can read it (defeating the ~/.config/apache-magpie* read deny), and create_draft / check_auth could load a planted credentials file. A caller-supplied path must now be a .json file 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-state accepted any value, so a DRAFT could be pushed to PUBLIC, and nothing confirmed the advisory had shipped, which is the gate the move stands for. --allow-state is now limited to REVIEW / READY, and the move refuses (new exit code 4, also in dry-run) a record whose references[] has no entry tagged vendor-advisory — the tag generate-cve-json gives the archived advisory URL. The issue-sync publish step documents both.

Type of change

  • Python package (tools/gmail/oauth-draft, tools/cve-tool-vulnogram/oauth-api, and their magpie-security-tools copies)
  • Skill change (issue-sync/apply-and-push.md: publish preconditions, exit code 4)

Test plan

  • prek run on the changed files passes
  • pytest for tools/gmail/oauth-draft (with the mcp extra) and tools/cve-tool-vulnogram/oauth-api: all pass
  • New tests: setup_credentials refuses 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 no vendor-advisory reference (or only a patch one) is not published and nothing is POSTed; --allow-state DRAFT|PUBLIC|REJECTED is rejected
  • roborev review clean

RFC-AI-0004 compliance

  • Sandbox — closes a credential-exfiltration path through an unsandboxed MCP server
  • HITL — CVE publication now requires the shipped-advisory evidence the gate is defined by

Gen-AI disclosure: drafted with Claude Code (Opus 5); reviewed by the submitter.

🤖 Generated with Claude Code

…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
@github-actions github-actions Bot added family:security security-* skills family:tools tools/* capability:intake Import external signal + sync tracker state contract:mail-archive Tool capability: mailing-list / forum archive reads contract:mail-source Tool capability: inbound-mail ingestion (mbox / IMAP / ...) contract:mail-create Tool capability: outbound mail composition (editable draft; sending is a separate human step) contract:cve-authority Tool capability: CVE allocation / record management / publication labels Oct 24, 2026
@potiuk
potiuk enabled auto-merge (squash) October 24, 2026 23:39
@potiuk
potiuk merged commit 6e277bf into apache:main Oct 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:intake Import external signal + sync tracker state contract:cve-authority Tool capability: CVE allocation / record management / publication contract:mail-archive Tool capability: mailing-list / forum archive reads contract:mail-create Tool capability: outbound mail composition (editable draft; sending is a separate human step) contract:mail-source Tool capability: inbound-mail ingestion (mbox / IMAP / ...) family:security security-* skills family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant