Repository navigation
feat(install-gate): block a prebuilt binary install without a kit triage release receipt - #1109
Merged
sandstream merged 5 commits intoNov 27, 2026
Conversation
…age release receipt A download followed by an extract and a run, a chmod +x, a build in the extracted tree, a move onto PATH or install(1) passed kit gate-bash silently (kit-research#233, G1), while npm i -g is held by cooling and curl | sh is refused. install-gate-release.ts reads a command's segments in order: fetches (curl, wget, gh release download, Invoke-WebRequest -OutFile, Start-BitsTransfer), extractions (tar, unzip, 7z, gunzip and friends, Expand-Archive), and the steps that execute or place what was fetched. Each chain needs a fresh `release` receipt for its URL in .kit-triage.jsonl (the 7-day window other triage uses); without one the gate blocks with exit 2 and names the exact `kit triage release <url>` command. - A bare download is allowed; so is extraction, except into an install location (/usr/local, /opt, bin directories, C:\Program Files). - A source tarball built after cd into it (or make -C) counts as running it. A dataset extracted beside the caller's own make or python script does not. - Fail-closed: an expanded URL or file name, gh release download with a glob, curl -K, wget -i, or a move to an expanded destination is refused. - PowerShell forms are read with backslash paths intact, for tool names Bash and PowerShell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's coverage gate wants a sibling test per new source file. The fetch and step forms move to install-gate-release-steps.test.ts and the cases that are not chains to install-gate-release-uses.test.ts, both read through parseInstallCommand so `sh -c` and `powershell -Command` bodies are covered; they gain direct checks of the curl, wget, Invoke-WebRequest and gh parsers and of the extract, run and destination readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
kit review gate at 660747771f59: not approved.
- touches protected paths (permissions), which the owner approves:
src/install-gate-release-steps.test.ts,src/install-gate-release-steps.ts,src/install-gate-release-uses.test.ts,src/install-gate-release-uses.ts,src/install-gate-release.test.ts,src/install-gate-release.ts,src/install-gate.ts
Base automatically changed from
claude/web-kit-status-sync-p6fg9a-triage-release
to
main
November 27, 2026 11:26
…-sync-p6fg9a-protected-release-binary-gate # Conflicts: # docs/COMMANDS.md # docs/INSTALL_GATE.md
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
There was a problem hiding this comment.
kit review gate at 8048dc824f72: not approved.
- checks did not pass: CodeQL, build-and-test, checks (format, lint, build, gates)
- touches protected paths (permissions), which the owner approves:
src/install-gate-release-steps.test.ts,src/install-gate-release-steps.ts,src/install-gate-release-uses.test.ts,src/install-gate-release-uses.ts,src/install-gate-release.test.ts,src/install-gate-release.ts,src/install-gate.ts
…pe the URL fully in the release test gateVerdict went over the CCN 15 standards limit with the release-binary refusal. The test built a regex from a URL escaping only . and ?, which CodeQL flags as incomplete escaping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
…lease-binary-gate Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
There was a problem hiding this comment.
kit review gate at d9dfe4ca3450: not approved.
- touches protected paths (permissions), which the owner approves:
src/install-gate-release-steps.test.ts,src/install-gate-release-steps.ts,src/install-gate-release-uses.test.ts,src/install-gate-release-uses.ts,src/install-gate-release.test.ts,src/install-gate-release.ts,src/install-gate.ts
sandstream
deleted the
claude/web-kit-status-sync-p6fg9a-protected-release-binary-gate
branch
November 27, 2026 13:37
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.
Protected paths (
src/install-gate.ts). This PR is the owner's to merge. Stacked on thekit triage releasePR (#1108), which must merge first.What
kit gate-bashpassed a prebuilt binary install silently (kit-research#233, G1). Meanwhilenpm i -gwas held by cooling andcurl … | shwas refused:Now that command exits 2:
With a
releasereceipt for that URL from the last 7 days in.kit-triage.jsonl(the same file, window andfreshReceiptsreader as the bare-install gate), it exits 0. URLs are compared in one canonical spelling (src/release-url.ts, shared with the triage command).How
src/install-gate-release*.ts(new) reads one command's pipelines in order.install-gate.tsgains 7 lines:parseInstallCommandcollects the chains for every command it already scans (nestedsh -c,$(…),powershell -Command, heredoc expansions), andgateVerdictchecks them before the "no install" early return.-o,-O,-J,--url, clusters such as-fsSLO), wget,gh release download -R o/r <tag> -p <asset>,Invoke-WebRequest/iwr/Invoke-RestMethod/curl/wgetwith-OutFile,Start-BitsTransfer. A fetch piped intotar x/gunzipcounts as fetched and extracted.-C), unzip-d,7z x -o, gunzip/xz/bzip2/zstd-d,Expand-Archive -DestinationPath.Unblock-File, running it (./x, an interpreter's script,Start-Process,& .\x.exe,msiexec /i),mv/cp/ln/rsync/Move-Item/Copy-Itemonto PATH (/usr/local/binand otherbindirs,~,$HOME,/home/*,/Users/*,$env:LOCALAPPDATA,%LOCALAPPDATA%,C:\Program Files),install(1)anywhere, and extraction straight into an install location (-C /usr/local,/opt,C:\Program Files). A rename keeps the file's origin.Decisions
curl -O x.tar.gz, or a download that is only extracted or read (jq . a.json), stays allowed.make: yes, that is an install../configure,makeandcmakerun build files that came in the download. A build aftercdinto the extracted tree, ormake -C <dir>, counts as running the fetched code.curl -O data.tar.gz && tar xzf data.tar.gz && make train(orpython train.py) does not: a bare name or a build with nocdruns the caller's own tree. A./pathordir/pathrun after an extraction does count.curl -o x $URL),gh release downloadwith a glob or without-Rand a tag,curl -K,wget -i, a move to an expanded destination, or no directory to read receipts from is refused as unverifiable.chmod +x ./scripts/build.shwith no download in the command,git clone … && make,tar xzf vendored.tgz && ./vendored/run(nothing fetched).curl -o x.sh https://h.example/install.sh && sh x.shpassed silently before; it now needs a receipt. A GitHub-hosted one still also gets its existing repo triage..\setup.exeinto.setup.exe).Limits (also in docs/INSTALL_GATE.md)
Bash(src/agent-config.ts). The gate reads the command the same way for tool namePowerShell(tested end to end throughkit gate-bash), but Claude Code only sends PowerShell tool calls to it if the matcher includes them. Widening the matcher is an owner decision for a follow-up; it changes every installed hook config.Tests
Three sibling test files, 36 tests, offline, receipts written by hand (
install-gate-release.test.ts,-steps.test.ts,-uses.test.ts): the G1 chain blocks and names the command; fresh, canonical-spelling, stale (8 days), other-URL and wrong-type receipts; 10 POSIX and 6 PowerShell chains; 9 false-positive guards; source tarballs; unreadable chains; and the compiledkit gate-bashhook exiting 2 then 0 for tool namesBashandPowerShell. All existing tests that touch the gate (51 files) still pass.Platforms
Linux tested. Pure string parsing with no fs, shell or process code beyond the shared receipt reader. The PowerShell and Windows-path cases run on the Windows CI shards. macOS is unverified: no CI job runs it.
Prepush
node scripts/prepush.mjs --allow "enforcement gate liveness"on this branch: build, format, lint, changed-file tests, coverage gate, test growth (964 net lines over both PRs, reason in theTest-Growth:trailer of #1108's second commit; 242 of them here), self-audit and the session-URL checks pass;kit adr checkpasses (no new dependency, no model). Only the known local-only items remain:kit review --enforce(setup gaps:gh auth, infisical, uninstalled scanners) and Semgrep not run (!).This PR does not touch
src/commands/gate.ts, so I expect no conflict with the fail-closed deny-path work there. The refusal text goes through gate.ts's existingtriageAdvice, which appends its genericTriage it firstline after the exactkit triage release <url>command.Refs kit-research#233.
Generated by Claude Code