This repository demonstrates how to integrate Aqua Security's Trivy Premium into GitHub Actions workflows. It provides two implementation approaches: Docker-based and CLI-based scanning.
The workflows in this repository scan Docker images for vulnerabilities and compliance issues using Aqua's Trivy Premium, then register compliant images with your Aqua platform.
-
Docker Scanner (
.github/workflows/trivy-docker-scan.yml
)- Runs the scanner as a Docker container
- Pulls the scanner image from Aqua's registry
-
CLI Scanner (
.github/workflows/trivy-cli-scan.yml
)- Downloads and runs the scanner as a standalone binary
- Useful for environments where Docker-in-Docker is not preferred
Before using these workflows, you need:
- Aqua Platform Account: Access to Aqua's SaaS platform or on-premises installation
- Scanner Access: Credentials to download Trivy Premium
- GitHub Repository: With Actions enabled
- Docker Hub Integration: Configured in your Aqua platform (or modify for your registry)
- Log into your Aqua platform
- Navigate to Workloads Protection → Administration → Integrations → Image Registries
- Add a Registry integration
- Note the exact integration name - this must match
IMAGE_REGISTRY_INTEGRATION
in the workflows
- In Aqua platform, go to Workloads Protection → Administration → Scanner Groups
- Create a new access CLI group
- Copy the generated token
Add the following secrets to your GitHub repository:
Secret Name | Description | Example |
---|---|---|
AQUA_SERVER |
Your Aqua platform URL | https://c1fae5dxxx.cloud.aquasec.com |
TOKEN |
Aqua access token (from step 2) | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
AQUAREG_USER |
Username for registry.aquasec.com | Required only if scanner image not already mirrored |
AQUAREG_PSWD |
Password for registry.aquasec.com | Required only if scanner image not already mirrored |
To add secrets:
- Go to your repository → Settings → Secrets and variables → Actions
- Click New repository secret
- Add each secret with its name and value
Both workflows use these environment variables:
env:
IMAGE_NAME: "demo-local-build" # Your image name
SCANNER_VERSION: "saas-latest" # Scanner version
IMAGE_REGISTRY_INTEGRATION: "Docker Hub" # Must match Aqua integration name
Ensure IMAGE_REGISTRY_INTEGRATION
exactly matches the name of your registry integration in Aqua.
The workflows trigger definition is in the action and runs automatically on, unless modified:
- Push to
main
branch - Pull requests to
main
branch
- Build: Creates a Docker image from Dockerfile
- Scan: Analyzes the image for:
- Vulnerabilities (CVEs)
- Compliance issues
- License violations
- Sensitive data
- Register: If compliant, registers the image with Aqua
- Report: Outputs text scan results to the workflow logs
Find all the common scanner flags and documentation in the official Aqua Docs → scanner-command-line-interface
saas-latest
: Always uses the latest scanner version (recommended for SaaS)- Specific version (e.g.,
2405.22.9
): Pins to a specific release
- Aqua Documentation: docs.aquasec.com
- Aqua Support: support.aquasec.com
This demo repository is provided as-is for demonstration purposes.