An automated security scanning system that uses AI-powered triage, sandbox validation, and automated patch suggestions to identify and fix security vulnerabilities in code repositories.
graph TB
A[GitHub Actions Trigger] --> B[Scanner Layer]
B --> C[Semgrep]
B --> D[Bandit]
B --> E[Trivy]
C --> F[JSON Findings]
D --> F
E --> F
F --> G[Triage Agent]
G --> H[Secret Scrubbing]
H --> I[LLM Analysis]
I --> J[Triage Report]
J --> K[Sandbox Validator]
K --> L[Docker Container]
L --> M[POC Execution]
M --> N[Sandbox Results]
N --> O{Patch Automation?}
O -->|AUTO_OPEN_PR=true| P[Create Branch]
O -->|AUTO_OPEN_PR=false| Q[Report Only]
P --> R[Apply Patch]
R --> S[Run Tests]
S --> T{Tests Pass?}
T -->|Yes| U[Create PR]
T -->|No| V[Create Issue]
U --> W[PR Comment]
V --> W
Q --> W
- Multi-Tool Scanning: Integrates Semgrep, Bandit, and Trivy for comprehensive vulnerability detection
- AI-Powered Triage: Uses LLM to analyze findings, assign severity, and suggest patches
- Sandbox Validation: Safely executes proof-of-concept exploits in isolated Docker containers
- Automated Patching: Creates branches, applies fixes, runs tests, and opens PRs (when enabled)
- Strong Guardrails: Secret scrubbing, rate limiting, audit logging, and safety controls
- Multi-Language Support: Works with Python, JavaScript/Node.js, and Go
- Python 3.11+
- Docker (for sandbox execution)
- Git
semgrepCLI installedbanditCLI installedtrivyCLI (optional)
- Clone the repository:
git clone https://github.com/Ashutosh0x/aardvark-security-scanner.git
cd aardvark-security-scanner- Install dependencies:
make setup- Configure the system:
cp config.yaml config.local.yaml
# Edit config.local.yaml with your settings- Set required environment variables:
export OPENAI_API_KEY="your-api-key" # Required for LLM triage
export GITHUB_TOKEN="your-token" # Required for PR automation- Run a local scan:
make run-local-scan-
Add the following secrets to your repository:
OPENAI_API_KEY: Your OpenAI API key (or compatible endpoint)GITHUB_TOKEN: Automatically provided by GitHub Actions (for PR creation)
-
Configure
config.yamlin your repository:- Set
auto_open_pr: falseby default (enable only when ready) - Adjust
fail_on_criticalbased on your security policy - Configure
max_tokensand other limits
- Set
-
The workflow will automatically run on:
- Pull requests (opened, synchronize, reopened)
- Pushes to protected branches
- Manual trigger via
workflow_dispatch
Edit config.yaml to customize behavior:
allowed_domains: Whitelist for network access in sandboxmax_tokens: LLM token budget per requestredact_patterns: Custom regex patterns for secret detectionfail_on_critical: Fail CI job if critical findings existauto_open_pr: Enable automatic PR creation (default: false)sandbox_timeout_seconds: Maximum execution time for sandboxllm_endpoint: LLM API endpoint (defaults to OpenAI)data_retention_days: How long to keep artifacts (default: 30)
- Secret Protection: All secrets are redacted before sending to LLM
- Sandbox Isolation: Network disabled by default, resource limits enforced
- Human Review Gate: PR automation disabled by default
- Audit Logging: All LLM calls logged with correlation IDs
- Data Retention: Automatic cleanup of old artifacts
The repository includes sample applications demonstrating common vulnerabilities:
sample-app/python-vuln/: Flask app with hardcoded secrets and insecure token handlingsample-app/js-vuln/: Node.js app with command injection vulnerabilitysample-app/go-vuln/: Go app with SQL injection vulnerability
Run the demo:
./demo/run_demo.shRun unit tests:
make testRun specific test suites:
pytest tests/test_scrub_secrets.py
pytest tests/test_triage_prompt.py
pytest tests/test_patch_apply.py- Scanning: Security scanners analyze the codebase
- Triage: LLM analyzes findings and suggests patches
- Validation: Sandbox verifies exploit reproducibility
- Remediation: Patches applied and PRs created (if enabled)
- Reporting: Results posted as PR comments and artifacts
The system generates:
out/triage_report.json: Structured findings with severity and patchesout/sandbox_results.json: Sandbox validation resultslogs/: Rotating audit logsmetrics.json: Runtime statistics and token usage
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
If you discover a security vulnerability, please email ashutoshkumarsingh0x@gmail.com instead of opening a public issue.
Built with 💖 OPENAI