Skip to content

Native Vulnerability & Misconfiguration Scanning (Trivy Integration) #97

@lordraiden

Description

@lordraiden

Summary

I propose integrating Trivy by Aqua Security natively into Compose Manager Plus. Trivy is a lightweight, open-source scanner that requires no cloud authentication and can scan both container images (for CVEs) and Compose files (for IaC misconfigurations).

Detailed description

As Unraid homelabs grow, security observability becomes a major blind spot. Users often run dozens of Docker Compose stacks without knowing if they are running outdated images with critical CVEs, or if their docker-compose.yml files contain severe misconfigurations (e.g., unnecessary privileged: true, exposed sensitive ports, or root user definitions). Currently, discovering this requires setting up complex third-party tools or running manual CLI commands.

Describe the solution you'd like:
I propose integrating Trivy by Aqua Security natively into Compose Manager Plus. Trivy is a lightweight, open-source scanner that requires no cloud authentication and scans both container images (for CVEs) and Compose files (for IaC misconfigurations).

By integrating this, Compose Manager Plus could become an all-in-one DevSecOps tool tailored for the Unraid community.

🖥️ Proposed Interface & UX Concept

The integration could add a "Security" dimension to the plugin, visualized in the following ways:

  1. At-A-Glance Badges: Add a small shield icon (🟢 Green, 🟡 Yellow, 🔴 Red) next to the stack names on the main Compose Manager page so users immediately know their security posture.
  2. Global Security Dashboard (The "Leaderboard"): A new tab featuring graphs (using Unraid's native styling or Chart.js) showing the total breakdown of vulnerabilities across all stacks. Include a "Hall of Shame" table that ranks stacks/images by their vulnerability score, allowing users to prioritize updates.
  3. Stack-Level Security Report: Inside individual project views, add a "Security" tab. Users can expand specific "Critical" vulnerabilities to see the exact package, CVE description, and crucially, the Fixed Version (so they know if pulling a new image will actually solve the problem).
  4. Unraid Native Notifications (Community Value-Add): Allow users to schedule weekly scans. If a new Critical vulnerability is detected in a public-facing container (like Nginx Proxy Manager or Nextcloud), trigger an Unraid system notification (which routes to the Unraid app/Discord/Telegram).

⚙️ High-Level Deployment Strategy (How to build it elegantly)

While users could run Trivy as a separate Docker container, that approach is clunky, requires manual socket mounts, and fractures the UI. Native plugin integration is much cleaner:

  • Installation via .plg: During plugin installation/update, the .plg script simply downloads the latest standalone Linux trivy binary into /usr/local/bin/. No daemon or dependencies are required.
  • Flash Drive Protection (Crucial for Unraid): Trivy downloads a vulnerability DB. To prevent wearing out the Unraid USB flash drive, the plugin must configure Trivy to cache this DB in RAM (/tmp/trivy-db) or allow the user to specify a path on their cache drive (e.g., /mnt/user/appdata/compose.manager/trivy).
  • Execution (Backend): When a user triggers a scan, PHP runs:
    • trivy image -f json <image_name> (for container CVEs)
    • trivy config -f json /path/to/stack/ (for Compose misconfigurations)
  • Parsing (Frontend): Because Trivy outputs clean JSON, the PHP backend can simply use json_decode() and pass the arrays directly to the frontend to render the graphs and tables.

Alternatives considered

  • Docker Scout: Focuses mostly on images, requires a Docker Hub account/authentication, and adds friction for privacy-conscious homelab users.
  • Separate Trivy Container: Forces the user to configure Docker socket mounts manually and jump between different web UIs, ruining the unified experience Compose Manager Plus provides.

Additional context:
Making security actionable and visible right inside the Unraid UI would make this plugin an absolute must-have for the community. Having a visual graph of CVEs and alerting users to misconfigurations would elevate the security standard of Unraid homelabs everywhere. I'd love to hear your thoughts on this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions