T02 · Agent Memory Poisoning
- Location
sync.js:35- Finding
Unsanitized Remote Calendar Content Is Persisted in Agent State
- Content
View full analysis
{ const t = parseInt(e.start_time.timestamp); return t < (Date.now()/1000 + 86400); }); if (next24h.length === 0) { calendarSection = "## 📅 Calendar (Next 24h)\n\n- No upcoming events in the next 24 hours.\n"; } else { next24h.forEach(e => { const start = getTimestampCST( parseInt(e.start_time.timestamp) * 1000 ).split(' ')[1]; calendarSection += `- [ ] ${start} - ${e.summary}\n`; }); } const calendarRegex = /## (?:📅 )?Calendar.*?(?=\n## |$)/s; if (calendarRegex.test(heartbeatContent)) { heartbeatContent = heartbeatContent.replace( calendarRegex, calendarSection.trim() ); } else { const insertPos = heartbeatContent.indexOf('## Morning'); if (insertPos !== -1) { heartbeatContent = heartbeatContent.slice(0, insertPos) + calendarSection + "\n" + heartbeatContent.slice(insertPos); } else { heartbeatContent += "\n" + calendarSection; } } fs.writeFileSync(heartbeatPath, heartbeatContent, 'utf8'); console.log("✅ Synced to HEARTBEAT.md"); } ``` ### Technic ...[truncated 2249 chars]- Remediation
View remediation
