Skip to content

Governance harvest: code-review lenses, preflight gates, secrets runbooks - #1

Closed
sandstream wants to merge 2 commits into
mainfrom
harvest/dev-standard
Closed

sandstream wants to merge 2 commits into
mainfrom
harvest/dev-standard

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Portable governance tooling harvested from the private dev-standard into kit (public), so the practices that back kit's L5 "governance floor" ship with the tool instead of living only in a private repo.

17 files, +1649:

  • docs/ — CODE_REVIEW_LENSES.md (the review lenses), SECRETS_LIFECYCLE.md, SECRETS_RUNBOOK.md, SECURITY_HEADERS.md, HOST_OPS_CAPTURE.md
  • examples/agent-hooks/ — git-hooks/no-internal-leaks.sh (blocks internal codenames/markers from public commits), Claude Code preflight gates (commit/push/sanity/stop-review-gate/post-push-ci-watch)
  • examples/ — local-stack.sh, verify-env.sh
  • scripts/ — agent-config-version.sh, dep-add-check.sh, skills-hash-verify.sh, README.md

Not included: the standalone python PAL (scripts/pal + installer + doc) — superseded by the kit-native kit memory pal (TypeScript + node:sqlite), shipping separately. No point shipping a tool that's immediately replaced.

All files were scrubbed of internal references (the no-internal-leaks hook in this very PR enforces that going forward).

🤖 Generated with Claude Code

sandstream and others added 2 commits June 15, 2026 00:19
… pending-ledger, code-review lenses, helper scripts, security docs
… memory pal)

The pending-action ledger is now folded into the memory store (TypeScript + node:sqlite) as 'kit memory pal', so the standalone python script, its global installer and its doc are removed from this governance harvest — no point shipping a tool that's immediately replaced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sandstream

Copy link
Copy Markdown
Owner Author

Closing — governance harvest not being merged into the public kit repo for now. Diff preserved on the closed PR if revisited.

@sandstream sandstream closed this Jun 20, 2026
@sandstream
sandstream deleted the harvest/dev-standard branch June 20, 2026 05:42
sandstream added a commit that referenced this pull request Jun 23, 2026
 #60 #61 #64) (#66)

