
Static analysis CLI that scans AI-generated code for vulnerabilities like SQL injection, unsafe reflection, and hardcoded secrets, with SARIF export and CI/CD gating.
A fast, standalone static analysis tool for finding security risks in AI-generated code. CanoP runs locally and produces actionable findings with remediation guidance.
fixes.json prompts for LLM-assisted remediation.pip install canop
On macOS and Linux, use pipx if global pip installation is restricted:
pipx install canop
Verify the installation:
canop --version
Initialize .canop.yml and .canopignore:
canop init
Scan the current directory, or only files changed in Git:
canop scan .
canop scan . --changed
Findings are capped at 50 by default. Use --all for no cap or --limit N for a custom cap:
canop scan . --all
canop scan . --limit 10
These options return a non-zero exit code when the threshold is not met:
canop scan . --fail-on HIGH
canop scan . --min-score 85
canop scan . --json-out results.json
canop scan . --sarif results.sarif
canop scan . --prescriptions fixes.json
The SARIF output can be uploaded to GitHub for inline findings. fixes.json contains prompts for LLM-assisted remediation.
Add .canop.yml to the project root to define policy thresholds and ignored paths:
min_grade: B
fail_on:
- CRITICAL
- HIGH
ignore:
- "tests/**"
- "docs/**"
max_findings: 0
.canopignore uses .gitignore-style patterns to exclude files and directories.
CanoP loads rules from canop/rules/*.yml and scans locally with its built-in pattern engine. Secret rules inspect comments to catch credentials accidentally left in frontend source by AI coding agents; other rules ignore comment-only lines to reduce noise. If installed, Semgrep adds AST-based analysis. It is optional and is not installed with CanoP.
git clone https://github.com/openbreach/CanoP.git canop
cd canop
pip install -e .
python -m unittest discover -s tests -v
Build distribution artifacts with:
pip install -r requirements-dev.txt
python -m build
Rules use Semgrep YAML format and live in canop/rules/*.yml. See CONTRIBUTING.md for guidelines.
For bugs and feature requests, open a GitHub issue or email [email protected].
This project is licensed under the MIT License.