Build a RAG Ingestion and Tenant-Isolation Firewall
Build the defensive control for a Retrieval-Augmented Generation pipeline: an ingestion validator that rejects poisoned documents before they are indexed, plus an ENFORCED tenant-scoped retrieval predicate that treats the tenant filter as a security boundary the caller cannot bypass. Start from a vulnerable RAG and two provided proofs-of-concept (a retrieval-poisoning PoC and a cross-tenant PoC); the exploits are only the pass/fail oracle. Wire in your ingestion gate and enforced predicate, re-run both PoCs to show they are now BLOCKED, run a benign same-tenant query to show retrieval still returns the correct answer, and write a short remediation rationale. Submit a single script or notebook for instant, rubric-based feedback.
3 hrs
Est. time
5
Outcomes
6
Rubric criteria
65%
Pass score
What you'll learn
Skills you'll have real reps in after shipping this.
The scenario
You are the platform engineer who owns a multi-tenant Retrieval-Augmented Generation (RAG) assistant. It answers staff and customer questions from a shared document store, and each document carries a tenant_id. Two problems landed on your desk this sprint. First, anyone who can file a support ticket or edit a wiki page can get a document into the index, and a red-team report just showed a planted document winning retrieval for a normal query and steering the answer (MITRE ATLAS AML.T0070, RAG Poisoning). Second, the tenant filter in the retriever is applied as a caller-supplied hint, so a request that omits or rewrites it reads another tenant's confidential records (OWASP LLM02 Sensitive Information Disclosure).
Your lead does not want another attack write-up. She wants the control shipped: an ingestion gate that rejects poisoned documents before they are indexed, and a tenant predicate that the retriever enforces server-side so it cannot be bypassed. The provided exploits are the acceptance test. You pass when both proofs-of-concept are blocked AND a legitimate same-tenant query still returns the right document. That control, built and proven, is this task.
Your role
You are a defensive security engineer hardening a multi-tenant RAG pipeline. Your goal is a single, self-contained file that BUILDS the control: an ingestion validator that rejects poisoned documents before indexing and a tenant-scoped retrieval predicate enforced as a security boundary. You start from a vulnerable target and two working proofs-of-concept, then prove the hardened pipeline blocks both exploits while a benign same-tenant query still returns the correct result.
Start the task to unlock the full brief
You'll get the step-by-step requirements, setup commands, the 6-criterion grading rubric, tips, and the ability to submit your solution for instant AI grading.
Free to start · submit when you're ready
Learning resources
What this task is
This is a build-and-submit defensive-security task. You build a working control rather than answer a quiz: a RAG firewall with an ingestion validator that rejects poisoned documents before they are indexed and a tenant-scoped retrieval predicate the retriever enforces server-side as a security boundary. You start from a vulnerable RAG and two provided proofs-of-concept (a retrieval-poisoning PoC and a cross-tenant PoC), but the exploits are only the acceptance test. You pass when both are blocked and a legitimate same-tenant query still returns the correct document.
RAG poisoning and cross-tenant leakage (OWASP LLM08 Vector and Embedding Weaknesses, LLM02 Sensitive Information Disclosure, LLM01 Prompt Injection, and MITRE ATLAS AML.T0070) are the mechanisms behind real RAG incidents. The skill this task builds is the defensive one: vet what enters the corpus so a poison never wins retrieval, and enforce who may read each row so a request cannot widen its own tenant scope. These are data-layer boundaries, durable in a way model-side classifiers proved not to be, because they hold even when a single model defense is bypassed.
Grading is rubric-based and explainable. Your submission is scored against weighted criteria (the ingestion validator built and correct, the tenant predicate enforced as a boundary, both proofs-of-concept blocked after hardening, benign same-tenant retrieval preserved, the remediation rationale and standards mapping, and the control being minimal and runnable) with per-criterion feedback. The pass threshold is 65 percent and you can resubmit.