Skip to content

fix(secrets): re-judge recorded findings when the rule set changes - #364

Open
thefron wants to merge 1 commit into
mainfrom
fix/secrets-revalidate-stale
Open

thefron wants to merge 1 commit into
mainfrom
fix/secrets-revalidate-stale

Conversation

@thefron

@thefron thefron commented Nov 15, 2026

Copy link
Copy Markdown
Member

Problem

A sync-scan finding stands until its file changes again. So a rule fix never reaches findings already on disk: paths flagged by the old OpenAI rule (URL/filename slugs such as help-desk-tools, fixed in 7380a79) keep showing in bdrive status and the agent hook on every prompt, even on binaries whose rules no longer match them.

Fix

  • secrets.Fingerprint() hashes the rule ids and patterns.
  • The store keeps the fingerprint beside the findings (secrets-rules-<mount>.json), as a sibling file so existing records still load.
  • When the recorded fingerprint differs from the current one, the cycle re-scans only the flagged paths from their cached blobs (dropping paths no longer in the cache), then records the current fingerprint. Quiet cycles still read nothing.

Tests

  • New TestSecretRecordRejudgedWhenRulesChange: a stale slug finding and a missing path are cleared, a real key is kept, and revalidation does not repeat without a rule change.
  • go test ./internal/syncer ./internal/store ./internal/secrets ./internal/webapp passes.

🤖 Generated with Claude Code

A finding stood until its file changed again, so a rule fix never reached
findings already on disk: slugs flagged by the pre-v0.18.1 OpenAI rule kept
warning on every prompt. Record the rule set's fingerprint beside the findings
and re-scan only the flagged paths once when it differs.

Co-Authored-By: Claude Opus 5.5 <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