T09 · Insecure Skill Coding Practices
- Location
scripts/snapshot.py:15- Finding
Incomplete secret redaction can persist credentials in snapshots
- Content
View full analysis
str: for pat in SECRET_PATTERNS: line = pat.sub(lambda m: '🔒 ' + m.group(0)[:8] + '…', line) return line ``` ### Technical Analysis The snapshot feature recursively reads user-selected memory and writes its contents to a persistent Markdown file. Its security model depends on regular-expression redaction, but the patterns cover only a limited set of credential formats. The assignment expression stops at whitespace or quotation marks. A quoted secret containing spaces can therefore be only partially replaced, leaving the rest of the secret in the snapshot. The AWS expression also requires one or more characters after an alternative that already matches a complete `AKIA` identifier, so an exact standard-length AWS access-key identifier may not be masked. Other unsupported credential formats may also pass through unchanged. This contradicts the documented guarantee that snapshots never store secrets. ### Attack Path 1. A selected memory file contains a credential not fully recognized by `SECRET_PATTERNS`, such as a quoted multi-word password, an exact-length AWS access-key identifier, or another unsupported token format. 2. The user runs `snapshot.py` against that file or its containing directory. 3. `mask()` fails to match the secret or replaces only part of it. 4. The remaining credential is written to a persistent file under the snapshot output dire ...[truncated 619 chars]- Remediation
View remediation
