Schedule icon
Commands icon
Docker icon
Script icon
If icon
SlackIncomingWebhook icon
Fail icon
Log icon

Scheduled Container Registry Vulnerability Audit with Trivy and Slack Alerts

Schedule recurring Trivy CVE audits for container images in any registry, summarize critical and fixable vulnerabilities, and alert Slack.

Categories
CloudInfrastructure

Build-time container vulnerability scanning only tests an image at the moment of build. However, new vulnerabilities and zero-day exploits are cataloged in public vulnerability databases (NVD) daily. An image that passed CI without warnings can accumulate multiple critical CVEs after running in production for several weeks.

This blueprint provides an ongoing security audit workflow for container images stored in container registries (Docker Hub, GitHub Container Registry, AWS ECR, or private registries):

  • Schedules periodic security audits using Aqua Security's Trivy vulnerability scanner.
  • Generates and parses a full JSON vulnerability report to isolate actionable CVEs with available patches.
  • Compares findings against configurable CRITICAL and HIGH thresholds.
  • Formats and dispatches an actionable Slack digest highlighting affected packages and fixed versions.
  • Supports optional hard failure gating for automated compliance pipelines.

How it works

  1. scan_image runs aquasec/trivy:latest via Kestra's Docker task runner to inspect inputs.image for CRITICAL and HIGH CVEs, saving results to trivy-report.json.
  2. parse_report executes a Python script to parse the JSON output, calculate total, critical, high, and fixable CVE counts, and compile a top 10 actionable summary table.
  3. evaluate_vulnerabilities (io.kestra.plugin.core.flow.If) tests whether findings exceed critical_threshold or high_threshold:
    • If exceeded: notify_slack_alert posts an alert card to Slack, and optionally triggers fail_execution if fail_on_critical is enabled.
    • If compliant: log_clean_audit logs verification confirmation.
  4. An errors block catches registry authentication errors or Docker pull failures and alerts the security team.

What you get

  • Continuous Post-Deployment Auditing: Identify zero-day CVEs in deployed containers on an ongoing schedule.
  • Actionable Fix Reports: Distinguishes between unfixable noise and CVEs where upstream vendor patches are available.
  • Customizable Severity Gates: Configure separate tolerance thresholds for HIGH and CRITICAL vulnerabilities.
  • Private Registry Ready: Supports authenticated scans via standard Kestra secret placeholders.

Prerequisites

  • Docker daemon access configured on the Kestra worker.
  • Network access to pull images from the target container registry.
  • A Slack incoming webhook URL for notifications.

Secrets

  • REGISTRY_USERNAME: (Optional) Username for private container registry access.
  • REGISTRY_PASSWORD: (Optional) Password or token for private container registry access.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for vulnerability notifications.

Quick start

  1. Configure SLACK_WEBHOOK_URL in your Kestra namespace secrets (and registry credentials if scanning private images).
  2. Set image to your target container image (e.g. python:3.11-slim or ghcr.io/org/app:latest).
  3. Run a manual execution to test initial scanning and Slack output.
  4. Keep weekly_security_audit active for automated Monday morning audits.

How to extend

  • Multi-Image Fanout: Wrap scan_image in an io.kestra.plugin.core.flow.Loop over a list of microservice images to audit an entire cluster.
  • Jira / GitHub Ticket Creation: Automatically open security remediation issues for any CVE marked as fixable.
  • SBOM Generation: Add a task with trivy image --format cyclonedx to generate CycloneDX SBOMs alongside vulnerability scans.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.