T09 · Insecure Skill Coding Practices
- Location
scripts/brain.py:222- Finding
Automatic cloud mirroring can disclose persistent memory without explicit per-write consent
- Content
View full analysis
str: return os.environ.get("AGENT_BRAIN_SUPERMEMORY_SYNC", "auto").strip().lower() def _supermemory_api_key() -> str: return os.environ.get("SUPERMEMORY_API_KEY", "").strip() def _maybe_sync_supermemory(entry: dict): mode = _supermemory_mode() if _is_falsy(mode): return api_key = _supermemory_api_key() if not api_key: if mode != "auto" and _is_truthy(os.environ.get("AGENT_BRAIN_SUPERMEMORY_DEBUG", "")): print("SuperMemory sync warning: SUPERMEMORY_API_KEY is not set", file=sys.stderr) return memory_payload = { "origin": "agent-brain", "entry_id": entry.get("id"), "type": entry.get("type"), "content": entry.get("content"), "source": entry.get("source"), "source_url": entry.get("source_url"), "tags": entry.get("tags", []), "context": entry.get("context"), "created": entry.get("created"), "confidence": entry.get("confidence"), "session_id": entry.get("session_id"), "correction_meta": entry.get("correction_meta"), } tags = [_sanitize_supermemory_tag("agent-brain"), _sanitize_supermemory_tag(entry.get("type", "entry"))] for tag in entry.get("tags", []): if len(tags) >= 8: break tags.append(_sanitize_supermemory_tag(tag)) tags = list(dict.fromkeys(tags)) req_payload = { "content": json.dumps(memory_payload, ensure_ascii=False), "customId": f"agent_brain_{entry.get('id', uuid.uuid4())}", "containerTags": tags, } api_url = os.environ.get( "SUPERMEMORY_API_URL", "https://api.supermemory.ai/v3/documents", ...[truncated 4384 chars]- Remediation
View remediation
