Preventing RAG poisoning in clinical knowledge bases
RAG poisoning prevention is a pipeline-wide integrity and access-control problem. Restrict and verify what enters the corpus, control who can change the vector store, filter what is retrieved, limit what an agent can do with retrieved content, and log enough to reconstruct any output or action. No single control is sufficient, so apply them in layers at each stage.
Controls by RAG pipeline stage
- IngestionSource allow-listing, provenance, content validation
- Storage and indexingWrite restrictions, versioning, rollback
- RetrievalMetadata filters and integrity checks
- Generation and agent actionLeast privilege and tool-call policy
- MonitoringAudit logs and anomaly detection
Where poisoning enters a clinical RAG pipeline: map attack paths to pipeline stages
Start with a diagram of your own architecture and annotate each stage with who or what can write to it and what the next stage assumes about it. The table below gives a starting point.
| Stage | Risk | Control |
|---|---|---|
| 1. Ingestion | Unvetted or tampered documents enter the corpus. | Allow-listed sources, provenance records, content validation, quarantine before indexing. |
| 2. Storage and indexing | Direct edits to chunks or embeddings. | Restricted write identities, versioning, change review, rollback. |
| 3. Retrieval | Unapproved, expired, or tampered chunks reach model context. | Metadata filters, version and hash checks, conflict detection. |
| 4. Generation | Retrieved instructions treated as commands. | Treat retrieved text as data, limit context to the task, show source references to the user. |
| 5. Agent action | Poisoned context triggers a tool call. | Least-privilege identity, tool-call policy enforced outside the model, approval for high-impact actions. |
| 6. Monitoring | Poisoning goes unnoticed or cannot be investigated. | Logs linking outputs to documents, versions, and actions, plus anomaly review. |
Ingestion and storage controls
Control which sources can write to the corpus
At ingestion, decide which sources may write to the clinical corpus and give each an accountable owner. Allow-list sources rather than block-listing them. Record provenance for every document: origin, submitter, time, and a content hash computed at ingest. Where a publisher offers signed artifacts, verify the signature. Where it does not, record the hash and the review that approved the document.
Validate content before it is indexed
Check file type and structure, strip hidden or non-rendered text, and flag instruction-like language aimed at a model. Route documents in high-risk classes, such as dosing, formulary, and order-set content, through clinical review before they are searchable. A staging area that is not queryable by production assistants keeps unreviewed content out of retrieval while it waits.
Restrict who can change the vector store and index
For the vector store and index, separate the identities that write from the identities that read. Production assistants should hold read-only access. Humans should not edit chunks directly. Index builds should run from approved source versions through a controlled service identity, so embeddings are regenerated from reviewed text rather than imported from elsewhere.
Version every corpus and index change, require review for changes to high-risk document classes, and keep rollback tested. A scheduled reconciliation that compares indexed chunks with the hashes of approved sources will catch drift that bypassed the pipeline.
Evaluation questions for your current pipeline
- Which sources can write to the clinical corpus, and how are provenance and integrity checked at ingestion?
- Who can modify the vector store and index, and are changes versioned, reviewed, and reversible?
- What retrieval-time checks keep unvetted or tampered content out of model context?
- Which tool calls can an agent make after retrieval, and which are enforced by runtime policy under least privilege?
- Do audit logs show which documents influenced an output or action?
- Has the team tested each attack path, including injected instructions in a retrieved document?