An automated code review system that analyzes projects for security vulnerabilities, safety issues, and scalability problems. Works with Python, JavaScript/TypeScript, and Go projects.
- Introduction
- Features
- Tools Included
- Installation
- How It Works
- Usage
- Configuration
- Troubleshooting
- Contributing
- License
- Acknowledgments
Code Review Workflow is an open-source automation tool that reviews your code for common problems before they reach production. It combines multiple security scanners, pattern-based analysis, and generates easy-to-read reports.
- Developers who want automated code quality checks
- Teams who need consistent security review processes
- CI/CD pipelines that require automated quality gates
- Anyone learning about secure coding practices
| Problem | How We Help |
|---|---|
| Hardcoded passwords/API keys | Detects secrets in code |
| SQL injection vulnerabilities | Finds unsafe database queries |
| Missing error handling | Identifies unhandled exceptions |
| Slow database patterns | Catches N+1 queries and unbounded fetches |
| Cross-site scripting (XSS) | Detects unsafe HTML rendering |
- Multi-Language Support - Python, JavaScript/TypeScript, Go
- Security Scanning - OWASP Top 10 vulnerability detection
- Scalability Analysis - Performance anti-pattern detection
- Safety Checks - Error handling and input validation review
- Confidence Filtering - Only shows high-confidence issues (≥80%)
- Markdown Reports - Human-readable summaries
- JSON Reports - Machine-parseable for automation
- Inline Annotations - Comments in your code files
- GitHub/GitLab Integration - PR comments and CI status checks
- Web Dashboard - Visual review history and trends
- Auto-Fix Suggestions - Automated remediation for common issues
- RAG-Enhanced Guidance - Context-aware security recommendations
- AST Analysis - Deep code structure analysis
| Tool | Purpose | Languages |
|---|---|---|
security_scanner.py |
Orchestrates security analysis | All |
| Bandit | Python security linter | Python |
| Semgrep | Pattern-based vulnerability detection | All |
| npm audit | Dependency vulnerability scanning | JavaScript |
| Tool | Purpose |
|---|---|
scalability_checker.py |
Detects performance anti-patterns |
generate_report.py |
Creates formatted reports |
fix_engine.py |
Generates auto-fix suggestions |
| Component | Purpose |
|---|---|
dashboard/ |
Web UI for review history |
ci-integration/ |
GitHub Actions & GitLab CI configs |
rag-system/ |
Security guidance retrieval |
mcp-servers/ |
Advanced code analysis server |
- Python 3.9 or higher
- pip (Python package manager)
- Git
git clone https://github.com/augmentedivan/code-review-workflow.git
cd code-review-workflow# Create virtual environment
python -m venv .venv
# Activate it
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activatepip install -r requirements.txtpython tools/security_scanner.py --help
python tools/scalability_checker.py --helpYour Code → Scanners → Filter Results → Report
The system analyzes your project to determine what languages are used:
Project contains:
├── Python files (.py) → Will use Bandit + Semgrep
├── JavaScript files (.js) → Will use npm audit + Semgrep
└── Go files (.go) → Will use Semgrep
Multiple security tools run in parallel:
┌─────────────────┐
│ Your Project │
└────────┬────────┘
│
┌────┴────┐
▼ ▼
┌───────┐ ┌───────┐
│Bandit │ │Semgrep│ ← Security scanners
└───┬───┘ └───┬───┘
│ │
└────┬────┘
▼
┌─────────────────┐
│ Raw Findings │ ← All potential issues
└────────┬────────┘
│
▼
┌─────────────────┐
│ Filter ≥80% │ ← Remove low-confidence
└────────┬────────┘
│
▼
┌─────────────────┐
│ Final Report │ ← Only real issues
└─────────────────┘
Pattern matching finds performance problems:
| Pattern | Problem | Example |
|---|---|---|
| Query in loop | N+1 database queries | for user in users: db.get(user.id) |
fetchall() |
Unbounded data loading | Loading 1M rows into memory |
| Missing pagination | Memory exhaustion | API returning all records |
| Blocking I/O in async | Thread starvation | time.sleep() in async function |
Not all warnings are real problems. We filter by confidence:
Raw findings: 47 issues
After filtering (≥80% confidence): 12 issues
Removed:
- False positives
- Stylistic preferences
- Already-handled edge cases
Final output in your chosen format:
=== Code Review Report ===
Summary:
- Critical: 2 issues
- High: 3 issues
- Medium: 5 issues
- Low: 2 issues
Top Issues:
1. [CRITICAL] Hardcoded API key
File: src/config.py, Line: 23
→ Move to environment variable
2. [CRITICAL] SQL Injection
File: src/database.py, Line: 45
→ Use parameterized queries
# Scan current directory
python tools/security_scanner.py .
# Scan specific project
python tools/security_scanner.py /path/to/project
# Save results to file
python tools/security_scanner.py . --output results.json# Using the CI runner for complete analysis
python tools/ci-integration/review_runner.py \
--path /path/to/project \
--output ./reports# Generate all report formats
python tools/generate_report.py \
--findings-dir ./reports \
--project-name "My Project" \
--output-dir ./reports \
--format allAdd to .github/workflows/code-review.yml:
name: Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install bandit semgrep
- name: Run code review
run: |
python tools/ci-integration/review_runner.py \
--path . \
--output .tmp \
--github-annotations \
--fail-on-criticalAdd to .gitlab-ci.yml:
code-review:
stage: test
image: python:3.11
script:
- pip install bandit semgrep
- python tools/ci-integration/review_runner.py --path . --output .tmp
artifacts:
paths:
- .tmp/review_report.mdStart the dashboard to view review history:
# Start the dashboard
python tools/dashboard/app.py
# Open in browser
# http://localhost:5000Dashboard features:
- View all past reviews
- Track issues over time
- See severity trends
- Export reports
We provide configuration presets for different deployment scenarios. Choose the one that matches your use case:
# For personal/development use (no auth, no rate limiting)
cp config/local.env.example .env
# For shared team dashboards (API key auth, moderate rate limiting)
cp config/team.env.example .env
# For production deployments (full security, strict rate limiting)
cp config/production.env.example .envThen edit .env to customize values for your environment.
| Feature | Local | Team | Production | Why? |
|---|---|---|---|---|
| API Key Auth | ❌ | ✅ | ✅ | Prevents unauthorized access |
| Rate Limiting | ❌ | ✅ | ✅ | Prevents abuse |
| CSRF Protection | ✅ | ✅ | ✅ | Always on (built-in) |
| Semgrep | Optional | ✅ | ✅ | Multi-language scanning |
| Dashboard | Optional | ✅ | ✅ | Visual reports & history |
See config/README.md for detailed configuration documentation.
| Variable | Description | Default |
|---|---|---|
DASHBOARD_API_KEY |
API key for dashboard auth (empty = disabled) | None |
RATE_LIMIT_REQUESTS |
Max requests per time window (0 = disabled) | 100 |
RATE_LIMIT_WINDOW |
Rate limit window in seconds | 60 |
FLASK_SECRET_KEY |
Secret key for sessions/CSRF | Auto-generated |
VIBE_TOOLS_PATH |
Path to tools directory | Auto-detected |
GITHUB_TOKEN |
GitHub API token (for PR comments) | None |
GITHUB_REPOSITORY |
Repository name (owner/repo) | None |
Edit tools/ci-integration/review_runner.py to adjust:
# Line 228: Change minimum confidence
all_findings = [f for f in all_findings if f.get("confidence", 0) >= 80]Create .code-review-ignore in your project:
# Ignore test files
**/test_*.py
**/*_test.go
# Ignore vendor directories
vendor/
node_modules/
# Ignore specific files
legacy/old_code.py
Problem: Bandit security scanner is not installed.
Solution:
pip install banditProblem: Semgrep is not installed.
Solution:
pip install semgrepProblem: UnicodeDecodeError when running scanners.
Solution: This is fixed in the current version. If you see this error, make sure you have the latest code that includes encoding="utf-8" in subprocess calls.
Problem: Report shows 0 issues but you expected some.
Possible causes:
- All findings were below 80% confidence threshold
- No security issues detected (good news!)
- Wrong project path specified
Debug:
# Run with verbose output
python tools/security_scanner.py . --output debug.json
cat debug.jsonProblem: ModuleNotFoundError: No module named 'flask'
Solution:
pip install flaskProblem: CI pipeline fails with permission errors.
Solution: Ensure your workflow has correct permissions:
permissions:
contents: read
pull-requests: write- Check the Issues page
- Search existing issues for your problem
- Create a new issue with:
- Your operating system
- Python version (
python --version) - Full error message
- Steps to reproduce
We welcome contributions! Here's how to help:
- Check if the bug is already reported
- Create a new issue with:
- Clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Your environment details
- Open an issue with the "enhancement" label
- Describe the feature and why it's useful
- Include examples if possible
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Run tests:
python -m pytest tests/
- Commit with clear messages:
git commit -m "Add feature: description of change" - Push and create a Pull Request
- Follow PEP 8 for Python code
- Use meaningful variable names
- Add comments for complex logic
- Include docstrings for functions
To add support for a new language or tool:
- Create adapter in
tools/security_scanner.py - Add language detection logic
- Parse tool output to standard format
- Add tests
- Update documentation
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024 Code Review Workflow Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Bandit - Python security linter
- Semgrep - Pattern-based code analysis
- OWASP - Security guidelines and standards
- All contributors who help improve this project
Made with care for secure, safe, and scalable code.