Repository navigation
feat(scan): offline air-gap mode (KIT_AIRGAP=1) - #83
Merged
sandstream merged 1 commit intoJun 24, 2026
Merged
Conversation
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
This was referenced Jun 23, 2026
sandstream
added a commit
that referenced
this pull request
Jun 24, 2026
… use (#73) * feat(triage): configurable registry endpoints for air-gapped / mirror use The triage gate is the one part of kit that reaches the public internet (it queries package registries to evaluate a target pre-install). In a no-egress enclave those hosts are unreachable, so triage fails closed and blocks every install. This adds operator-set overrides so triage can point at INTERNAL MIRRORS instead: KIT_NPM_REGISTRY / KIT_PYPI_INDEX / KIT_GITHUB_API / KIT_DOCKER_REGISTRY Defaults are the public registries (unchanged behavior). Only the package/repo name is ever interpolated into the URL path; the host comes from these trusted env vars, never the target — so SSRF reasoning is unchanged. kit already passes its environment through to the script, so setting these in the environment kit runs under is enough. Adds docs/AIR_GAP.md covering the mirror env vars, running the external scanners offline (trivy/grype/osv-scanner/semgrep against local DBs), bumblebee offline (KIT_BUMBLEBEE_BIN/_CATALOG), and the provenance-verification limitation. First step toward a no-egress-capable build: link internally, run tools locally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg * feat(scan): offline air-gap mode (KIT_AIRGAP=1) for `kit scan` (#83) 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). Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <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.
Second step of the no-egress roadmap (#80), stacked on #73 (configurable triage mirrors).
With
KIT_AIRGAP=1,kit scanruns entirely against pre-synced local databases:airGapScanners()(pure, tested) drops cloud-only scanners (snyk, semgrep) and folds offline flags/env in — trivy--offline-scan --skip-db-update, osv-scanner--offline, grypeGRYPE_DB_AUTO_UPDATE=false.cmdScanapplies the plan, injects offline env per run, prints which scanners were skipped.docs/AIR_GAP.md§2 documents the toggle + how to pre-sync each DB on a connected host.No-op when
KIT_AIRGAPis unset. semgrep local-ruleset support is a tracked follow-up.feat/air-gap-internal-mirrors) — review/merge #73 first, then this retargets tomain.Generated by Claude Code