CodeGuard: A CLI tool for AI-powered security auditing & code review using SecretLLM. ππ
CodeGuard is a powerful command-line tool designed for AI-powered security auditing and code review. It leverages SecretLLM to analyze source code for vulnerabilities, security flaws, and best practices. CodeGuard is particularly useful for Solidity smart contracts but also supports general-purpose code reviews for other programming languages.
πΉ Key Features β AI-Powered Code Review β Uses SecretLLM to analyze and summarize security risks. β Solidity Security Auditing β Runs security scans with Slither and Mythril, then refines the results using AI. β General Code Review β Detects vulnerabilities, performance issues, and best practices for Python, JavaScript, and more. β Fast & Lightweight β CLI-based tool that integrates seamlessly into your workflow. β Privacy-Preserving Analysis β Uses Nillion SecretLLM, ensuring privacy and security in code audits.
π― Who is this for? Developers & Security Engineers looking to automate code reviews.
Smart Contract Auditors performing Solidity security checks.
DevOps Teams integrating AI-powered security analysis into CI/CD pipelines.
CodeGuard is built using Python and integrates Nillionβs SecretLLM to provide privacy-preserving AI-powered security audits. The project leverages a combination of static analysis tools and LLM-based insights to generate detailed security reports.
πΉ Core Technologies Used π§βπ» Python (CLI & Automation) Click: A Python library for building command-line interfaces.
Requests: To communicate with the SecretLLM API securely.
Subprocess: Runs security scanning tools like Slither and Mythril within the CLI.
dotenv: Loads environment variables for API keys and configuration.
π Nillion SecretLLM β Secure AI-Powered Analysis CodeGuard uses Nillionβs SecretLLM, a decentralized privacy-preserving AI model, to analyze code without exposing sensitive data.
Unlike traditional AI models, SecretLLM ensures confidentiality while still providing detailed security insights.
CodeGuard sends Solidity security scan results (from Slither/Mythril) along with the code to SecretLLM, which then:
Identifies critical vulnerabilities.
Suggests gas optimizations.
Recommends best practices for secure development.
π‘οΈ Security Auditing with Slither & Mythril Slither: A static analysis tool for Solidity smart contracts, identifying vulnerabilities and inefficiencies.
Mythril: A symbolic execution tool that detects reentrancy, integer overflows, and other critical smart contract exploits.
ποΈ How It Works β Behind the Scenes The user runs CodeGuard on a Solidity or general code file.
If itβs a Solidity file (.sol), Slither is executed to analyze vulnerabilities.
The code + security report is sent to SecretLLM via API.
SecretLLM processes the data and generates an AI-powered security summary.
The final output is formatted for readability, highlighting critical issues and recommendations