Skip to content

feat(audit): kit audit secrets --key --since answers from a verified chain - #1132

Open
sandstream wants to merge 7 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-query
Open

sandstream wants to merge 7 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-query

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Stacked on #1115 (base branch claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-keys), next to #1126 (which records the reads this command reports). Protected — owner merges (branch touches the secrets audit surface).

Found by kit-research note kms-decrypt-evidence-vs-kit (Plan item 5, owner-approved): no command answered "was secret X read, and by whom, since T", and the existing view never said what it cannot see or whether the log it read is intact.

Change

kit audit secrets --key <NAME> --since <ISO 8601> [--json] (new src/audit-secrets-query.ts, CLI in src/commands/audit-secrets-query.ts):

  • Lists each read (secrets.read from feat(secrets): record every secret read in the audit chain, governance on or off #1126, the governed secrets.generate, secrets.incident) and write (propagate, sync, rotate, migrate, onecli register) of NAME at or after T, oldest first, with who (declared agent, detected harness, kit surface via) and where (store or target).
  • Counts the secret events in the window that name no key (written before kit recorded key names), since they may include NAME.
  • Coverage, always printed: reads through kit only; processes that read .env.local directly are not visible.
  • Chain: reads the log once, verifies the keyless hash chain, then the HMAC anchor (non-strict, as kit audit verify without --strict), and prints whether it verified. Broken chain, failed anchor, missing or empty log, or a --since that is not ISO 8601: exit 1, with a stderr line saying the answer cannot be relied on.
  • --json emits the same answer (key, since, coverage, chain{verified,status,entries,detail}, reads, writes, events[], unattributed).

--since-days and --target behave as before. Dispatch lives in a new cmdAuditSecretsOrQuery, so the frozen cmdAuditSecrets does not grow. --since is added to the audit flag surface and the OpenCLI snapshot.

Names only, never values: the events it reads carry none.

secrets.read is matched as a string here so this PR stands alone on #1115; #1126 exports the same name as SECRET_READ_OP.

Before / after

src/commands/audit-secrets-query.test.ts against the #1115 head:

not ok 1 - answers from a verified chain, as JSON, exit 0
not ok 2 - says plainly what it covers and that the chain verified
not ok 3 - exits non-zero and says so when the chain does not verify
not ok 4 - refuses a --since that is not an ISO 8601 date
# tests 4  # pass 0  # fail 4

On this branch (with the pure answerKeyAccess tests):

ok 1 - answerKeyAccess (2 subtests)
ok 2 - kit audit secrets --key --since (compiled CLI) (4 subtests)
# tests 6  # pass 6  # fail 0

Harnesses

A plain CLI: same under Claude Code, Codex or a terminal. The harness column is filled for Claude Code and Codex reads (#1126). Reads made under Cursor, Cline, Copilot, Gemini CLI or Augment show via and the declared agent, with no harness name.

Platforms

Linux tested. node:path only; no shell. Windows runs in CI. macOS is unverified.

node scripts/prepush.mjs --allow "enforcement gate liveness": all steps pass locally except the known local-only kit review --enforce tool gaps and Semgrep (not installed). adr check: no new violations.


Generated by Claude Code

…chain

"Was NAME read or written through kit since T, and by whom?" had no direct
answer: the per-key view takes a window in whole days, never says what it
cannot see, and never checks that the log it read is intact.

kit audit secrets --key <NAME> --since <ISO> [--json] lists each read and write
of the key since T with the declared agent, detected harness and kit surface,
counts the secret events that name no key, verifies the hash chain and the HMAC
anchor, and exits 1 when they do not verify. Every answer states its coverage:
reads through kit only; processes that read .env.local directly are not visible.

Found by kit-research note kms-decrypt-evidence-vs-kit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rotation plan assumes every key was read, because kit had no read
evidence. The stores often keep it. Next to the rotation plan, kit secrets
incident now prints, per key, the command that fetches the store's own access
record since --since: CloudTrail GetSecretValue and KMS Decrypt lookups for
aws-sm (90-day Event history), the AccessSecretVersion Data Access query for
gcp-sm (off by default), the SecretGet AuditEvent query for azure-kv, the
1Password item-usages call and the Infisical get-secret audit-log query, each
checked against the vendor page it cites. Vault, Doppler and Bitwarden are
marked not verified with no command. Every key also gets kit's own
kit audit secrets --key --since. Printed only, never run.

Found by kit-research note kms-decrypt-evidence-vs-kit.

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

@sandstream-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at fae6a6d9d7bb: not approved.

  • checks did not pass: windows shard 1/4, windows-native

@sandstream-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at fae6a6d9d7bb: gates passed. All 8 checks passed on this commit, no file is in a protected class, 11 files and 416 lines changed. This approval is deterministic; it does not judge what the change is for.

Base automatically changed from claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-keys to main November 27, 2026 11:27
…6fg9a-protected-incident-evidence-plan

feat(secrets): print an evidence plan per key in kit secrets incident
@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.

@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-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at f1b2e8173867: not approved.

  • checks did not pass: build-and-test, checks (format, lint, build, gates)
  • touches protected paths (secrets), which the owner approves: src/secrets-evidence-plan.test.ts, src/secrets-evidence-plan.ts, src/secrets-incident-cli.ts

docs/COMMANDS.md is at the 600-line file-size limit on main; the extra
table row put it at 601 and failed the standards gate.

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.

…dit-secrets-query

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-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at b08adca39e51: not approved.

  • touches protected paths (secrets), which the owner approves: src/secrets-evidence-plan.test.ts, src/secrets-evidence-plan.ts, src/secrets-incident-cli.ts

Kit-Hook-Tree: d1bf46e

# Conflicts:
#	docs/FEATURES.md
@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-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at d5a788e1707d: not approved.

  • checks did not pass: windows shard 1/4, windows-native
  • touches protected paths (secrets), which the owner approves: src/secrets-evidence-plan.test.ts, src/secrets-evidence-plan.ts, src/secrets-incident-cli.ts

@sandstream-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at d5a788e1707d: not approved.

  • touches protected paths (secrets), which the owner approves: src/secrets-evidence-plan.test.ts, src/secrets-evidence-plan.ts, src/secrets-incident-cli.ts

This branch has not been deployed

No deployments
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