Skip to main content

A simple local scanner for code audits (Trivy, SonarQube, for Brain Station 23)

Project description

Code Audit 23

PyPI Version Python Version License: MIT

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

  1. Clone the repository:

    git clone https://github.com/BrainStation-23/CodeAudit23.git
    cd CodeAudit23
    
  2. Create and activate a virtual environment:

    # Linux/macOS
    python -m venv venv
    source venv/bin/activate
    
    # Windows
    python -m venv venv
    .\venv\Scripts\activate
    
  3. Install dependencies:

    pip install -e .
    

🔧 Configuration

  1. Create a .env file in your project root with the following variables:

    SONAR_HOST_URL=https://your-sonarqube-instance.com
    SONAR_LOGIN=your_sonarqube_token
    
  2. The first time you run a scan, the tool will prompt you for SonarQube credentials if they're not in the .env file.

🛠 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

  1. Quick Scan - Run all security scans in sequence (SonarQube + Gitleaks + Trivy)
  2. Gitleaks Scan - Scan for secrets and sensitive information
  3. Trivy Scan - Scan for vulnerabilities in dependencies and container images
  4. 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 scan
  • reports/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 creation
  • requests - HTTP requests
  • python-dotenv - Environment variable management

Building & Publishing to PyPI

  1. Update the version in pyproject.toml (and optionally __init__.py if you mirror it there). Commit the change.
  2. Ensure you have the packaging tooling:
    python -m pip install --upgrade build twine
    
  3. Clean any previous artifacts:
    rm -rf dist build *.egg-info
    
  4. Build the source distribution and wheel:
    python -m build
    
  5. (Optional but recommended) Validate the archives locally:
    twine check dist/*
    
  6. (Optional) Publish to TestPyPI before the main release:
    python -m twine upload --repository testpypi dist/*
    
  7. Once satisfied, publish to PyPI:
    python -m twine upload dist/*
    
  8. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_audit_23-0.1.3.tar.gz (11.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_audit_23-0.1.3-py3-none-any.whl (11.6 MB view details)

Uploaded Python 3

File details

Details for the file code_audit_23-0.1.3.tar.gz.

File metadata

  • Download URL: code_audit_23-0.1.3.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

Hashes for code_audit_23-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2666c0c358f23627cefdd1f1fa80ff85796bdaf344a5da0abae78081e24ba09f
MD5 3a628438780714d4fb4e156b0221ab2d
BLAKE2b-256 35063b123f9ddca80fec27d7d6bfa7cd5ae6a47faf35a65325735662324ef914

See more details on using hashes here.

File details

Details for the file code_audit_23-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: code_audit_23-0.1.3-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

Hashes for code_audit_23-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c40c8200d4073029381d762b580888734c6e019071de65cdc4ed508e31f448c2
MD5 e3bc2998039ad365221dcd6e1b0554e0
BLAKE2b-256 dfe63e57112b97f50f864cced08b9c41c0881b16414eabf394043f3f72ddc6f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page