2.6 KiB
2.6 KiB
Runbook - 06 RAG Vector Classified Docs
Objective
Show that a RAG agent retrieves only authorized chunks/documents before sending context to the LLM.
Security Value
- Reduces over-retrieval in RAG.
- Prevents confidential chunks from being sent to the model.
- Combines vector search with data grants by classification.
Prerequisites
- Oracle AI Database with support for
VECTOR,TO_VECTOR, andVECTOR_DISTANCE. - Database compatible with Oracle Deep Data Security.
- SQLcl or SQL*Plus.
Before - Vulnerable Environment
-
Reset the scenario:
@scenarios/06-rag-vector-classified-docs/sql/99_reset.sql -
Create chunks and personas without applying data grants:
@scenarios/06-rag-vector-classified-docs/sql/00_schema.sql @scenarios/06-rag-vector-classified-docs/sql/01_seed_data.sql @scenarios/06-rag-vector-classified-docs/sql/02_identities.sql -
Simulate the RAG question:
Summarize critical documents about renewals, people, and legal risks. -
Run the vector search:
@scenarios/06-rag-vector-classified-docs/sql/04_test_queries.sql
Expected Result Before
- The search may retrieve
HR_CONFIDENTIAL,LEGAL_CONFIDENTIAL, andEXECUTIVE_CONFIDENTIALchunks. - The LLM could receive sensitive context before it even generates an answer.
After - Applying Deep Data Security
-
Apply data grants by classification:
@scenarios/06-rag-vector-classified-docs/sql/03_data_grants.sql -
Run the same search as
nina,heitor,sofia, andcarlos:@scenarios/06-rag-vector-classified-docs/sql/04_test_queries.sql
Expected Result After
ninaretrieves onlyPUBLICandINTERNALchunks.heitorretrieves authorized HR content.sofiaretrieves authorized legal content.carlosretrieves all chunks through the executive role.- The RAG layer sends only authorized context to the LLM.
Demo Evidence
- Retrieved chunk list before and after protection.
- Visible classifications by persona.
- Explanation that enforcement happens before the LLM call.
Official References
- Oracle Deep Data Security Guide: https://docs.oracle.com/en/database/oracle/oracle-database/26/ddscg/index.html
- Create Data Grants: https://docs.oracle.com/en/database/oracle/oracle-database/26/ddscg/create-data-grants.html
- TO_VECTOR SQL Reference: https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/to_vector.html
- VECTOR operations in PL/SQL: https://docs.oracle.com/en/database/oracle/oracle-database/26/lnpls/sql-data-types.html