How taladari/rag-firewall works
RAG Integrity Firewall is a client-side retrieval-time security layer: it evaluates retrieved documents, blocks denied content, and reranks the rest before they reach an LLM. It also sanitizes knowledge-graph retrievals and offers indexing/query CLI capabilities. The graph preserves the documented scanner, policy, provenance, audit, and integration branches. Some subsystems are represented from README or SOURCE INDEX references rather than sampled implementation excerpts, so unsupported internal links are omitted.
Main entry points: firewall.py Firewall · wrapper.py Graph Firewall · networkx_adapter.py NetworkX Adapter · langchain.py LangChain Adapter
Components 21
Document Retrieval
- Base Retriever
- LangChain Adapter
rag_firewall/integrations/langchain.py - LlamaIndex Adapter
rag_firewall/integrations/llamaindex.py
Firewall Enforcement
- Firewall
rag_firewall/firewall.py - Policy Engine
rag_firewall/policies/engine.py - Firewall CLI
rag_firewall/cli.py
Risk Scanners
- Injection Scanner
rag_firewall/scanners/regex_scanner.py - PII Scanner
rag_firewall/scanners/pii_scanner.py - Secrets Scanner
rag_firewall/scanners/secrets_scanner.py - Encoding Scanner
rag_firewall/scanners/encoding_scanner.py - URL Scanner
rag_firewall/scanners/url_scanner.py - Conflict Scanner
rag_firewall/scanners/conflict_scanner.py
Graph Retrieval
- NetworkX Adapter
rag_firewall/integrations/graph/networkx_adapter.py - Graph Data Types
rag_firewall/graph/types.py - Graph Firewall
rag_firewall/graph/wrapper.py - Graph Adapter Base
rag_firewall/integrations/graph/base.py - Text Serializer
rag_firewall/graph/wrapper.py
Trust and Audit
- Document Hasher
rag_firewall/provenance/hasher.py - Provenance Store
rag_firewall/provenance/store.py - Audit Log
rag_firewall/audit.py
Other components
- RAG Application
Connections 24
- RAG Application → LangChain Adapter: queries through
README.md - RAG Application → LlamaIndex Adapter: queries through
README.md - Base Retriever → LangChain Adapter: retrieves for
rag_firewall/integrations/langchain.py - Base Retriever → LlamaIndex Adapter: retrieves for
- LangChain Adapter → Firewall: evaluates documents
rag_firewall/integrations/langchain.py - LlamaIndex Adapter → Firewall: evaluates documents
rag_firewall/integrations/llamaindex.py - Firewall → Policy Engine: evaluates policies
rag_firewall/firewall.py - Firewall → Injection Scanner: scans with
rag_firewall/firewall.py - Firewall → PII Scanner: scans with
rag_firewall/firewall.py - Firewall → Secrets Scanner: scans with
rag_firewall/firewall.py - Firewall → Encoding Scanner: scans with
rag_firewall/firewall.py - Firewall → URL Scanner: scans with
rag_firewall/firewall.py - Firewall → Conflict Scanner: scans with
rag_firewall/firewall.py - Firewall → Audit Log: logs decisions
rag_firewall/firewall.py - RAG Application → Firewall CLI: runs index or query
README.md - RAG Application → NetworkX Adapter: requests graph retrieval
README.md - NetworkX Adapter → Graph Data Types: produces subgraphs
rag_firewall/integrations/graph/networkx_adapter.py - NetworkX Adapter → Graph Adapter Base: implements adapter
rag_firewall/integrations/graph/networkx_adapter.py - RAG Application → Graph Firewall: submits subgraph
README.md - Graph Firewall → Firewall: evaluates artifacts
rag_firewall/graph/wrapper.py - Graph Firewall → Document Hasher: hashes artifacts
rag_firewall/graph/wrapper.py - Graph Firewall → Audit Log: logs decisions
rag_firewall/graph/wrapper.py - Graph Firewall → Text Serializer: serializes sanitized graph
rag_firewall/graph/wrapper.py - Graph Firewall → Graph Data Types: uses graph types
rag_firewall/graph/wrapper.py