Purple Firefish shield markPurple Firefish

RAG / Document Firewall

Use this when documents, web pages, support tickets, PDFs, emails, Markdown, CSV, JSON, or HTML may enter a retrieval pipeline or agent context.

The RAG / Document Firewall scans content before it becomes trusted context. It labels, redacts, quarantines, or allows chunks while preserving provenance hashes for audit and deduplication.

What it checks

Local-first defaults

Scan a document before indexing

curl -X POST http://localhost:8000/v1/rag/firewall/scan-document \
  -H "X-API-Key: change-me-local-dev-key" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "local-demo",
    "source_type": "markdown",
    "source_uri": "file://synthetic-support-note.md",
    "document_text": "# Support note\nThis safe synthetic note contains normal troubleshooting steps."
  }'

Python SDK

from firefish import FirefishClient

client = FirefishClient.from_env()

result = client.scan_rag_document(
    "# Support note\nThis safe synthetic note contains normal troubleshooting steps.",
    source_uri="file://synthetic-support-note.md",
    source_type="markdown",
)

print(result["overall_decision"], result["allowed_chunks"], result["quarantined_chunks"])

How to use the result

Index only allowed or redacted chunks. Keep quarantined chunks out of retrieval until a reviewer approves a safe version. Store source hashes with the chunk so Security Ops can explain which document influenced a decision without exposing raw unsafe content.

Firefish does not guarantee that every poisoned document will be detected. Use it with source controls, review workflows, retrieval isolation, and application-level authorization.