Securing RAG and data
Poisoned documents, access control in retrieval and private data in a knowledge base.
How to use the lab files
The zip keeps the files of each lesson apart, and the lessons work in one flat folder. After you unzip it, sh kr-lab.sh LESSON FOLDER builds that folder as it stands after a lesson, for example sh kr-lab.sh 00-set-up-your-lab ~/krlab/securing-rag.
You will build
You need
A computer with Linux, macOS, or Windows with WSL. No GPU, no cloud account and no paid tool.
Next course
- 00Set up your lab for Securing RAG and dataCreate the lab folder of the course and add the model helperSet-up15 min
- 01Build a RAG service and map its trust boundariesBuild a small RAG service over twelve documents of three sensitivity levelsBuild40 min
- 02Poison a knowledge base and measure the effectAdd a poisoned document to your own knowledge base and measure its rank40 min
- 03Stop poisoned documents with provenance and reviewReject a chunk that has no provenance and quarantine one that no person has approved40 min
- 04Enforce access control in retrievalFilter chunks by the role of the user before they are ranked and before the prompt is built45 min
- 05Find the weak points of embeddings and vector storesShow what an index file leaks and keep secret words out of the files that others can read50 min
- 06Keep private data out of prompts, logs and storesRedact emails, card-like numbers and staff identifiers before indexing and before logging40 min
- 07Measure retrieval quality and leakageCompute precision at k and a leakage count on a labelled question set40 min
- 08Design a production RAG architecturePlace each control at the stage of the pipeline where it works40 min
- 09Govern your knowledge base with a catalogue and a checkerKeep a data catalogue as a CSV file with an owner, a review cycle and a retention period for each document40 min
- 10Build a secure RAG service and its test suiteCombine provenance, quarantine, redaction, access control and a safe index in one serviceBuild55 min
- 11Review a RAG service before it goes live and fix what you findFind six planted weaknesses in a RAG service by reading its code and by testing itTest90 min
Work roles
Work roles this course supports
The course helps you to prepare for these roles of the NICE Workforce Framework for Cybersecurity (NIST SP 800-181 Rev. 1). No single course covers a whole role, and KaliRange is not a certification body.
- Secure Software Development
DD-WRL-003a main skill of the roleYou build a RAG service with provenance, redaction and access control in retrieval. - Cybersecurity Architecture
DD-WRL-001a supporting skillYou place controls at the right stage of a RAG design and check the design. - Software Security Assessment
DD-WRL-005a supporting skillYou review a RAG service, find planted weaknesses and prove each fix.