fix: reduce log-sensitive token false positives - #788
Open
jimmybrancaccio wants to merge 1 commit into
Open
jimmybrancaccio wants to merge 1 commit into
jimmybrancaccio wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Fix quoted-label matching and closing-bracket delimiter handling before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR narrows cross-language log_sensitive detection to reduce false positives while preserving credential logging detection.
Changes:
- Requires sensitive names to appear in label/value-like contexts.
- Adds regression coverage for ignored vocabulary and detected values.
| File | Summary |
|---|---|
desloppify/tests/detectors/security/test_security.py |
Adds cross-language detector integration cases. |
desloppify/tests/detectors/security/test_rules.py |
Adds focused rule regression coverage. |
desloppify/engine/detectors/patterns/security.py |
Updates sensitive-log matching; quoted labels and ] delimiters remain unhandled. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| r"(?i)(?:password|token|secret|api_key|apikey|credentials|" | ||
| r"private_key|access_key|authorization)", | ||
| r"(?i)\b(?:password|token|secret|api_key|apikey|credentials|" | ||
| r"private_key|access_key|authorization)\b(?=\s*(?:[=:,)}]|$))", |
github-actions Bot
added a commit
to citizenadam/desloppify
that referenced
this pull request
Sep 26, 2026
This branch has not been deployed
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.

Problem
The cross-language
log_sensitiverule flags any logging line containing words such astoken, including harmless domain vocabulary likeprint("out tokens"),token strip(s), andfolder_token_strip(...). This produced 14 false positives in a filename-normalization toolset.Fix
Require the sensitive name to appear as a logged label or value: before
=,:,,, a closing expression delimiter, or end of line. The existing credential-label cases still match, while prose, plurals, and compound identifiers do not.Validation
python -m pytest desloppify/tests/detectors/security/test_rules.py desloppify/tests/detectors/security/test_security.py -q— 85 passedproc_declarationunsupported by the installed grammar)log_sensitivehits, down from 14