T09 · Insecure Skill Coding Practices
- Location
scripts/memory_ops.py:218- Finding
Secret Filtering Is Not Applied to Report and Deduplication Outputs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/memory_ops.py:163-164,scripts/memory_ops.py:218-220,scripts/memory_ops.py:253-260, andscripts/memory_ops.py:284-289
Vulnerability Type: Sensitive information exposure through inconsistent output filtering
Risk Level: MediumThe digest operation excludes items identified as secrets:
python for item in items: if is_secret(item.text): continueHowever, the Markdown report emits duplicate and TODO text without applying the same filter:
python if todos: lines += ["", "## Follow-up candidates"] for item in todos[:15]: lines.append(f"- `{Path(item.file).name}#{item.line_no}` — {item.text}")The JSON report also returns raw duplicate and TODO text:
python if args.format == "json": json_dump( { "root": str(root), "memory_exists": memory_md.exists(), "daily_files": len(daily_files), "items": len(items), "duplicate_clusters": [ [{"file": x.file, "line": x.line_no, "text": x.text} for x in c] for c in dupes ], "todos": [{"file": x.file, "line": x.line_no, "text": x.text} for x in todos], } )The deduplication command similarly emits unredacted text in both JSON and Markdown:
python if args.format == "json": json_dump([[{"file": x.file, "line": x.line_no, "text": x.text} for x in c] for c in dupes]) return if not dupes: print("No duplicate clusters found.") return for idx, cluster in enumerate(dupes, start=1): print(f"## Cluster {idx}") for item in cluster: print(f"- {Path(item.file).name}#{item.line_no}: {item.text}")Technical Analysis
Secret handling is implemented only in
classify_digest(). Thereportanddedupepaths process the same potentially sensitive memory content but pass e ...[truncated 2223 chars]- Remediation
View remediation
Remediation Suggestions
- Introduce a centralized output-sanitization function and apply it to every memory-derived text field before Markdown or JSON serialization.
- Replace detected secret values with a fixed marker such as
[REDACTED]rather than merely omitting selected records. - Apply sanitization consistently to duplicate clusters, TODO candidates, digest candidates, and all future output formats.
- Expand detection to cover private-key blocks, cloud access keys, database connection strings, authentication cookies, JWTs, webhook secrets, and other commonly used credential formats.
- Consider using entropy-based detection or a maintained secret-scanning library in addition to regular expressions.
- If raw output is operationally necessary, require an explicit opt-in option with a prominent warning; secure output should remain the default.
- Add regression tests containing representative synthetic secrets in TODO and duplicate bullets, verifying that neither Markdown nor JSON contains the original values.
- Document that generated reports may contain memory-derived data and should not be published or retained in broadly accessible logs.
