OpenGrep pre-scan
Rusty Bot can run OpenGrep (LGPL-2.1 fork of Semgrep) on changed files before the LLM review. OpenGrep findings are fed to the LLM as structured context so the model can confirm true positives or dismiss false positives with an explanation. This combines deterministic SAST coverage with LLM-powered triage — catching patterns LLMs detect inconsistently (hardcoded secrets, SQL injection, XSS) while filtering false positive noise.
Requirements
Section titled “Requirements”opengrep must be available in PATH. The Docker image used by the GitHub Action and Azure Pipelines includes it by default. If it’s not installed, the review continues LLM-only with a logged notice — no action required.
Installation (outside Docker)
Section titled “Installation (outside Docker)”curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh | bashConfiguration
Section titled “Configuration”# use curated ruleset (default)RUSTY_OPENGREP_RULES=auto
# use a custom config file from the repoRUSTY_OPENGREP_RULES=.semgrep.yml
# use a specific registry rulesetRUSTY_OPENGREP_RULES=p/security-auditHow it works
Section titled “How it works”- Changed file paths (excluding binaries) are written to a temp file
opengrep scan --config <rules> --json --quiet --target-list <file>runs with a 2-minute timeout- JSON output is parsed into structured findings (rule ID, file, line range, message, severity, snippet)
- Findings are injected into the LLM user prompt before the diff, with instructions to confirm or dismiss each one
- When the diff is split into token-aware chunks, OpenGrep findings are filtered to only the files in each chunk
The PR summary comment includes an OpenGrep stats line showing finding count, availability, and any errors.
OpenGrep runs locally in seconds with zero LLM cost. The only added token cost is the findings injected into the prompt — roughly 50–200 tokens per finding.