🛡️ CodeSentinel
AI Code Review & Security Assistant — Powered by loopy-agent
✨ Features
| Feature | Description |
|---|---|
| 🔒 Security Scanner | Pattern-based detection for 12+ vulnerability types |
| 🤖 AI Code Review | Maker/checker verification for accurate reviews |
| 📊 Risk Scoring | Prioritized findings by severity |
| 📁 Repo Scanning | Batch scan entire repositories |
| 🔗 GitHub Integration | Auto-review PRs and post comments |
| 🌐 MCP Server | Expose as tool for AI assistants |
| 📄 Report Export | HTML, JSON, Markdown, SARIF formats |
| 💾 Caching | Reduces API costs on repeated reviews |
🚀 Quick Start
# Install
pip install codesentin3l
# Or clone and install
git clone https://github.com/Dream-Pixels-Forge/codesentin3l
cd codesentinel
pip install -e .
📖 Usage
CLI Commands
# Security scan (no API key needed)
codesentin3l scan myfile.py
# AI-powered review
export OPENAI_API_KEY="sk-..."
codesentin3l review myfile.py
# Full scan + review
codesentin3l full myfile.py
# Scan entire repository
codesentin3l repo ./my-project
# Review a git diff
codesentin3l pr changes.diff
# Start MCP server
codesentin3l mcp
# Run demo
codesentin3l demo
CLI Options
--provider openai|anthropic # LLM provider (default: openai)
--model gpt-4|claude-3-opus # Model (default: gpt-4)
--output <dir> # Output directory for reports
--format html|markdown|json # Report format
🐍 Python API
Quick Review
import asyncio
from src import CodeReviewer
async def main():
reviewer = CodeReviewer(provider="openai", model="gpt-4")
result = await reviewer.review_file("my_code.py")
reviewer.print_report(result)
await reviewer.close()
asyncio.run(main())
Security Scan
from src import SecurityScanner
scanner = SecurityScanner()
findings = scanner.scan_file("my_code.py")
scanner.print_findings(findings)
risk_score = scanner.get_risk_score(findings)
Repo Scanning
from src import RepoScanner
scanner = RepoScanner()
summary = scanner.scan_repo("./my-project")
scanner.print_summary(summary)
Report Generation
from src import ReportGenerator, ReportConfig, ReportFormat
config = ReportConfig(
format=ReportFormat.HTML,
output_dir="./reports",
)
generator = ReportGenerator(config)
content = generator.generate(review=result, security_findings=findings)
path = generator.save(content, "my-review")
🌐 MCP Server
Start the MCP server to expose CodeSentinel as tools:
codesentin3l mcp
Available Tools
| Tool | Description |
|---|---|
codesentinel_scan |
Scan code for security issues |
codesentinel_review |
AI-powered code review |
codesentinel_full |
Full scan + review combined |
codesentinel_scan_file |
Scan a file from disk |
Using with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"codesentin3l": {
"command": "python",
"args": ["-m", "src.mcp_server"],
"cwd": "/path/to/codesentinel"
}
}
}
🔗 GitHub Integration
Review a PR
from src import GitHubIntegration
async def main():
gh = GitHubIntegration(token="ghp_...")
review = await gh.review_pr("owner", "repo", pr_number=123)
print(review.summary)
print(f"Approved: {review.approved}")
asyncio.run(main())
Post Review Comment
review = await gh.review_pr("owner", "repo", 123, post_comment=True)
🔒 Security Patterns Detected
| Pattern | Severity | Description |
|---|---|---|
| SQL Injection | 🔴 Critical | String formatting in queries |
| Command Injection | 🔴 Critical | os.system, eval, exec |
| Hardcoded Secrets | 🔴 Critical | API keys, passwords in code |
| Private Keys | 🔴 Critical | Embedded private keys |
| Weak Hashing | 🟠 High | MD5, SHA1 for passwords |
| XSS Risk | 🟠 High | innerHTML, dangerouslySetInnerHTML |
| Path Traversal | 🟠 High | Unsanitized file paths |
| Insecure Random | 🟡 Medium | random module for security |
| Debug Enabled | 🟡 Medium | DEBUG=True in production |
| CORS Wildcard | 🟡 Medium | Access-Control-Allow-Origin: * |
| Weak Crypto | 🟠 High | ECB mode, DES, RC4 |
📊 Report Formats
| Format | Use Case |
|---|---|
| HTML | Visual reports, CI dashboards |
| JSON | Machine parsing, integrations |
| Markdown | GitHub, documentation |
| SARIF | GitHub Code Scanning |
🏗️ Architecture
┌─────────────────────────────────────────────────────────┐
│ CodeSentinel │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Security │ │ AI │ │ GitHub │ │
│ │ Scanner │ │ Reviewer │ │ Integration │ │
│ │ (patterns) │ │ (loopy) │ │ (PRs) │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ └──────────────────┼──────────────────┘ │
│ │ │
│ ┌───────▼───────┐ │
│ │ Reporter │ │
│ │ HTML/JSON/MD │ │
│ └───────────────┘ │
│ │
├─────────────────────────────────────────────────────────┤
│ loopy-agent │
│ ┌──────────┬──────────┬──────────┬──────────┐ │
│ │ loop │ gateway │ verification│ cache │ │
│ └──────────┴──────────┴──────────┴──────────┘ │
└─────────────────────────────────────────────────────────┘
🧪 Examples
See the examples/ directory:
vulnerable_app.py— Code with intentional security issuesclean_app.py— Secure coding best practices
📝 License
MIT
🤝 Contributing
Contributions welcome! See CONTRIBUTING.md.
Built with ❤️ using loopy-agent
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codesentin3l-3.2.0.tar.gz.
File metadata
- Download URL: codesentin3l-3.2.0.tar.gz
- Upload date:
- Size: 42.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57d391b66758996cb1ea6258a5c4c7ea58516766928a5f845b25adb394db3f3a
|
|
| MD5 |
e449995722a197569081162bb9539b4c
|
|
| BLAKE2b-256 |
728e231183f627d25d4c92586d5f42955a8e3b752593b33cf7a06af9dc07b3bc
|
Provenance
The following attestation bundles were made for codesentin3l-3.2.0.tar.gz:
Publisher:
release.yml on Dream-Pixels-Forge/codesentin3l
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codesentin3l-3.2.0.tar.gz -
Subject digest:
57d391b66758996cb1ea6258a5c4c7ea58516766928a5f845b25adb394db3f3a - Sigstore transparency entry: 2415570350
- Sigstore integration time:
-
Permalink:
Dream-Pixels-Forge/codesentin3l@1d7ef96abc36161bdd08c33cb40aa23f73ef2315 -
Branch / Tag:
refs/tags/v3.2.0 - Owner: https://github.com/Dream-Pixels-Forge
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d7ef96abc36161bdd08c33cb40aa23f73ef2315 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codesentin3l-3.2.0-py3-none-any.whl.
File metadata
- Download URL: codesentin3l-3.2.0-py3-none-any.whl
- Upload date:
- Size: 46.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11d14cb216dd20ee017ae5385de0a9b4fddd2ff11343ff8399692bd6ac4ef55c
|
|
| MD5 |
7e3cfa53af6411ad38e704754d261a88
|
|
| BLAKE2b-256 |
425ca2412cc55f5aed25fd2a60ac6d70b476dab080de283fe971263e9926cb60
|
Provenance
The following attestation bundles were made for codesentin3l-3.2.0-py3-none-any.whl:
Publisher:
release.yml on Dream-Pixels-Forge/codesentin3l
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codesentin3l-3.2.0-py3-none-any.whl -
Subject digest:
11d14cb216dd20ee017ae5385de0a9b4fddd2ff11343ff8399692bd6ac4ef55c - Sigstore transparency entry: 2415570377
- Sigstore integration time:
-
Permalink:
Dream-Pixels-Forge/codesentin3l@1d7ef96abc36161bdd08c33cb40aa23f73ef2315 -
Branch / Tag:
refs/tags/v3.2.0 - Owner: https://github.com/Dream-Pixels-Forge
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d7ef96abc36161bdd08c33cb40aa23f73ef2315 -
Trigger Event:
push
-
Statement type: