T02 · Agent Memory Poisoning
- Location
scripts/scribe.py:116- Finding
Untrusted Session Content Can Poison Persistent Agent Memory
- Content
View full analysis
Path: """Write extracted content to memory/YYYY-MM-DD.md.""" memory_dir = workspace / "memory" memory_dir.mkdir(parents=True, exist_ok=True) out_path = memory_dir / f"{date}.md" header = f"# {date} Memory (Scribe)\n\n" # Append if file already exists (manual notes may be there) if out_path.exists(): existing = out_path.read_text(encoding="utf-8") if "## 🔑 Decisions Made" in existing: # Already has scribe output — append with separator out_path.write_text( existing + f"\n\n---\n*Scribe update — {datetime.datetime.now().strftime('%H:%M')}*\n\n" + content, encoding="utf-8", ) else: out_path.write_text(existing + "\n\n" + header + content, encoding="utf-8") else: out_path.write_text(header + content, encoding="utf-8") return out_path def append_longterm(content: str, workspace: Path, date: str): """O ...[truncated 2317 chars]- Remediation
View remediation