* feat(scan): baseline suppression for kit scan (#59)

Reuses kit's existing .kit-baseline.json (a new "scan" category) — `kit scan`
suppresses findings whose dedupKey is baselined; `kit scan --update-baseline`
freezes the current set. suppressBaselined() is pure + fixture-tested. Noise
reduction = the #1 adoption blocker; e.g. the verify-suite stripe-token FP can be
accepted once and stays quiet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(gha-audit): GitHub Actions hardening lint `kit gha-audit` (#60)

Static, local-first, no-YAML-dep scan of .github/workflows: unpinned action refs
(tag/branch instead of full SHA — CVE-2025-30066 class) + pwn-request
(pull_request_target + checkout). SecurityCheckResult with CWE-1357/OWASP-A08
citations. Pure auditWorkflow fixture-tested (3).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(sbom): SBOM (CycloneDX+SPDX) + SARIF emit — `kit sbom`, `kit scan --sarif` (#61)

The emit side of the #48 ingest adapter. `kit sbom --format cyclonedx|spdx`
generates an SBOM from package-lock.json (purls); `kit scan --sarif` emits the
merged scan verdict as SARIF 2.1.0 (kit as the tool, CWE/OWASP citations on
rules). EU-CRA-ready, interop with the SARIF/OSV ecosystem. Pure emitters
fixture-tested (4); reuses supply-chain's lockfile parser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(doctor): detect mise tools not on PATH + activation helper (#64)

`kit doctor` now warns when mise's shims dir exists but isn't on PATH (bare
snyk/trivy/infisical won't resolve) and prints the exact fix line. New
src/mise-path.ts with pure helpers + idempotent ensureMiseActivation (ready for
a consented `kit setup` step). Prefers shims-dir-on-PATH over the fragile
`mise activate` (which no-ops if mise isn't on PATH when the profile runs).
Fixture-tested.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(release): 1.21.0 — baseline (#59), gha-audit (#60), sbom/sarif (#61), mise-path doctor (#64)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
sandstream added a commit that referenced this pull request Jun 24, 2026
…se → 1.26.0 (#101)

Stops kit's own security board failing on noise (the #1 adoption blocker):

- secrets scan: only a VERIFIED-LIVE secret (trufflehog confirmed it works) is a
  critical fail; unverified secret-shaped strings (test fixtures, example conn
  strings, docs) are a warn to review. New pure classifyTrufflehogFindings.
- .semgrepignore: exclude *.test.ts (intentional fake-secret fixtures) and
  .github/ (covered by kit gha-audit #60; only FP'd on ${{ secrets.* }} refs).

On kit itself: secrets critical-fail -> warn (0 verified-live), semgrep
fail(16) -> warn(7 genuine low). Zero real findings were suppressed.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
sandstream pushed a commit that referenced this pull request Jun 29, 2026
Wire the committed .kit/shared/memory.jsonl tier into the recall paths
(memory design gap #1):

- `kit memory search` now also runs searchShared() and surfaces matching
  team decisions/conventions ABOVE raw transcript hits. `--json` returns
  `{ messages, shared }` (was a bare hits array). Project-local even under
  `--global` (shared memory travels with the repo). Fail-open.
- SessionStart recovery re-injects the project's most recent durable shared
  decisions (kinds decision/convention/security/status; notes/how-built
  excluded) via new exported `recentDecisions(root, limit)`, so a resumed
  session regains the SETTLED context, not only the last few raw turns.

Deterministic, zero-LLM, fail-open throughout (a missing/broken shared
store never breaks recall). Tests cover durable-kind filtering, newest-first
ordering, the limit, and the empty-store fail-open path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
sandstream pushed a commit that referenced this pull request Jul 4, 2026
install-gate (fix #1 residuals):
- broaden the leading env-assignment strip to /^[^\s=]+=/ so a
  special-char name (env 'a:b=1' npm i evil) can no longer become argv[0]
  and hide the install entirely;
- SOURCE_ENV_RE now also catches YARN_NPM_REGISTRY_SERVER,
  NPM_CONFIG_USERCONFIG/GLOBALCONFIG, PIP_CONFIG_FILE (indirect
  config-file redirects) and scoped npm_config_@scope:registry.

publish.yml (fix #2 residual):
- require the imported .asc to contain EXACTLY ONE primary key, so an
  attacker can't append a second key to the (pushable) pubkey file and
  have git verify-tag accept a rogue-key-signed tag (gpg --verify exits 0
  on any good sig in the keyring).

2222 tests pass; lint clean; publish.yml valid YAML.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
sandstream added a commit that referenced this pull request Jul 9, 2026
…age --standard (#270)

Generic evidence-map engine (standard.ts) + two verified descriptors: OWASP LLM
Top 10 2025 (LLM01-10, 5 auto/3 gap/2 na) and NIST SSDF 800-218 practices 218A
profiles (PO/PS/PW/RV, 9 auto/1 gap/1 na). kit coverage --standard=asvs|llm-top10|
ssdf (default asvs unchanged), --json + --verify for all three. Control IDs
source-run-verified before mapping; search-index caveat carried into each
disclaimer; no invented clause numbers. STANDARDS.md §2 #1/#2 -> §1. 2580/2580.
sandstream added a commit that referenced this pull request Jul 19, 2026
…369)

Borrows the Cerebras knowledge-base ranking insight, kept on-charter (deterministic, zero-LLM;
kit has one lexical retriever + recency, no embeddings/reranker).

- fuseByRrf<T>(lists, keyOf, k=60): pure Reciprocal Rank Fusion — merges ranked lists by RANK,
  not score, so incommensurable signals combine without normalization. Deterministic tiebreak
  by key. Reusable primitive for future multi-signal fusion (e.g. provenance).
- searchMessages gains opts.recencyBoost (default off → relevance-first order UNCHANGED). When
  on, it fetches a larger candidate pool and RRF-fuses bm25-relevance with recency, so a fresh
  still-relevant hit can outrank a marginally-more-relevant stale one; relevance still dominates.
- kit memory search --fresh wires it; help/opencli contract updated.

Tests: fuseByRrf (consensus > single #1, single-list identity, dedup, deterministic tiebreak);
searchMessages --fresh promotes a fresh-but-weaker hit above a stale mid one while the strongest
relevance match still leads. Full suite green (3013 pass / 0 fail).

Co-authored-by: Claude <noreply@anthropic.com>
sandstream pushed a commit that referenced this pull request Jul 25, 2026
…ox, add a second signal

5.9.0 shipped the gVisor/Firecracker fingerprints as documentation-derived, resolving
to unknown rather than risk a false claim. Running 'runsc do' (gVisor release-20260721.0,
Ubuntu 24.04 on a KVM host) settles the gVisor half:

- /proc/version reads 'Linux version 4.19.0-gvisor #1 SMP ...' — the existing marker DOES
  fire. Pinned as a byte-exact fixture, with real-host negative controls (a plain container
  kernel, an Ubuntu VM, and the host DMI product_name gVisor passes through: 'vServer').
- The sandbox reports Seccomp: 0 and NO NoNewPrivs line. That makes branch ORDER
  load-bearing: were seccomp/container evaluated first, a genuine gVisor sandbox would
  resolve to none/not-contained — a false negative on the strongest sandbox available.
  A test now locks the ordering.
- New cgroupHasGvisorJobController: gVisor synthesizes a 'job' cgroup controller that does
  not exist on Linux (observed as '5:job:/'), used as a second independent signal so a build
  whose version string lacks the marker is still detected. Anchored to the N:job: shape so a
  real path segment named job cannot trip it.
- The dmesg marker ('Starting gVisor...') was observed too but deliberately NOT made the
  primary signal — reading it needs the syslog syscall / /dev/kmsg, which a hardened sandbox
  may deny. Documented in the source.

Firecracker stays documentation-derived and honestly unverified (no Firecracker host was
available). Full suite green (3182).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sandstream added a commit that referenced this pull request Jul 25, 2026
…caveats with real captured data (5.13.0) (#393)

* feat(security): scan-artifact ingestion gate + clamd fast path for the malware delegate (5.13.0)

Two extensions to the ClamAV delegate shipped in 5.11.0.

kit security scan-artifact <path> [--recursive] [--json] — the ingestion gate for an
untrusted artifact (an upload, a downloaded dataset, a vendored blob) before you trust
it. clean passes; malicious fails with the signature names; and a GAP — scan error, or
no scanner installed — ALSO fails. That is the point of an ingestion gate: 'we could
not check' must never read as 'it is fine'.

clamd fast path: the delegate now prefers clamdscan against a resident clamd, which
already holds the signature DB (milliseconds vs the ~4s clamscan spends loading 3.6M
signatures per invocation), and falls back to clamscan when the daemon is absent or
unreachable — a stopped daemon costs speed, not coverage. The result reports which
engine produced the verdict (clamd | clamscan) instead of leaving the operator to
guess, and --fdpass lets the daemon scan files its own uid could not otherwise read
(which would otherwise surface as a false gap).

kit still ships no engine and no signatures. Full suite green (3176), format clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(malware-scan): pin the parser to real captured clamscan output (exit 1 now empirical)

5.11.0 shipped with exit 0 (clean) and exit 2 (scan error) confirmed against a real
host, but exit 1 (malicious) taken from ClamAV's documented spec — macOS quarantined
the EICAR test file before clamscan could read it.

Scanning a GZIPPED EICAR closes that gap (XProtect does not quarantine archive
contents on write; ClamAV unpacks and detects):

  clamscan --no-summary /tmp/e.gz
  /tmp/e.gz: Eicar-Test-Signature FOUND
  exit=1

That line is now a byte-exact test fixture, so the FOUND parser is pinned to real
observed output instead of an assumption. All three exit paths are empirically
verified against ClamAV 1.5.3. Header comment + CHANGELOG updated to say so.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(containment): verify the gVisor fingerprint against a live sandbox, add a second signal

5.9.0 shipped the gVisor/Firecracker fingerprints as documentation-derived, resolving
to unknown rather than risk a false claim. Running 'runsc do' (gVisor release-20260721.0,
Ubuntu 24.04 on a KVM host) settles the gVisor half:

- /proc/version reads 'Linux version 4.19.0-gvisor #1 SMP ...' — the existing marker DOES
  fire. Pinned as a byte-exact fixture, with real-host negative controls (a plain container
  kernel, an Ubuntu VM, and the host DMI product_name gVisor passes through: 'vServer').
- The sandbox reports Seccomp: 0 and NO NoNewPrivs line. That makes branch ORDER
  load-bearing: were seccomp/container evaluated first, a genuine gVisor sandbox would
  resolve to none/not-contained — a false negative on the strongest sandbox available.
  A test now locks the ordering.
- New cgroupHasGvisorJobController: gVisor synthesizes a 'job' cgroup controller that does
  not exist on Linux (observed as '5:job:/'), used as a second independent signal so a build
  whose version string lacks the marker is still detected. Anchored to the N:job: shape so a
  real path segment named job cannot trip it.
- The dmesg marker ('Starting gVisor...') was observed too but deliberately NOT made the
  primary signal — reading it needs the syslog syscall / /dev/kmsg, which a hardened sandbox
  may deny. Documented in the source.

Firecracker stays documentation-derived and honestly unverified (no Firecracker host was
available). Full suite green (3182).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

1 participant