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 ragsec

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.2.0.tar.gz (14.5 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.2.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ragsec-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3fd6a8d93c8d705517d127a0fef0f2b338de0d0e58ba78be2bc584c1b7be5f74
MD5 15a7c35079f3693e461330df9244cd3f
BLAKE2b-256 5f7c3cb1f710778dcfe5889754859c17390873030dd9c68afd00f17347579e3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ragsec-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.8 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e96b813b508937456779c6364551e5f7ff0458650f73ebc8dd5cd9bd20f7df
MD5 57eee622feaccaf7d7bf7c40658cfde2
BLAKE2b-256 66570c36071661c5038f12fc7f435f17416a055c94c4aadeae6b1d8a084fa4bf

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