New to Claude Skills? Learn how to install them →

mukul975 on GitHub

Aqua Security for Container Scanning

Free

Enhance your CI/CD pipeline with robust container security.

Get this skill

Free · Opens the source repo

What Aqua Security for Container Scanning does

Implementing Aqua Security for Container Scanning allows developers and security professionals to integrate Trivy, a powerful open-source security scanner, into their CI/CD pipelines. Trivy scans container images for vulnerabilities, misconfigurations, secrets, and license issues, providing comprehensive security coverage across various environments. It supports a wide range of OS packages and language-specific dependencies, ensuring that your applications remain secure from known vulnerabilities.

The skill is designed for teams looking to establish security controls aligned with compliance requirements or improve their security architecture. By utilizing Trivy, users can perform image vulnerability scanning, filesystem and repository scanning, and Kubernetes scanning. The integration with CI/CD platforms like GitHub Actions, GitLab CI, and Jenkins allows for seamless security checks during the build process, ensuring that vulnerabilities are identified and addressed before deployment.

With the ability to generate Software Bill of Materials (SBOM) in CycloneDX and SPDX formats, users can maintain visibility into their dependencies and manage vulnerabilities effectively. The skill also supports policy configuration through Open Policy Agent (OPA) and allows for the creation of ignore files to manage accepted risks. This makes it a valuable tool for organizations committed to maintaining high security standards in their software development lifecycle.

When to use it

Use this skill when implementing security measures for containerized applications in CI/CD pipelines or when conducting security assessments of container images.

When not to use it

This skill may not be suitable for environments that do not utilize containerization or where security scanning is not a priority.

What you can build with it

Integrating with GitHub Actions

Set up Trivy in your GitHub Actions workflow to automatically scan container images for vulnerabilities on every push.

Continuous Kubernetes Security

Deploy the Trivy Operator in your Kubernetes cluster to continuously monitor workloads for vulnerabilities and misconfigurations.

Generating SBOMs for Compliance

Use Trivy to generate SBOMs in CycloneDX or SPDX formats to maintain compliance with software supply chain security standards.

How to install Aqua Security for Container Scanning

View source

1. Install with the skills CLI

npx skills add mukul975/anthropic-cybersecurity-skills/implementing-aqua-security-for-container-scanning --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mukul975

Implementing Aqua Security for Container Scanning

Overview

Aqua Security provides Trivy, the world's most popular open-source universal security scanner, designed to find vulnerabilities, misconfigurations, secrets, SBOM data, and license issues in containers, Kubernetes, code repositories, and cloud environments. Trivy covers OS packages (Alpine, Debian, Ubuntu, RHEL, etc.) and language-specific dependencies (npm, pip, Maven, Go modules, Cargo, etc.) with vulnerability databases sourced from NVD, vendor advisories, and GitHub Security Advisories. The enterprise Aqua Platform extends Trivy with centralized policy management, runtime protection, and compliance reporting.

When to Use

  • When deploying or configuring implementing aqua security for container scanning capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Docker installed for local image scanning
  • CI/CD platform (GitHub Actions, GitLab CI, Jenkins, etc.)
  • Container registry access (Docker Hub, ECR, GCR, ACR, Harbor)
  • Trivy CLI (trivy) or Trivy Operator for Kubernetes
  • Aqua Platform license for enterprise features (optional)

Core Scanning Capabilities

Image Vulnerability Scanning

Trivy scans container images layer by layer, identifying CVEs in OS packages and application dependencies. It supports scanning local images, remote registry images, and tar archives.

# Scan a remote image
trivy image python:3.11-slim

# Scan with severity filter
trivy image --severity HIGH,CRITICAL nginx:latest

# Scan and fail CI if critical CVEs found
trivy image --exit-code 1 --severity CRITICAL myapp:latest

# Generate SBOM in CycloneDX format
trivy image --format cyclonedx --output sbom.json myapp:latest

Filesystem and Repository Scanning

# Scan project directory for vulnerabilities in dependencies
trivy fs --scanners vuln,secret,misconfig .

# Scan a specific lockfile
trivy fs --scanners vuln package-lock.json

