Skip to content

fix: only send the plugin's API key to a user-configured MCP URL; least-privilege CI - #45

Open
jatinot wants to merge 14 commits into
devfrom
fix/aikido-findings
Open

jatinot wants to merge 14 commits into
devfrom
fix/aikido-findings

Conversation

@jatinot

@jatinot jatinot commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Secure prewarm hook and harden CI/CD permissions

🔒 Security · 🐛 Bug Fix · 🧪 Tests

This PR fixes a security vulnerability in the Claude Code prewarm hook by ignoring repository-local settings when resolving the MCP URL. It also hardens GitHub Actions workflows by restricting job permissions and disabling credential persistence during checkouts.

Complexity

🟢 Low · 4 files changed, 165 insertions(+), 8 deletions(-)

The changes are narrow in scope, focusing on a single security fix in the prewarm hook and standard CI/CD permission hardening, backed by a new unit test suite.

Tests

🧪 Includes a new, robust unit test suite that spins up local HTTP servers to verify the prewarm hook's security behavior.

Note

⚠️ This PR addresses a security boundary vulnerability where a malicious repository could steal a user's OpenTrace API key by overriding the MCP URL in repository-local settings.

Review focus

Pay particular attention to the following areas:

  • MCP URL resolution — verify that <cwd>/.claude/settings*.json is completely ignored and only trusted user-level settings or environment variables are used.
  • CI/CD permissions — ensure that the restricted permissions in publish.yml and ci.yml do not break any existing automated workflows.

Edwinbhart and others added 14 commits August 6, 2026 09:02
release: promote dev to main (0.3.0)
release: 0.4.0 — CLI-key onboarding, usage tracking, and browser OAuth login
release: 0.5.0 — express install, notice banner, Claude Code Desktop
release: 0.5.1 — pipeline and update-notice test
release: 0.6.0 — usage-block lifecycle, test harness, onboarding entry points
Promote dev → main: verified user-facing commands, plugin 0.5.1
The SessionStart prewarm hook resolved the MCP endpoint from the opened
repository's .claude/settings.local.json and .claude/settings.json before
the user's own settings, then POSTed the OpenTrace API key to it as a
bearer token. Any cloned repository could commit a settings file pointing
mcp_url at its own host and collect the key of everyone who opened it
with the plugin installed.

Resolve the endpoint only from OPENTRACE_MCP_URL and the user's
~/.claude settings. Nothing legitimate writes it at project scope: otx
writes mcp_url to ~/.claude/settings.json, and Claude Code reads
pluginConfigs from user settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
publish.yml granted contents: write and id-token: write at workflow
level, so the reusable ci job received them too. Grant nothing by
default and give each job its own permissions: ci reads contents,
publish keeps contents: write for the tag push and GitHub release and
id-token: write for trusted publishing.

actions/checkout persisted the job token in git config by default. Turn
that off for every ci.yml job, none of which push, and keep it explicitly
for the publish checkout, whose tag step runs an authenticated git push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@opentrace opentrace Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved

Looks good. The security improvements to the prewarm.cjs hook correctly prevent a malicious repository from exfiltrating the user's API key via a committed .claude/settings.json. The tests verify the precedence rules perfectly.

The GitHub Actions changes also correctly apply the principle of least privilege by scoping permissions to individual jobs.

Note that no ticket was referenced for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants