Repository navigation
feat(airgap): reconstruct the no-egress / air-gap stack → 1.27.0 (#98, #80) - #106
Merged
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
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
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
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
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
…#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>
|
✅ Docker image built successfully
|
9 of 11 tasks
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.
Closes #98. Advances #80.
What
The air-gap feature was authored as a 4-deep stacked-PR chain (#83→#84→#85→#93). It squash-merged out of order and landed incompletely on main:
[air_gap]config was absent despite "#85 merged", and #84/#93 were auto-closed when their base branches were deleted. This rebases the full stack tip (feat/air-gap-offline-provenance) onto current main (1.26.1), dropping the already-merged #73 commit.Reconstructed
KIT_AIRGAP=1offline scan mode (feat(scan): offline air-gap mode (KIT_AIRGAP=1) #83) — only offline-capable scanners, no network.[air_gap]config (feat(airgap): declarative [air_gap] config in .kit.toml #85) — internal-mirror endpoints honored by the triage subprocess (process.envstill wins);air_gapadded to the config schema + zod.kit verify-provenance(feat(airgap): offline provenance verification (kit verify-provenance) #93) — cosign--offline+ shipped-in trusted root, fail-closed.Conflict resolved
src/triage.ts: kept bothverdictPassed(#70 forgery fix, on main) andairGapMirrorEnv(#85) — they're distinct functions that landed at the same spot.Verify
config/threat-data/provenance/triage).🤖 Generated with Claude Code