# Scan git repository
trivy repo https://github.com/org/project

Kubernetes Scanning with Trivy Operator

The Trivy Operator runs inside a Kubernetes cluster and continuously scans workloads:

# Install Trivy Operator via Helm
helm repo add aqua https://aquasecurity.github.io/helm-charts/
helm repo update
helm install trivy-operator aqua/trivy-operator \
  --namespace trivy-system \
  --create-namespace \
  --set trivy.severity="HIGH,CRITICAL" \
  --set operator.scanJobTimeout="5m"

The operator creates VulnerabilityReport and ConfigAuditReport custom resources for each workload.

IaC Misconfiguration Scanning

# Scan Terraform files
trivy config --severity HIGH,CRITICAL ./terraform/

# Scan Dockerfile for misconfigurations
trivy config Dockerfile

# Scan Kubernetes manifests
trivy config ./k8s-manifests/

CI/CD Integration

GitHub Actions

name: Container Security Scan
on:
  push:
    branches: [main]
  pull_request:

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build Docker image
        run: docker build -t myapp:${{ github.sha }} .

      - name: Run Trivy vulnerability scanner
        uses: aquasecurity/trivy-action@master
        with:
          image-ref: 'myapp:${{ github.sha }}'
          format: 'sarif'
          output: 'trivy-results.sarif'
          severity: 'CRITICAL,HIGH'
          exit-code: '1'

      - name: Upload Trivy scan results to GitHub Security tab
        uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: 'trivy-results.sarif'

GitLab CI

container_scanning:
  stage: security
  image:
    name: aquasec/trivy:latest
    entrypoint: [""]
  variables:
    FULL_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
  script:
    - trivy image --exit-code 0 --format template --template "@/contrib/gitlab.tpl"
      --output gl-container-scanning-report.json $FULL_IMAGE_NAME
    - trivy image --exit-code 1 --severity CRITICAL $FULL_IMAGE_NAME
  artifacts:
    reports:
      container_scanning: gl-container-scanning-report.json

Jenkins Pipeline

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'docker build -t myapp:${BUILD_NUMBER} .'
            }
        }
        stage('Security Scan') {
            steps {
                sh '''
                    trivy image --exit-code 1 \
                      --severity HIGH,CRITICAL \
                      --format json \
                      --output trivy-report.json \
                      myapp:${BUILD_NUMBER}
                '''
            }
            post {
                always {
                    archiveArtifacts artifacts: 'trivy-report.json'
                }
            }
        }
    }
}

Policy Configuration

Trivy Policy with OPA/Rego

Create .trivy/policy.rego for custom policy enforcement:

package trivy

deny[msg] {
    input.Results[_].Vulnerabilities[_].Severity == "CRITICAL"
    msg := "Critical vulnerabilities found in image"
}

deny[msg] {
    input.Results[_].Vulnerabilities[vuln]
    vuln.FixedVersion != ""
    vuln.Severity == "HIGH"
    msg := sprintf("Fixable HIGH vulnerability: %s", [vuln.VulnerabilityID])
}

Ignore File Configuration

Create .trivyignore for accepted risks:

# Accepted risk: vulnerability in test dependency only
CVE-2023-12345

# Accepted until expiry date
CVE-2024-67890 exp:2025-06-01

SBOM Generation and Management

# Generate CycloneDX SBOM
trivy image --format cyclonedx --output sbom-cyclonedx.json myapp:latest

# Generate SPDX SBOM
trivy image --format spdx-json --output sbom-spdx.json myapp:latest

# Scan an existing SBOM for new vulnerabilities
trivy sbom sbom-cyclonedx.json

Monitoring and Reporting

MetricDescriptionTarget
Images scanned per dayTotal images passing through scanning pipelineAll production images
Critical CVE countOpen critical vulnerabilities across all images0 in production
Mean time to patchAverage days from CVE publication to patched image< 7 days
SBOM coveragePercentage of production images with generated SBOMs100%
Scan durationAverage time per image scan< 2 minutes

References

Frequently asked questions about Aqua Security for Container Scanning

Similar skills