T02 · Agent Memory Poisoning
- Location
scripts/cli.cjs:7240- Finding
Persistent Agent instruction modification survives cleanup
- Content
View full analysis
## Security (AgentAuth) ### Red Lines If a dangerous action is requested (delete files, send email, modify config, purchases, production changes), use the agentauth skill for passkey approval before executing. ### Dangerous Operations Definition ... If unsure → **assume dangerous** ### Tool * **agentauth** — Human consent gate using passkeys to authorize sensitive actions. `; ``` ```js async updateAgentMarkdown() { const agentMdPath = import_path3.default.join( this.#openClawDir, "workspace", "AGENTS.md" ); // Existing or new AgentAuth rules are written into AGENTS.md. ... newContent = this.#removeAskFirstBlock(newContent); if (originalContent !== newContent) { await import_promises3.default.writeFile( agentMdPath, newContent.trimEnd() + "\n", "utf8" ); } } ``` ```js #removeAskFirstBlock(content) { const askFirstIndex = content.indexOf(ASK_FIRST_HEADER); if (askFirstIndex === -1) { return content; } const bodyStart = askFirstIndex + ASK_FIRST_HEADER.length; const nextHeadingMatch = content.slice(bodyStart).match(/\n##\s+/); let blockEndIndex; if (nextHeadingMatch) { blockEndIndex = bodyStart + nextHeadingMatch.index; } else { blockEndIndex = content.length; } const before = content.slice(0, askFirstIndex).trimEnd(); const after = content.slice(blockEndIndex).trimStart(); return [before, after].filter(Boolean).join("\n\n"); } ``` ```js async restoreAgentMarkdown() { const agentMdPath = import_path3 ...[truncated 2627 chars]- Remediation
View remediation
