rag-integrity-guard

Fingerprints RAG context at ingestion and re-verifies it before it reaches an LLM, catching retrieval poisoning and tampering. Ingest a few facts, run a query, then attack a chunk and watch the guard react.

Demo state (the vector store and fingerprints) is shared in memory by whichever API instance is running -- it isn't per-browser-session.

1. Ingest

One chunk per line. Each is fingerprinted (hash + embedding signature) and added to the in-memory vector store.

2. Query

Compare standard retrieval against the guard by switching modes below.

Tampered chunks are silently dropped; only VALID chunks reach the response.

Ingest some chunks first.

3. Attack simulator

Tampers a chunk that's already live in the store -- its stored fingerprint is left untouched, exactly like a real poisoning attack.

Flips a handful of characters -- a direct database/vector-store edit.