T09 · Insecure Skill Coding Practices
- Location
scripts/log_scan.py:65- Finding
Unredacted Sensitive Log Content May Be Persisted in Audit Artifacts
- Content
View full analysis
Vulnerability Details
File Location:
scripts/log_scan.py:65-78, with persistence atscripts/run_audit.py:70
Vulnerability Type: Plaintext sensitive-data exposure
Risk Level: MediumVulnerable Code
python try: with f.open("r", errors="ignore") as fh: hits = [] for i, line in enumerate(fh): if i >= args.max_lines: break for regex, label in PATTERNS: if regex.search(line): hits.append({ "label": label, "line": i + 1, "text": line.strip()[:200] }) if hits: results.append({"file": str(f), "hits": hits}) except OSError: continueThe resulting data is written without further sanitization:
python write_json(out_dir / "log_scan.json", log_scan)Technical Analysis
The log scanner stores the first 200 characters of every line matching terms such as
ERROR,Exception,Traceback,failed,timeout, orretry. It does not detect or redact authorization headers, API keys, access tokens, passwords, URL credentials, connection strings, session identifiers, or personal information.Operational error messages frequently include request parameters, configuration values, authentication data, or serialized exceptions. Consequently, the generated
eval/log_scan.jsoncan contain plaintext copies of sensitive data. This behavior also conflicts with the secret-handling rules inSKILL.md, which state that only the presence and path of keys or tokens should be reported.Attack Path
- A workspace log records a sensitive value on a line containing one of the configured failure keywords.
- The Skill scans that log during an audit.
log_scan.pycopies up to 200 characters of the matching line without redaction.run_audit.pyserializes the cap ...[truncated 603 chars]
- Remediation
View remediation
Remediation Suggestions
- Apply centralized redaction before any log text is stored or printed.
- Redact authorization headers, bearer tokens, API keys, passwords, cookies, private keys, URL user information, database connection strings, and known credential formats.
- Prefer storing only the file path, line number, matched label, and a sanitized message.
- Replace sensitive values with stable placeholders such as
[REDACTED_TOKEN]. - Add tests containing representative secrets to verify that neither JSON nor console output contains the original values.
- Consider making raw snippets opt-in and displaying an explicit warning when enabled.
