Skip to content

feat(secrets): print an evidence plan per key in kit secrets incident - #1133

Merged
sandstream merged 1 commit into
claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-queryfrom
claude/web-kit-status-sync-p6fg9a-protected-incident-evidence-plan
Nov 27, 2026
Merged

sandstream merged 1 commit into
claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-queryfrom
claude/web-kit-status-sync-p6fg9a-protected-incident-evidence-plan

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Stacked on #1132 (base branch claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-query), because the evidence plan prints that PR's kit audit secrets --key --since query. Protected — owner merges (src/secrets-incident-cli.ts, new src/secrets-evidence-plan.ts).

Found by kit-research note kms-decrypt-evidence-vs-kit (Innovation section, Plan item 6, owner-approved).

Change

kit secrets incident <backend> [--since <ISO>] now prints an evidence plan right after the rotation plan: for each key, the command that fetches the store's own access record since --since (a placeholder when omitted), then kit's own record. Printed only; kit runs none of them and holds no cloud credentials for them. The header states: A missing event proves only "not read through that service", not that the value was never read.

Store Printed command Verified against
aws-sm aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue='<secret-id>' --start-time <T> --region <r> --query 'Events[?EventName==''GetSecretValue'']'; caveats: Event history is 90 days in one Region, only a trail or Lake keeps more, a trail can leave events out https://docs.aws.amazon.com/secretsmanager/latest/userguide/monitoring-cloudtrail.html, https://docs.aws.amazon.com/cli/latest/reference/cloudtrail/lookup-events.html
KMS (for aws-sm) the same lookup on <kms-key-arn> filtered to Decrypt; caveats: names a principal not a person, plaintext omitted, cached data keys make no call https://docs.aws.amazon.com/kms/latest/developerguide/ct-decrypt.html
gcp-sm gcloud logging read 'protoPayload.methodName="google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion" AND protoPayload.resourceName:"/secrets/<name>/" AND timestamp>="<T>"' --project <p>; caveat, verified: "Data Access audit logs are disabled by default for all services except some BigQuery services." https://docs.cloud.google.com/secret-manager/docs/audit-logging, https://docs.cloud.google.com/logging/docs/audit/configure-data-access
azure-kv KQL: AzureDiagnostics | where ResourceProvider == "MICROSOFT.KEYVAULT" | where OperationName == "SecretGet" | where TimeGenerated >= datetime(<T>) | where requestUri_s contains "/secrets/<name>" …; caveat, verified: resource logs "aren't collected and stored until you create a diagnostic setting" https://learn.microsoft.com/en-us/azure/key-vault/general/monitor-key-vault, https://learn.microsoft.com/en-us/azure/key-vault/general/logging
1Password curl -X POST <events-api-base-url>/api/v2/itemusages -H 'Authorization: Bearer <events-token>' … -d '{"limit":1000,"start_time":"<T>"}' (token needs the itemusages feature; base URL left as a placeholder, not verified) https://www.1password.dev/events-api/reference/
Infisical GET <infisical-url>/api/v1/organization/audit-logs?eventType=get-secret&startDate=<T>&projectId=…&secretPath=…; caveat: Pro, Advanced or Enterprise plan https://infisical.com/docs/api-reference/endpoints/audit-logs/export-audit-log, https://infisical.com/docs/documentation/platform/audit-logs
Vault not verified, no command: auditing is disabled on a new cluster and no query command is documented https://developer.hashicorp.com/vault/docs/audit
Doppler not verified, no command: the per-secret Access Log is dashboard-only, and no API or CLI is documented for it https://docs.doppler.com/docs/access-logs
Bitwarden not verified, no command: event codes 1107/1108/1109 (Teams/Enterprise), but the Public API /events filters are not documented https://bitwarden.com/help/event-logs/
env, config, dotenvx, eas no store-side record: "assume it was read" —
every key kit audit secrets --key <NAME> --since <T> (#1132), "reads through kit only; processes that read .env.local directly are not visible" —

All pages were read on 2026-11-27. The URLs are quoted in the test fixtures (src/secrets-evidence-plan.test.ts). --since must be ISO 8601, or the command refuses before printing anything. No value is printed: the test asserts that the fixture value is not in the output.

Before / after

src/secrets-evidence-plan.test.ts, with the plan module copied onto the #1132 head (its incident CLI prints no plan):

ok 1 - evidencePlan: verified store queries
ok 2 - evidencePlan: no command it could not verify
    not ok 1 - next to the rotation plan: store query, kit chain query and the limit, no value
    not ok 2 - refuses a --since that is not ISO 8601
not ok 3 - kit secrets incident prints the evidence plan
# tests 10  # pass 8  # fail 2

On this branch: # tests 10 # pass 10 # fail 0. Existing secrets-incident-cli tests still pass.

Harnesses

A plain CLI, so it prints the same text under Claude Code, Codex, Cursor, Cline, Copilot, Gemini CLI, Augment or a terminal. Nothing here depends on the harness.

Platforms

Commands are printed with POSIX single-quoting. On Windows, a person has to adapt the quoting before running them. The test asserts the POSIX form only. kit's own code is platform-neutral (pure strings). 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. ADR-0001/0007: deterministic mapping, no judgement, nothing executed.


Generated by Claude Code

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 ed5dd5eb19b3: 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

@sandstream
sandstream merged commit d8c6ed6 into claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-query Nov 27, 2026
8 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a-protected-incident-evidence-plan branch November 27, 2026 11:34
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