Repository navigation
fix(secrets): record key names in secrets.generate so audit secrets attributes reads - #1115
Merged
sandstream merged 1 commit intoNov 27, 2026
Conversation
…ttributes reads kit audit secrets promises "who/what touched each key + when", but the secrets.generate event carried no key names (CLI: store only; MCP: empty metadata), so every read landed in unattributed. Both paths now record the declared key NAMES under name/names, the shape secrets-write-record already uses for writes and audit-secrets already reads. No value is logged. Whether events are written with governance off is unchanged. Found by kit-research note kms-decrypt-evidence-vs-kit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published. |
This was referenced Nov 27, 2026
sandstream
deleted the
claude/web-kit-status-sync-p6fg9a-protected-audit-secrets-keys
branch
November 27, 2026 11:27
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.
What
kit secrets(CLI) and the MCPkit_secretstool now record the declared key names in theirsecrets.generateaudit event, undername(one key) ornames(several), the shapesrc/secrets-write-record.tsalready writes for writes andsrc/audit-secrets.tsalready reads.kit audit secretsthen attributes each read to its keys instead of listing it asunattributed. No value is logged.Why
Found by the kit-research note kms-decrypt-evidence-vs-kit (Measurement, sections 1 and 2).
src/subcommand-help.ts:120andsrc/audit-secrets.ts:4-5promise "who/what touched each key + when", but:{store, template}(src/commands/secrets.ts:196-201);metadata: {}(src/mcp-server.ts:354-356).Measured on main:
{"summary":{"totalEvents":0,"keyCount":0}, "unattributed":[{"operation":"secrets.generate","detail":"store=env env=dev"}]}.How
src/secrets-write-record.ts: thename/namesrule moves into a small pure helper,keyNameMetadata, whichsecretWriteEventnow uses too (same output as before). The comment explaining why it is notkey/keys(sanitizeMetadatawould redact them) moves with it.src/commands/secrets.tsandsrc/mcp-server.ts: spreadkeyNameMetadata(Object.keys(secrets.keys))into the event.The names recorded are the keys declared in
[secrets.keys], i.e. the ones the run tried to resolve. The event is written before resolution, so a key that failed to resolve is still listed; the event'ssuccesssays whether the run as a whole succeeded.Not changed (owner decision)
Whether these events are written at all when
[governance]is off is unchanged: with the default config (DEFAULT_GOVERNANCE.enabled: false),withGovernancereturns before any audit, sokit secretsstill writes no event. Changing that is an owner decision, so this PR leaves it alone.Also out of scope, as the note says: even with names, the honest answer is "no read through kit"; reads of
.env.localby other processes stay invisible.Tests
src/audit-secrets.test.tsrunskit secrets(cmdSecrets) and the MCPkit_secretstool against a governed project with two declared keys, then runsgroupBySecret(readSecretAuditEvents()). Both fail on main (the event lands inunattributed) and pass here. They also assert no declared value appears in the log.Merge
These paths are protected (
.github/kit-protected-paths.json,secrets:src/secrets-write-record.ts, and thesecrets.generateaudit contract read bysrc/audit-secrets.ts), so the owner merges this PR.Platforms
Linux tested locally; CI covers Linux and Windows. macOS is unverified (no CI job runs it); the change is audit metadata only.
Generated by Claude Code