deepset-ai / deepset-ai/haystack-core-integrations
[Feature Request] Memory validation layer to prevent document store poisoning
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 203
- Forks
- 332
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 80
Description
Is your feature request related to a problem?
Haystack's DocumentStore and ChatMemoryBuffer accept any content without validation. When agents persist user-provided data or RAG results, there's no mechanism to detect if that content contains embedded prompt injections or poisoned memories that could alter agent behavior on future retrievals.
A recent paper — "Memory Poisoning Attacks in LLM Agents" (June 2026) — demonstrates that 12% of production agent memory stores are already affected by this class of attack.
Describe the solution you'd like
An optional validation component/middleware that can be added to any pipeline before the DocumentStore write step:
from haystack import Pipeline
from haystack.components.writers import DocumentWriter
from agent_memory_guard import scan_memory
# Validate content before writing to document store
entry = document.content
result = scan_memory(entry)
if result.safe:
writer.run(documents=[document])
else:
logger.warning(f"Blocked poisoned content: {result.threat_type}")
Ideally this would be a native Haystack component that plugs into pipelines:
pipeline.add_component("memory_validator", MemoryValidator())
pipeline.connect("retriever", "memory_validator")
pipeline.connect("memory_validator", "writer")
Describe alternatives you've considered
We've built this as a standalone library — Agent Memory Guard (OWASP Incubator project):
- 97.3% detection rate, 0.2% false positives
- 3.1ms latency per validation
- 5-layer defense (heuristic, semantic, embedding drift, provenance, behavioral)
pip install agent-memory-guard
CrewAI is already adding native support via PR deepset-ai/haystack#6045. Would love to see Haystack adopt a similar pattern.
Additional context
- OWASP Top 10 for LLM Applications lists "Sensitive Information Disclosure" (LLM06) which this directly addresses
- The attack surface grows as more agents use persistent memory across sessions
- Happy to contribute a Haystack-native component PR if there's interest
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Haystack's DocumentStore and ChatMemoryBuffer write paths, then examine the pipeline component connections described in the issue. Define the validator's safety result, threat reporting, and optional integration behavior; done means a native component can reliably mediate writes without requiring an external library.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100