chore(hardening): pin the plugin catalog and stop unattended native updates - #6
Merged
Conversation
…pdates The plugin catalog decides which plugins are offered and where their archives come from, and an installed plugin can declare a spawnable mcpServers command, so whoever serves that file effectively chooses code that runs on the machine. Require https and an allowed host, defaulting to code.kimi.com and cdn.kimi.com, with KIMI_CODE_PLUGIN_MARKETPLACE_ALLOWED_HOSTS for a self-hosted catalog. Require https for remote plugin archives too. Plaintext to loopback stays allowed: a local dev or test server has no network path to tamper with, and several suites rely on it. Stop auto-running the native updater. It is curl | bash against the CDN with nothing verifying the response, so running it unattended in the background turns a bad day at the CDN into local code execution. The command is surfaced for the user to run instead, which is what the Windows path already did. Tests that asserted the old behaviour now assert the new one, and the two catalog tests that use a placeholder host name it through the allowlist env the way an operator would. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Three ways code could arrive on the machine with nothing binding it to a publisher.
http://.resolveMarketplaceLocationaccepted anything, andKIMI_CODE_PLUGIN_MARKETPLACE_URLcan point it anywhere. The catalog chooses which plugins are offered, where their archives come from, and carries thetier: "official"label — and an installed plugin can declare anmcpServerscommand that gets spawned. Whoever serves that file effectively chooses code that runs locally.http://.resolveInstallSourceturned any non-GitHub http(s) URL into azip-url, unsigned.nativeinstall, the background auto-update spawnedbash -c "set -o pipefail; curl -fsSL …/install.sh | bash"— detached, output discarded, nothing verifying the response.What changed
code.kimi.com/cdn.kimi.com, or named inKIMI_CODE_PLUGIN_MARKETPLACE_ALLOWED_HOSTS(comma-separated) so a self-hosted internal catalog stays possible. Errors name the offending host and the env var, so the fix is obvious from the message.localhost/127.0.0.1/::1stays allowed. There is no network path to tamper with, and local dev/test servers legitimately use it — without this, several existing suites andpnpm dev:plugin-marketplacewould break for no security gain.canAutoInstall('native')is nowfalseon every platform, so the updater prints the command instead of running it. This mirrors what the Windows path already did.Behaviour change worth reviewing
npm/pnpm/yarn/buninstalls are unaffected, since those go through the registry.Testing
http://was accepted;curl|bashspawn — it now mirrors the existing win32 "prints manual command, does not spawn" test;example.test/example.com) and now name them through the allowlist env, so they keep testing loader mechanics rather than host policy. The TUI "marketplace unreachable" test in particular stays a test about an unreachable catalog, not a blocked one.oxlintclean on changed files (one pre-existingdirnamewarning inplugin-marketplace.tspredates this branch — confirmed onmain);tsc --noEmitclean for all three projects.Checklist
minor).