Repository navigation
fix(triage): forgeable PASS verdict defeats the install gate [CRITICAL] - #70
Merged
Merged
Conversation
`runTriage` decided success with `output.includes("TRIAGE PASSED")`, and the
triage script echoes the (attacker-influenceable) target into its output header
(`Triage: <type> <target>`). So a target whose text contains the literal
`TRIAGE PASSED` — or an embedded newline that starts such a line — forges a pass
even when the script printed `TRIAGE FAILED` with critical findings. Every gate
consumer is affected: `gateInstall` (triage-gate.ts), `installPkg` (pkg.ts, whose
`parsePkgSpec` does no marker/whitespace validation), and `kit triage` (cli.ts).
This breaks kit's load-bearing "installs nothing untriaged" guarantee — any
attacker-influenced target (a `.kit.toml` tool ref, a docker image arg, a skill
name, a crafted version) can forge a PASS.
Fix (defense-in-depth, safe against an older already-installed script too):
- kit `verdictPassed()` now requires an EXACT standalone `TRIAGE PASSED` line
(not a substring) and treats any `TRIAGE FAILED` line as authoritative — a
genuine failure always prints it, so an injected PASS line can't override a
real failure. Neither line → fail-closed.
- triage.py sanitizes the echoed target (strips CR/LF) so it cannot fabricate a
standalone verdict line at the source.
Regression tests cover the substring-on-header case, the newline-injection case
(overridden by the real FAILED), and the neither-line fail-closed case.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
|
✅ Docker image built successfully
|
Closed
3 of 4 tasks
sandstream
added a commit
that referenced
this pull request
Jun 24, 2026
….0 (#97) * recover(#94): feat(agent-audit): cover Claude command/agent/skill/plugin + settings exec surfaces * recover(#90): feat(audit): SIEM export (CEF / syslog / json) * chore(release): 1.24.0 — consolidated security batch + recovered #90/#94 Documents the merged hardening batch (#70-89) and bumps the version. The two recovered features (#90 SIEM export, #94 Claude agent-audit surfaces) were auto-closed when their stacked base branches were deleted on merge; recovered here via the PRs' own deltas onto current main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * style: prettier-format recovered #90/#94 files --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
sandstream
added a commit
that referenced
this pull request
Jun 24, 2026
…#80) (#106) * feat(scan): offline air-gap mode (KIT_AIRGAP=1) for `kit scan` Second step of the no-egress roadmap (#80), building on the configurable triage mirrors. With `KIT_AIRGAP=1`, `kit scan` runs entirely against pre-synced local databases: - `airGapScanners()` (pure, tested) drops cloud-only scanners (snyk, semgrep) and folds each remaining scanner's offline flags/env in: trivy gains `--offline-scan --skip-db-update`, osv-scanner gains `--offline`, grype gets `GRYPE_DB_AUTO_UPDATE=false`. - `isAirGap()` reads the toggle; `cmdScan` applies the plan, injects the offline env into each scanner run, and prints which cloud-only scanners were skipped. - `docs/AIR_GAP.md` §2 documents the toggle + per-scanner behavior and how to pre-sync each DB on a connected host. Local-ruleset support for semgrep offline is a tracked follow-up. No behavior change when KIT_AIRGAP is unset (transform is a no-op). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg * feat(airgap): verified offline threat-data bundle for kit scan Third step of the no-egress roadmap (#80). In an enclave the scanners' vuln DBs (and the bumblebee catalog) are synced in from a connected host; stale or tampered threat data silently degrades every verdict. This adds a trust chain that is FULLY OFFLINE-VERIFIABLE (no Fulcio/Rekor): - New `src/airgap/threat-data.ts`: a bundle = `manifest.json` (artifacts + SHA-256, each with an optional `env` to wire a scanner) + a detached `manifest.json.sig` (Ed25519 over the manifest). `verifyThreatData()` verifies the signature against a trusted key (KIT_THREAT_DATA_PUBKEY), then SHA-256s every artifact, then returns the env wiring. Any failure rejects the whole bundle (fail-closed). Manifest paths are validated against `..`/absolute escape. - `kit scan` (air-gap): when `KIT_THREAT_DATA_DIR` is set it verifies the bundle before scanning and REFUSES to run on any failure, else injects the verified env so scanners use the local DBs. node:crypto only; deterministic. - Tests cover signed round-trip, tamper, wrong-key, missing artifact, missing manifest/sig, and manifest shape/escape validation. - docs/AIR_GAP.md documents the bundle format + build steps. Stacked on the offline-scan-mode branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg * feat(airgap): declarative [air_gap] config in .kit.toml Fourth step of the no-egress roadmap (#80). The air-gap posture (mirrors, offline mode, threat-data bundle) was env-only; this lets it be checked in so an enclave config is reproducible and versioned. - New `[air_gap]` section in the config schema (interface + zod): `enabled`, `npm_registry`/`pypi_index`/`github_api`/`docker_registry`, `threat_data_dir`/`threat_data_pubkey`. - `resolveAirGap(config, env)` (pure, tested) merges config + env with **env taking precedence**; `airGapTriageEnv()` emits the mirror vars to inject. - `kit scan` resolves the posture from config+env (so `enabled = true` in `.kit.toml` turns on offline mode without an env var) and reads the threat-data dir/pubkey from the resolved settings. - `runTriage` injects config-declared mirror env into the triage subprocess (best-effort; real env still wins), so a `.kit.toml` mirror is honored without exporting `KIT_*`. - docs/AIR_GAP.md documents the declarative block. Stacked on the threat-data-bundle branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg * feat(airgap): offline provenance verification — `kit verify-provenance` Closes the headline remaining air-gap gap (#80): verify cosign/SLSA provenance in a no-egress enclave. kit does NOT reimplement Sigstore — it orchestrates cosign fully OFFLINE: cosign verify-blob --offline --trusted-root <shipped-in trusted_root.json> --bundle <b> --certificate-identity <id> --certificate-oidc-issuer <iss> <artifact> `--offline` uses the bundle's inclusion proof (no Rekor); `--trusted-root` is the operator-distributed trust anchor (no Fulcio/Rekor egress). - `src/airgap/provenance.ts`: pure `buildCosignArgs` + `missingField`, and `verifyProvenance` (injectable deps) that is **fail-closed** — missing input, missing cosign, or any non-zero cosign exit ⇒ NOT verified. kit never prints "verified" unless cosign returned success. - `kit verify-provenance <artifact> --bundle <f> [--trusted-root/--identity/--issuer]`, with defaults from `.kit.toml [air_gap].provenance_*` or `KIT_PROVENANCE_*`. - `[air_gap]` config + resolver gain the three provenance fields. - docs/AIR_GAP.md §4 rewritten from "known limitation" to the offline flow + the operator's trust-root-distribution responsibility (the model you OK'd). Full suite 1467/0. Stacked on the .kit.toml-config branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg * docs(airgap): document memory classification posture (system-high) Add §5 to AIR_GAP.md explaining that the memory store inherits the machine's classification rather than tagging rows individually. Under system-high a per-row column is redundant, and kit cannot enforce multi-level separation anyway — that is the OS/MLS reference monitor's job, not a CLI managing its own SQLite. Documents the operational posture (whole-DB level, 0o600 handling, purge = delete, capture-time redaction, procedural spill response) and is explicit that kit does not claim to separate classification levels internally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg * chore(release): 1.27.0 — reconstruct the air-gap stack onto main (#98, #80) Rebased the full stacked-PR chain (#83 KIT_AIRGAP + #84 signed threat-bundle + #85 [air_gap] config + #93 offline provenance) onto current main, resolving the triage.ts conflict (kept both verdictPassed #70 and airGapMirrorEnv #85). The stack had squash-merged out of order and landed incompletely; this makes the no-egress enclave story actually present on main. 33 airgap+triage tests green. Closes #98 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude <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.
Severity: CRITICAL — load-bearing for kit's "installs nothing untriaged" guarantee.
runTriagedecided success withoutput.includes("TRIAGE PASSED"), and the triage script echoes the (attacker-influenceable)targetinto its output header. A target containing the literalTRIAGE PASSED— or an embedded newline starting such a line — forges a pass even when the script printedTRIAGE FAILED. AffectsgateInstall,installPkg(whoseparsePkgSpecdoes no marker validation), andkit triage.Fix (defense-in-depth, safe against an older installed script):
verdictPassed()requires an EXACT standaloneTRIAGE PASSEDline and treats anyTRIAGE FAILEDline as authoritative (fail-closed). Neither → fail-closed.triage.pysanitizes the echoed target (strips CR/LF).Regression tests: substring-on-header, newline-injection (overridden by real FAILED), neither-line fail-closed. Found during a security audit.