OWASP Guard CLI
Professional OWASP Top 10 (2021) code security scanner powered by LLM analysis.
Scans repositories or individual files and generates structured JSON + Markdown reports.
Prerequisites
| Requirement | Version |
|---|---|
| Python | 3.11+ |
| Groq API Key | Get one free → |
Installation
From PyPI (recommended):
pip install owasp-guard-cli
From source:
git clone https://github.com/your-org/owasp-guard
cd owasp-guard
pip install -r requirements.txt
pip install -e .
Quick Start
1 — Add your API key
owasp-guard init
Or pass it directly:
owasp-guard init --api-key gsk_xxxxxxxxxxxx
2 — Scan your code
# Scan a full repository
owasp-guard scan ./my-project --output-dir outputs
# Scan a single file
owasp-guard scan ./src/app.py --output-dir outputs
3 — Review the reports
outputs/
├── report.json ← for pipelines and automation
└── report.md ← for human review and audit
Common Commands
# Scan a repo
owasp-guard scan ./my-project --output-dir outputs
# Limit to first 10 files (useful for large repos)
owasp-guard scan ./my-project --max-files 10 --output-dir outputs
# Use a specific model
owasp-guard scan ./my-project --model llama-3.1-8b-instant --output-dir outputs
# Scan a single file
owasp-guard scan ./src/auth.py --output-dir outputs
CLI Reference
owasp-guard --help Show help
owasp-guard help scan Scan command options
owasp-guard help init Init command options
owasp-guard help reports Report format details
owasp-guard help errors Error codes reference
Alias: owasp works the same as owasp-guard.
Report Contents
report.json includes:
- Tool metadata and report version
- Scope metrics:
total_files,total_chunks,total_findings - Summary metrics:
risk_score_10, severity and OWASP category distributions - Full findings list with evidence and line references
report.md includes:
- Executive summary and risk score
- OWASP category and file impact breakdown
- Findings index with detailed evidence and fix guidance
- Priority action plan and remediation roadmap
Exit Codes
| Code | Meaning |
|---|---|
0 |
Scan complete — no findings |
1 |
Scan complete — findings detected |
2 |
Invalid CLI usage |
3 |
Runtime error |
Troubleshooting
| Error | Fix |
|---|---|
Invalid API Key |
Run owasp-guard init again with a valid Groq key |
Path not found |
Make sure the target path exists before scanning |
Configuration Error |
Delete ~/.owasp_guard/config.json and re-run init |
How It Works
Collect files → Chunk code → LLM analysis → Verification pass → Deduplicate → Report
- File collection — gathers source files from the target path
- Chunking — splits large files into context-sized chunks
- LLM analysis — each chunk is analyzed against OWASP Top 10 categories
- Verification pass — findings are re-checked to reduce false positives
- Deduplication — repeated findings across chunks are merged
- Reporting — outputs
report.jsonandreport.md
Project Layout
src/owasp_guard/
├── cli.py # Entry point — commands: init, scan, help
├── scanner.py # Main pipeline orchestrator
├── llm_utils.py # Groq API calls and response parsing
├── prompts.py # OWASP analysis prompts sent to the LLM
├── chunking.py # Splits files into LLM-sized chunks
├── file_collector.py # Finds and filters files for scanning
├── reporting.py # Generates report.json and report.md
├── models.py # Data models for findings and scan results
├── config.py # API key storage (~/.owasp_guard/config.json)
├── constants.py # Model names, file extensions, OWASP categories
└── errors.py # Custom exception types
Metadata
Release files for owasp-guard-cli 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| owasp_guard_cli-0.2.2.tar.gz | 33.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| owasp_guard_cli-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 69.5 kB
Release files / owasp_guard_cli-0.2.2.tar.gz
| Download URL | owasp_guard_cli-0.2.2.tar.gz |
|---|---|
| Size | 33.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e9180e2b0fd50cd17927cee415d53937590c75ac6b4539f6aade5004e92070f
|
|
BLAKE2b-256 checksum How to use checksums |
444fe3bc00229af6f4cc4ef754d1647e6e8e56254e251f714fae3d9ef5843f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.
Transparency logRelease files / owasp_guard_cli-0.2.2-py3-none-any.whl
| Download URL | owasp_guard_cli-0.2.2-py3-none-any.whl |
|---|---|
| Size | 36.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a46874e6c48a086e96295e50754a8ed3800787b95f9e14e6e8bbc4771519d420
|
|
BLAKE2b-256 checksum How to use checksums |
bc19bb751cdea390135a5733251550373aa80ea38fb0f72f753c4d34e348a65a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.
Transparency log