Skip to main content
Like AOF? Give us a star!
If you find AOF useful, please star us on GitHub. It helps us reach more developers and grow the community.

Trivy Tools

AOF integrates with Aqua Security's Trivy scanner for comprehensive vulnerability detection in containers, filesystems, and IaC configurations.

Available Tools

ToolDescription
trivy_image_scanScan container images for vulnerabilities
trivy_fs_scanScan filesystems for vulnerable dependencies
trivy_config_scanScan IaC configurations for misconfigurations
trivy_sbom_generateGenerate Software Bill of Materials
trivy_repo_scanScan remote git repositories

Prerequisites

Install Trivy CLI:

# macOS
brew install trivy

# Linux
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin

# Docker
docker pull aquasec/trivy

Tool Reference

trivy_image_scan

Scan a container image for vulnerabilities.

Parameters:

ParameterTypeRequiredDescription
imagestringYesImage reference (e.g., nginx:1.25)
severitystringNoMinimum severity: UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL
ignore_unfixedbooleanNoSkip vulnerabilities without fixes
formatstringNoOutput format: json, table, sarif
timeoutintegerNoScan timeout in seconds (default: 300)

Example:

tools:
- trivy_image_scan

# "Scan nginx:1.25 for HIGH and CRITICAL vulnerabilities"

Response:

{
"success": true,
"image": "nginx:1.25",
"summary": {
"total": 45,
"critical": 2,
"high": 8,
"medium": 20,
"low": 15
},
"vulnerabilities": [
{
"id": "CVE-2023-44487",
"package": "nghttp2",
"installed_version": "1.51.0",
"fixed_version": "1.57.0",
"severity": "HIGH",
"title": "HTTP/2 Rapid Reset Attack"
}
]
}

trivy_fs_scan

Scan a filesystem or directory for vulnerable dependencies.

Parameters:

ParameterTypeRequiredDescription
pathstringYesDirectory path to scan
severitystringNoMinimum severity filter
scannersstringNoComma-separated scanners: vuln, secret, misconfig
formatstringNoOutput format
timeoutintegerNoScan timeout in seconds

Example:

# "Scan /app for vulnerabilities and exposed secrets"

Response:

{
"success": true,
"path": "/app",
"results": [
{
"target": "package.json",
"type": "npm",
"vulnerabilities": [
{
"id": "CVE-2024-12345",
"package": "lodash",
"installed": "4.17.20",
"fixed": "4.17.21",
"severity": "HIGH"
}
]
}
]
}

trivy_config_scan

Scan IaC configurations for misconfigurations.

Parameters:

ParameterTypeRequiredDescription
pathstringYesDirectory or file path
config_typestringNoType: terraform, kubernetes, dockerfile, helm
severitystringNoMinimum severity filter
formatstringNoOutput format

Example:

# "Check our Terraform configs for security misconfigurations"

Response:

{
"success": true,
"path": "/terraform",
"misconfigurations": [
{
"id": "AVD-AWS-0057",
"title": "S3 bucket has public access enabled",
"severity": "HIGH",
"file": "s3.tf",
"line": 15,
"resolution": "Set 'block_public_acls' to true"
}
]
}

trivy_sbom_generate

Generate a Software Bill of Materials (SBOM).

Parameters:

ParameterTypeRequiredDescription
targetstringYesImage or directory to scan
formatstringYesSBOM format: cyclonedx, spdx, spdx-json
outputstringNoOutput file path

Example:

# "Generate a CycloneDX SBOM for our production image"

trivy_repo_scan

Scan a remote git repository.

Parameters:

ParameterTypeRequiredDescription
repostringYesRepository URL
branchstringNoBranch to scan (default: main)
severitystringNoMinimum severity filter
scannersstringNoScanners to use

Example Agent

apiVersion: aof.sh/v1alpha1
kind: Agent
metadata:
name: container-scanner
spec:
model: google:gemini-2.5-flash
tools:
- trivy_image_scan
- trivy_config_scan

system_prompt: |
You are a container security specialist.

When scanning images:
1. Focus on CRITICAL and HIGH vulnerabilities
2. Identify if fixes are available
3. Recommend base image upgrades when applicable
4. Check for misconfigurations in Dockerfiles

Severity Levels

SeverityDescriptionRecommended Action
CRITICALActively exploited, RCEImmediate patch
HIGHSignificant impactPatch within 7 days
MEDIUMModerate impactPatch within 30 days
LOWMinor impactAddress in next release
UNKNOWNUnclassifiedInvestigate

CI/CD Integration

# Example: Security gate in CI
apiVersion: aof.sh/v1alpha1
kind: Agent
metadata:
name: ci-security-gate
spec:
model: google:gemini-2.5-flash
tools:
- trivy_image_scan
- trivy_config_scan

system_prompt: |
You are a CI/CD security gate.

Scan the provided image and fail the build if:
- Any CRITICAL vulnerabilities exist
- More than 5 HIGH vulnerabilities exist

Provide clear remediation guidance for each finding.