Repository navigation
_is_sensitive false-positives on directory names containing "secret"/"token"/"password" as substrings #436
Copy link
Copy link
Closed
Description
Summary
graphify.detect._is_sensitive() uses substring matching on the generic secrets pattern, causing false positives on any file path that contains
secret, token, password, credential, passwd, or private_key as a substring of a larger word. This silently drops legitimate source
files from the graph with no warning to the user.
Version
graphify 0.4.23 (graphifyy on PyPI), macOS 26.4, Python 3.13
Concrete failure case
My repo is named daniel-ai-secretary and contains an AISecretary/ directory. Every file path through those directories matches (secret) inside
"secretary".
Result on my repo:
- Without workaround:
graphify update .reports0 code files foundand fails - With
Path('.')workaround: build succeeds but 7,023 nodes fromAISecretary/are silently missing because per-file checks still flag
AISecretary/Services/Foo.swiftas sensitive
Other plausibly-affected names: any repo/dir containing tokenizer, tokenize, password_manager, credentials_ui, secretariat, tokenized_*,
etc.
Root cause
detect.py line 36:
re.compile(r'(credential|secret|passwd|password|token|private_key)', re.IGNORECASE),
No word boundaries. Matches secret inside Secretary, token inside tokenizer, password inside password_manager (the last is probably desired — but
the substring match also catches safe collisions).
Proposed fix
Add \b word boundaries to that single pattern:
re.compile(r'\b(credential|secret|passwd|password|token|private_key)\b', re.IGNORECASE),
The other _SENSITIVE_PATTERNS entries (dotfiles, key extensions, id_rsa family, etc.) already have sufficient specificity and don't need changes.
Additional observations
1. When files are skipped as sensitive, the user isn't warned unless they inspect detected['skipped_sensitive'] in the dict. A repo with thousands
of skipped files produces a silently-incomplete graph.
2. _is_sensitive is called on the full path string (full = str(path)), so even using Path('.') as root doesn't fully help — per-file paths still
contain the offending substrings. My project's workaround is a runtime monkey-patch of _SENSITIVE_PATTERNS[2], which isn't persistable.
3. Consider surfacing the skipped count at build-time when >N% of discovered files are dropped (e.g., WARNING: 84% of discovered files skipped as
sensitive — check patterns).
Workaround for others hitting this
import re, graphify.detect
graphify.detect._SENSITIVE_PATTERNS[2] = re.compile(
r'\b(credential|secret|passwd|password|token|private_key)\b',
re.IGNORECASE
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix Graphify-Labs#453 antigravity install uses .agents not .agent, fix …
fix #453 antigravity install uses .agents not .agent, fix #436 _is_se…
fix Graphify-Labs#453 antigravity install uses .agents not .agent, fix …