Skip to content

feat(triage): kit triage release checks a prebuilt release archive or binary - #1108

Merged
sandstream merged 2 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a-triage-release
Nov 27, 2026
Merged

sandstream merged 2 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a-triage-release

Conversation

@sandstream

Copy link
Copy Markdown
Owner

What

kit triage release <url|file> checks a prebuilt release archive or binary before it is extracted, made executable, run or put on PATH. It closes the triage half of gap G1 in kit-research#233: kit triage --help had pkg for macOS installers and nothing for a release archive or a bare binary.

Five checks, each pass / fail / unverified, reported the way kit triage pkg reports them:

Check Passes when Fails when Unverified when
checksum SHA-256 matches --checksum (hex or a list file), else every checksum source the publisher put next to the asset (checksums.txt, SHA256SUMS, *_checksums.txt, <asset>.sha256) and GitHub's own asset digest any source disagrees, or a list names the asset with two hashes nothing given or published
signature a minisign (.minisig, Ed25519, prehashed ED or legacy Ed, plus the trusted-comment signature) or cosign key (.sig, ECDSA/RSA over SHA-256) signature verifies with a key the user names (--minisign-key, --cosign-key), on the asset or on a checksum list that covers it it does not verify, it is another key's, or a key was given and no signature is published OpenPGP .asc, keyless Sigstore bundles, a signature with no key, or no signature
age a GitHub release's published_at is past the cooling period ([supply_chain], KIT_MIN_RELEASE_AGE_DAYS, KIT_COOLING_ENFORCE: the same coolingCheck packages use) inside the period, a draft, or a releases/latest/download URL (it moves) not GitHub, the API gave nothing, or air-gap with no KIT_GITHUB_API
repository --repo owner/repo matches the URL it does not, or GitHub serves the release from another repository (moved or renamed) no --repo, or not GitHub
archive every tar, tar.gz, tar.zst (where Node has zstd) or zip member stays in the tree; a lone executable or gzip'd file is "not an archive" absolute paths, .., symlinks or hard links out of the tree, setuid/setgid, device/fifo entries, a malformed archive xz, bzip2, 7z, zip64, unknown bytes

It passes only with no fail and every unverified check accepted by name (--accept-unverified signature,age), so an unsigned release is never a silent pass. A pass for a URL appends a release receipt (canonical URL, contentDigest: sha256:…) to .kit-triage.jsonl; a local file without --url gets no receipt and is told why.

Design decisions

  • Never execute anything from the archive. Members are read from tar headers and the zip central directory; data blocks are skipped, not kept. A download goes into a fresh mkdtemp directory (0600, wx) and is removed, and the streams are closed before removal so Windows does not hold the file.
  • Trust no key from the release. Whoever can replace the asset can replace a minisign.pub next to it, so the key comes from the user. A checksum list from the same release is integrity only; the report says the signature is what speaks to authenticity.
  • Same rules as packages. Cooling uses coolingCheck, limitFrom and enforceFrom; air-gap uses registryBase(… "KIT_GITHUB_API" …) and downloads nothing; the GitHub token goes only to the API base, never to a download host.
  • No new dependency (ADR-0002), no model (ADR-0001). node:crypto (Ed25519, BLAKE2b-512, ECDSA), node:zlib, fetch.
  • src/commands/triage-release.ts already holds triage cargo|go, so the command lives in triage-release-asset.ts.

Docs

docs/COMMANDS.md is at its 600-line cap, so triage release is folded into the triage pkg row (still 600 lines). Help entry in src/subcommand-help.ts, help row, TRIAGE_TYPES, docs/FEATURES.md, changelog fragment changes/triage-release.md. src/flag-surface.ts, contracts/public-surface.json and contracts/kit.opencli.json regenerated after a build.

Tests

A sibling test for each new module (10 files, 29 tests): archives built in memory, keys generated in the test, stubbed fetch, neutral hosts (h.example); no real download. 722 net new test lines, stated in a Test-Growth: trailer. Smoke-tested against real GNU tar and Info-ZIP zip -y output (a symlink to /etc/passwd fails in both).

Prepush

node scripts/prepush.mjs --allow "enforcement gate liveness" (run on the stacked branch, which contains this one): build, format, lint, changed-file tests, coverage gate, test growth (trailer), self-audit and the session-URL checks pass; kit adr check passes. Only the known local-only items remain: kit review --enforce (setup gaps: gh auth, infisical, uninstalled scanners) and Semgrep not run (!, 1.184.0 not installed).

Platforms

Linux tested. The code uses node:path, no shell and no child process. Windows runs in CI. macOS is unverified: no CI job runs it.

The gate that asks for this receipt is the stacked protected PR.

Refs kit-research#233.


Generated by Claude Code

… binary

kit had no triage for the install path a prebuilt binary takes: download,
extract, chmod +x, run or move onto PATH (kit-research#233, G1). `kit triage
release <url|file>` reports five checks, each pass, fail or unverified as
`kit triage pkg` does:

- checksum: SHA-256 against --checksum, or the publisher's checksum files next
  to the asset (checksums.txt, SHA256SUMS, <asset>.sha256) and GitHub's asset
  digest; sources that disagree fail;
- signature: minisign or cosign with a key the user names, verified with
  node:crypto; never a key from the release itself. OpenPGP and keyless
  Sigstore are unverified;
- age: a GitHub release's publish date through the cooling period; a
  latest/download URL and a draft fail;
- repository: against --repo, and against the repository GitHub serves the
  release from;
- archive: tar, tar.gz and zip members, read from headers only, failing
  absolute paths, "..", links out of the tree, setuid/setgid and special
  entries. xz, bzip2 and 7z are unverified.

It passes only when every unverified check is accepted by name, and a pass
for a URL records a `release` receipt with the file's digest. Nothing from
the file is executed. No new dependency.

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

CI's coverage gate wants a sibling test for every new source file, so the
archive, signature, checksum-source, URL and cooling tests move next to the
modules they test, and the tar, zip and URL parsers get direct tests.

Also:
- close the archive file stream however the listing ends, so Windows does not
  hold the download when the temporary directory is removed;
- a zstd stream that holds a single file is "not an archive", as gzip's is;
- a missing or garbled Content-Length is not taken as small;
- helpers no other file uses are no longer exported.

Test-Growth: a new triage command with five checks over three archive formats, two signature schemes and four checksum forms; each module needs its own fixtures, and the coverage gate requires a sibling test per module.

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

Copy link
Copy Markdown

Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published.

@sandstream
sandstream merged commit 6b56df7 into main Nov 27, 2026
33 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a-triage-release branch November 27, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants