Skip to main content

Static security scanner for RAG pipelines

Project description

RAGGuard

Static security scanner for RAG pipelines. Finds injection vulnerabilities, secret logging, auth gaps, and resource safety issues in Python codebases.

Built from real-world security audits of production RAG frameworks.

Install

pip install ragguard

Or from source:

git clone https://github.com/HrushiYadav/ragGuard.git
cd ragguard
pip install -e .

Usage

# Terminal output (default)
ragguard scan ./path/to/codebase

# Generate reports
ragguard scan ./path/to/codebase --output report.md --format markdown
ragguard scan ./path/to/codebase --output report.html --format html

# Filter by severity or category
ragguard scan ./path/to/codebase --severity high
ragguard scan ./path/to/codebase --category filter-injection

What it detects

Scanner Severity What it finds
Filter Injection HIGH f-string interpolation in Milvus, Valkey, Azure, Elasticsearch filter expressions
NoSQL Injection HIGH Unvalidated dict values in MongoDB/Elasticsearch queries
SQL Injection HIGH f-string SQL construction (INSERT, DELETE, SELECT, UPDATE)
Secret Logging MEDIUM API keys, passwords, connection strings in logger calls
Auth Gaps MEDIUM FastAPI/Flask routes without auth, client-controlled user IDs (IDOR)
Resource Safety HIGH/MEDIUM/LOW pickle deserialization, zip bombs, eval/exec, unbounded reads

Example output

RAGGuard scanning ./my-rag-app

RG-001 [HIGH] Filter injection: Possible filter expression injection
  vector_stores/store.py:42
  > conditions.append(f'(metadata["{key}"] == "{value}")')

RG-002 [HIGH] NoSQL injection: Filter value passed into query
  vector_stores/mongo.py:89
  > filter_dict["payload." + key] = value

      Summary
+------------------+
| Severity | Count |
|----------+-------|
| HIGH     |     5 |
| MEDIUM   |     8 |
| LOW      |     3 |
| Total    |    16 |
+------------------+

HTML Report

Generate a styled HTML report for sharing:

ragguard scan ./my-rag-app --output report.html --format html

Dark theme with severity badges, code snippets, and remediation guidance.

Development

pip install -e .
pytest tests/ -v
ruff check ragguard/

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragsec-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragsec-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file ragsec-0.1.0.tar.gz.

File metadata

  • Download URL: ragsec-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for ragsec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 098c0ed8555a1cf7640715760648894e80ee52fda2d7a6cdc93c3204b9752c38
MD5 bf34424dcb01a8c3e2dad0d8f6c08dd6
BLAKE2b-256 c55681321526615ae8f677b472747330d546f9748d6125149ff79a73a9632751

See more details on using hashes here.

File details

Details for the file ragsec-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ragsec-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for ragsec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36c1601d4499ac9bc796b4abd401c3d029d891903c135f76117eee991013a8f3
MD5 5ba479bdf6680465b307104246cedced
BLAKE2b-256 a1f8e7e52d2d336ae48bae42a9033bc09d7b9aa45f913d76962a7d7902e0b40c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page