T09 · Insecure Skill Coding Practices
- Location
scripts/scan_sessions_incremental.py:41- Finding
Ineffective Secret Redaction Due to Literal Backspace Characters in Regular Expressions
- Content
View full analysis
str: s = _RE_SK.sub("sk-***REDACTED***", s) s = _RE_TG_BOT.sub("", s) s = _RE_GOOGLE_API_KEY.sub("AIza***REDACTED***", s) s = _RE_BEARER.sub("Bearer ***REDACTED***", s) return s ``` ### Technical Analysis The characters surrounding each credential pattern are literal U+0008 backspace control characters rather than the regular-expression word-boundary escape `\b`. Consequently, the expressions only match credentials that are surrounded by literal backspace characters. Normal OpenAI-style keys, Telegram bot tokens, Google API keys, and bearer tokens in session messages will not satisfy these patterns and will pass through `_redact_secrets()` unchanged. The scanner subsequently renders extracted message content to JSON or Markdown. The documented workflow sends that output to an LLM for summarization and may write selected information into persistent memory. This defeats the stated security objective of preventing secrets from entering the LLM prompt. The implementation is also inherently best-effort and only recognizes a narrow set of credential formats. Even after correcting the control characters, other common secrets such as private keys, cloud credentials, GitHub tokens, ...[truncated 1514 chars]- Remediation
View remediation
