scan_image_with_trivy
Scan container images for known vulnerabilities in OS packages and application dependencies with Trivy. Identify affected packages, fixed versions, and severity to secure deployments before release.
Instructions
Scan a container image using Trivy for vulnerabilities.
This tool scans container images for known vulnerabilities in:
OS packages (Alpine, Debian, Ubuntu, RHEL, etc.)
Application dependencies (Python, Node.js, Java, Go, etc.)
Base image vulnerabilities
The output is minimized to show only essential information:
Vulnerability ID and severity
Affected package and versions
Fixed version (if available)
Primary reference URL
This is particularly useful for:
Scanning base images used in Dockerfiles
Checking for vulnerabilities before deployment
Security audits of container images
Args: image_name: Container image to scan (e.g., nginx:latest, python:3.9, ghcr.io/owner/image:tag) severity_threshold: Minimum severity level to report (LOW, MEDIUM, HIGH, CRITICAL)
Returns: A dictionary with vulnerability findings from Trivy (minimized output)
Note: Trivy must be installed and available in PATH. Install with: - macOS: brew install trivy - Linux: See https://aquasecurity.github.io/trivy/latest/getting-started/installation/
The image will be pulled if not available locally.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_name | Yes | Container image name to scan (e.g., nginx:latest, ghcr.io/owner/image:tag) | |
| return_output | No | Return full output instead of saving to file (default: False) | |
| severity_threshold | No | Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL) | MEDIUM |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |