c3.4 Validate and scan documents before ingestion
Scan and sanitize documents before they enter the knowledge base, so poisoned or malicious content cannot drive indirect prompt injection or leak sensitive data.
Implementation guidance
How to implement on AWS
Use GuardDuty Malware Protection for S3 to scan files before they become a data source. Use Amazon Comprehend to detect and redact PII in documents before indexing, and Amazon Macie to alert on sensitive data in the source buckets. Reject or quarantine documents that fail validation.
Acceptance criteria
Ingestion pipeline scans for malware and redacts PII before indexing; Macie alerts on sensitive source data; a poisoned/oversensitive document is quarantined.
Practical implementation
How this control is implemented in each reference architecture:
Documents are scanned for malware and PII-redacted before they become a data source in the Generative AI account; anything that fails is quarantined, never indexed.
- Run GuardDuty Malware Protection for S3 on the ingestion landing bucket so files are scanned before becoming a knowledge base source.
- Use Amazon Comprehend to detect and redact PII in documents before indexing, and Amazon Macie to alert on sensitive data in the source buckets.
- Quarantine (move to an isolated bucket, block indexing) any document that fails malware or sensitivity validation, and log the decision.
How to validate: The ingestion pipeline scans malware and redacts PII before indexing; Macie alerts on sensitive source data; a poisoned or oversensitive test document is quarantined.
Avoid: Pointing the knowledge base straight at a raw bucket. Untrusted documents drive indirect prompt injection; scan and sanitize before indexing.
An in-account ingestion pipeline scans and PII-redacts documents before indexing and quarantines anything that fails validation.
- Enable GuardDuty Malware Protection for S3 on the ingestion bucket to scan files before they become a source.
- Detect and redact PII with Comprehend before indexing, and alert on sensitive source data with Macie.
- Quarantine documents that fail validation and log the outcome.
How to validate: Ingestion scans malware and redacts PII before indexing; Macie alerts on sensitive data; a bad document is quarantined.
Avoid: Indexing whatever lands in the bucket. Validate and sanitize documents so the RAG store cannot be poisoned or leak sensitive data.
Threats addressed
- Indirect prompt injection through malicious documents inserted into the knowledge base.
- Sensitive data indexed into the RAG store.
AWS services
Framework mappings
OWASP GenAI/LLM Top 10 (2026)
- LLM01 Prompt Injection
- LLM05 Data and Model Poisoning
NIST AI Risk Management Framework (AI 100-1)
- MAP.4 Risks and impacts are mapped
- MANAGE.1 AI risks are prioritized, responded to and managed
AWS Well-Architected Generative AI Lens (Security)
- GENSEC06-BP01 Implement data purification filters for model training workflows
Learning resources
References
- AWS SRA for AI — Capability 3, Input and output validation
AI Security Maturity Model