Skip to content

fix: skip constants with secret-like names - #7

Merged
0xUXDesign merged 2 commits into
mainfrom
fix/secret-name-filtering
Mar 9, 2026
Merged

0xUXDesign merged 2 commits into
mainfrom
fix/secret-name-filtering

Conversation

@0xUXDesign

Copy link
Copy Markdown
Contributor

Summary

  • Constants whose names end with KEY, SECRET, TOKEN, PASSWORD, or CREDENTIAL (as underscore-delimited word segments) are now skipped during extraction
  • Defense-in-depth: prevents accidental credential storage in the knowledge graph
  • Non-secret constants with partial matches (KEYBOARD_SHORTCUT, TOKEN_LIMIT, SECRET_SAUCE_RECIPE) are correctly preserved — pattern only matches suffix positions

Test plan

  • 6 secret-named constants verified as skipped (DATABASE_PASSWORD, STRIPE_SECRET_KEY, AWS_ACCESS_KEY, AUTH_TOKEN, API_KEY, JWT_CREDENTIAL)
  • 3 non-secret constants with partial matches verified as kept (KEYBOARD_SHORTCUT, TOKEN_LIMIT, SECRET_SAUCE_RECIPE)
  • Existing INTERNAL_KEY test updated (now skipped instead of extracted)
  • Full suite: 170 tests pass, no regressions

🤖 Generated with Claude Code

0xUXDesign and others added 2 commits March 8, 2026 21:30
Defense-in-depth: extractConstants() now skips constants whose names
end with KEY, SECRET, TOKEN, PASSWORD, or CREDENTIAL (as underscore-
delimited word segments). Prevents accidental credential storage in
the knowledge graph.

Non-secret constants with partial matches (KEYBOARD_SHORTCUT,
TOKEN_LIMIT, SECRET_SAUCE_RECIPE) are correctly preserved — the
pattern only matches suffix positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@0xUXDesign
0xUXDesign merged commit c4184a1 into main Mar 9, 2026
4 checks passed
@0xUXDesign
0xUXDesign deleted the fix/secret-name-filtering branch March 9, 2026 01:33
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