T02 · Agent Memory Poisoning
- Location
codegraph_assist.py:66- Finding
Untrusted CodeGraph Output Written to Persistent Agent Memory
- Content
View full analysis
- Remediation
View remediation
` and ``, and replace only content between the exact paired markers. 6. Preserve unrelated memory content and create a backup before modifying an existing file. Use an atomic write through a securely created temporary file followed by replacement. 7. Restrict the target path to an explicitly approved project root and verify that `MEMORY.md` is not a symbolic link before writing. 8. Check CodeGraph return codes and abort injection if either subprocess fails; do not persist partial, malformed, or unexpected output. 9. Pin and verify the expected CodeGraph installation or executable integrity to reduce the risk of compromised tool output entering persistent memory. ]]>
