feat: add OWASP ASI06 AgentMemoryGuard validator for memory poisoning prevention#1575
feat: add OWASP ASI06 AgentMemoryGuard validator for memory poisoning prevention#1575gautamkishore wants to merge 2 commits into
Conversation
Add raw_response field to LLMResponse and ValidationOutcome to expose the complete raw response from the LLM API. This enables downstream access to logprobs, token-level probability data, and other metadata. Closes: guardrails-ai#1272
… prevention Implements a built-in AgentMemoryGuard validator aligned with OWASP ASI06 (Memory Poisoning) that scans LLM output before memory persistence. Detection capabilities: - Prompt injection patterns (role hijacking, instruction override) - Jailbreak attempts (DAN mode, developer mode, hypothetical scenarios) - Structural integrity (zero-width chars, Unicode confusables, RTL overrides) - Sensitive data leakage (API keys, tokens, credentials, PII, SSN, credit cards) Features: - Configurable detection thresholds - Toggleable check categories (structural, sensitive data) - Log-only mode for monitoring without blocking - ErrorSpan reporting for positional findings - Streaming chunking support Closes: guardrails-ai#1488, guardrails-ai#1476, guardrails-ai#1475
Ports the AgentMemoryGuard validator from guardrails-ai/guardrails#1575 into the monorepo as guardrails-ai-agent-memory-guard, installable via the new per-package pip flow (pip install guardrails-ai-agent-memory-guard). The validator scans LLM output before it is written to agent memory, detecting prompt injection, jailbreak attempts, structural/Unicode anomalies, and sensitive-data leakage (aligned with OWASP ASI06 Memory Poisoning). Registered name is unchanged: guardrails/agent_memory_guard. Original author: Gautam Kishore (@gautamkishore). Verified locally: 44 tests pass (incl. new Guard end-to-end integration tests), ruff lint/format clean, pyright clean, license sweep clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Hi @gautamkishore — thank you for this contribution! 🙏 We're in the process of moving Guardrails-AI-owned validators into a new monorepo where each validator ships as its own package on PyPI, installable through the new per-package pip flow: pip install guardrails-ai-agent-memory-guardfrom guardrails import Guard
from guardrails_ai.agent_memory_guard import AgentMemoryGuard
guard = Guard().use(AgentMemoryGuard, on_fail="exception")We've moved your We'll require your approval on that new PR before we merge it down — we want to make sure the port faithfully represents your intent. One quick logistics note: the new PR requests your review, but you'll need to be added as a collaborator on the monorepo before GitHub will let us formally assign it / request your review. Someone from the team will reach out to sort that out. Thanks again for the great work on this — the OWASP ASI06 coverage is a valuable addition. 🚀 |
Ports the AgentMemoryGuard validator from guardrails-ai/guardrails#1575 into the monorepo as guardrails-ai-agent-memory-guard, installable via the new per-package pip flow (pip install guardrails-ai-agent-memory-guard). The validator scans LLM output before it is written to agent memory, detecting prompt injection, jailbreak attempts, structural/Unicode anomalies, and sensitive-data leakage (aligned with OWASP ASI06 Memory Poisoning). Registered name is unchanged: guardrails/agent_memory_guard. Original author: Gautam Kishore (@gautamkishore). Verified locally: 44 tests pass (incl. new Guard end-to-end integration tests), ruff lint/format clean, pyright clean, license sweep clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
For reference, here's the monorepo PR that ports this validator over: guardrails-ai/guardrails-hub-monorepo#2 It's authored under your name and we'll want your sign-off before merging it down. 🙏 |
Description
Closes #1488, #1476, #1475 — OWASP ASI06 memory poisoning guard validator.
This PR adds a built-in
AgentMemoryGuardvalidator that scans LLM output before it is written to agent memory, preventing poisoned content from persisting across sessions.Detection capabilities
Usage
Configuration
Verification