Skip to content

fix: reduce log-sensitive token false positives - #788

Open
jimmybrancaccio wants to merge 1 commit into
peteromallet:mainfrom
jimmybrancaccio:fix/log-sensitive-token-false-positives
Open

jimmybrancaccio wants to merge 1 commit into
peteromallet:mainfrom
jimmybrancaccio:fix/log-sensitive-token-false-positives

Conversation

@jimmybrancaccio

Copy link
Copy Markdown

Problem

The cross-language log_sensitive rule flags any logging line containing words such as token, including harmless domain vocabulary like print("out tokens"), token strip(s), and folder_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 passed
  • Full suite — 5,819 passed, 3 skipped, 1 unrelated Nim tree-sitter grammar failure (proc_declaration unsupported by the installed grammar)
  • Direct detector run against the affected project files — 0 log_sensitive hits, down from 14

Copilot AI lite review requested due to automatic review settings September 25, 2026 22:04

Copilot AI 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.

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 Medium severity

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

No deployments
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