A simple local scanner for code audits (Trivy, SonarQube, for Brain Station 23)
Project description
Code Audit 23
Code Audit 23 is a comprehensive command-line interface (CLI) tool that unifies multiple code quality and security scanning tools into a single, easy-to-use interface. It's designed to help developers maintain high code quality and security standards across their projects.
✨ Features
- Unified Interface: Single command to run multiple code quality and security scans
- Multiple Tools Integration:
- SonarQube - Code quality and security analysis
- Gitleaks - Detect hardcoded secrets and credentials
- Trivy - Vulnerability scanning for dependencies and container images
- Interactive Menu: User-friendly command-line interface
- Cross-Platform: Works on Windows, macOS, and Linux
- SARIF Reports: Standardized output format for all scan results
- No Installation Required: Self-contained executable available
🚀 Installation
Prerequisites
- Python 3.9 or higher
- Java 11+ (for SonarQube Scanner)
- Git (for Gitleaks)
Install from PyPI
pip install code-audit-23
Install from Source
-
Clone the repository:
git clone https://github.com/BrainStation-23/CodeAudit23.git cd CodeAudit23
-
Create and activate a virtual environment:
# Linux/macOS python -m venv venv source venv/bin/activate # Windows python -m venv venv .\venv\Scripts\activate
-
Install dependencies:
pip install -e .
🔧 Configuration
-
Create a
.envfile in your project root with the following variables:SONAR_HOST_URL=https://your-sonarqube-instance.com SONAR_LOGIN=your_sonarqube_token
-
The first time you run a scan, the tool will prompt you for SonarQube credentials if they're not in the
.envfile.
🛠 Usage
Basic Usage
Run the interactive menu:
code-audit-23
Command Line Options
Usage: code-audit-23 [OPTIONS]
Interactive entrypoint for Audit Scanner
Options:
--help Show this message and exit.
Menu Options
- Quick Scan - Run all security scans in sequence (SonarQube + Gitleaks + Trivy)
- Gitleaks Scan - Scan for secrets and sensitive information
- Trivy Scan - Scan for vulnerabilities in dependencies and container images
- SonarQube Scan - Analyze code quality and security issues
📊 Output
All scan reports are saved in the reports/ directory in SARIF format:
reports/gitleaks.sarif- Results from Gitleaks scanreports/trivy.sarif- Results from Trivy scan- SonarQube results are available on your SonarQube server
🧪 Development
Project Structure
code_audit_23/
├── __init__.py
├── main.py # Main CLI entry point
├── sonarqube_cli.py # SonarQube scanner implementation
└── logger.py # Logging configuration
Dependencies
click- Command line interface creationrequests- HTTP requestspython-dotenv- Environment variable management
Building & Publishing to PyPI
- Update the version in
pyproject.toml(and optionally__init__.pyif you mirror it there). Commit the change. - Ensure you have the packaging tooling:
python -m pip install --upgrade build twine
- Clean any previous artifacts:
rm -rf dist build *.egg-info
- Build the source distribution and wheel:
python -m build
- (Optional but recommended) Validate the archives locally:
twine check dist/*
- (Optional) Publish to TestPyPI before the main release:
python -m twine upload --repository testpypi dist/*
- Once satisfied, publish to PyPI:
python -m twine upload dist/*
- Tag the release in git, e.g.:
git tag -a v0.1.0 -m "Release v0.1.0" git push origin v0.1.0
🤝 Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on how to submit pull requests, report issues, or suggest new features.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- SonarQube - For the amazing code quality platform
- Gitleaks - For the secrets detection
- Trivy - For the vulnerability scanning
📧 Contact
For any questions or feedback, please contact Ahmad Al-Sajid.
Project details
Release history Release notifications | RSS feed
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 code_audit_23-0.1.2.tar.gz.
File metadata
- Download URL: code_audit_23-0.1.2.tar.gz
- Upload date:
- Size: 11.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
589d0592493bad573416faa678303f9f3af8599dfd635ed6cc535a4023ee3f12
|
|
| MD5 |
5649168ef362988ef5e3222ea6657303
|
|
| BLAKE2b-256 |
542a2377895ff2a7046f6313585a760da5ed7564cf431e2c306740a8c6a05340
|
File details
Details for the file code_audit_23-0.1.2-py3-none-any.whl.
File metadata
- Download URL: code_audit_23-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ba1bad2c489b7cbf4ce6a0659c376274bb9840cc7cd06ecc5d76f63d4fcec63
|
|
| MD5 |
45ca52f1fb844745c0cfb73012139446
|
|
| BLAKE2b-256 |
0e9fecb81001a3f5316cf0241baaa70f7665c74a37b409c75c656a0c35285474
|