Langsung ke konten
Skillpedia
Agen35k Β· #8359

scanning-iac-and-images-with-trivy

Fungsinya

Alat ini memeriksa container image, file konfigurasi infrastruktur (seperti Terraform atau Kubernetes), dan kode untuk masalah keamanan. Alat ini mencari celah yang sudah diketahui, pengaturan yang keliru, dan informasi sensitif yang mungkin tidak sengaja terekspos.

Kapan dipakai

  • βœ“Saat membangun program baru dan ingin memastikan keamanannya sebelum digunakan.
  • βœ“Saat membuat perubahan pada cara infrastruktur teknologi diatur dan ingin memastikan perubahan tersebut aman.
  • βœ“Saat ingin memeriksa informasi sensitif (seperti password atau kunci) yang terekspos di dalam kode atau file konfigurasi.

Link skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/scanning-iac-and-images-with-trivy/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/scanning-iac-and-images-with-trivy/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œPindai container image 'my-app:latest' untuk mencari kerentanan dan misconfiguration.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Alat ini menggunakan program bernama Trivy untuk menganalisis file dan image. Hasilnya dibandingkan dengan database masalah yang sudah diketahui dan aturan keamanan untuk mengidentifikasi risiko.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Scanning IaC and Images with Trivy

Overview

Trivy (by Aqua Security) is a comprehensive, open-source security scanner that finds vulnerabilities (CVEs), misconfigurations (IaC), secrets, software licenses, and software supply-chain weaknesses across a wide range of targets: container images, filesystems, Git repositories, virtual machine images, Kubernetes clusters, and SBOM documents. It is widely adopted as a "shift-left" gate in CI/CD pipelines because it is fast, runs as a single static binary, requires no agent, and supports machine-readable output formats (JSON, SARIF, CycloneDX, SPDX) for integration with code-scanning dashboards.

Trivy bundles four primary scanners that can be toggled with --scanners:

  • vuln β€” OS package and language-dependency vulnerability detection (CVE matching against the Trivy vulnerability DB).
  • misconfig β€” Infrastructure-as-Code and configuration misconfiguration detection (Terraform, CloudFormation, Kubernetes manifests, Dockerfile, Helm) using built-in and custom Rego policies.
  • secret β€” Hard-coded secret/credential detection (API keys, tokens, private keys).
  • license β€” Software license identification and policy enforcement.

This skill covers building a Trivy-based scanning workflow that gates a CI/CD pipeline: scanning images before push, scanning IaC before apply, generating and re-scanning SBOMs, and failing builds on policy violations. Detecting these weaknesses defends against the MITRE ATT&CK technique T1525 (Implant Internal Image), where adversaries plant malicious or vulnerable images in a registry to be deployed across the environment.

When to Use

  • When integrating vulnerability and misconfiguration scanning into a CI/CD pipeline as a quality/security gate before images are pushed or infrastructure is applied.
  • When auditing container images in a registry for known CVEs prior to deployment.
  • When validating Terraform, CloudFormation, Kubernetes, Dockerfile, or Helm IaC for security misconfigurations.
  • When generating an SBOM (CycloneDX/SPDX) for supply-chain transparency and later re-scanning that SBOM for newly disclosed CVEs.
  • When scanning a running Kubernetes cluster for vulnerable workloads and misconfigured RBAC/resources.
  • When enforcing license compliance policy on dependencies.

Prerequisites

  • A Linux/macOS/Windows host or CI runner with network access to download the Trivy vulnerability database.
  • Docker (optional) if scanning local images by name or using the containerized Trivy.
  • Install Trivy (Aqua Security official methods):
# Debian/Ubuntu (APT repository)
sudo apt-get install -y wget gnupg
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb generic main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install -y trivy

# RHEL/CentOS (YUM repository), macOS (Homebrew), and install script
brew install trivy
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin

# Containerized usage (no install)
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy:latest image python:3.10-alpine

# Verify
trivy --version
  • For air-gapped or rate-limited environments, pre-download the DB with trivy image --download-db-only and the Java/policy bundles as needed.

Objectives

  • Scan a container image for OS and language vulnerabilities and fail the build above a severity threshold.
  • Scan IaC (Terraform/Kubernetes/Dockerfile) for misconfigurations.
  • Detect hard-coded secrets in a repository or filesystem.
  • Generate a CycloneDX or SPDX SBOM and re-scan it for vulnerabilities.
  • Emit SARIF for GitHub code scanning and JSON for programmatic gating.
  • Wire Trivy into a CI/CD pipeline with --exit-code to enforce policy.

MITRE ATT&CK Mapping

Technique ID Name Tactic Relevance
T1525 Implant Internal Image Persistence Trivy detects vulnerable or malicious images/layers and embedded secrets before they are implanted in a registry and propagated to running workloads.

Workflow

1. Scan a container image for vulnerabilities

…

Pertanyaan umum

Apa itu 'kerentanan'?

Ini adalah celah keamanan yang sudah diketahui pada perangkat lunak, yang dapat dimanfaatkan pihak jahat untuk menimbulkan kerugian atau mencuri informasi.

Apa itu 'misconfiguration'?

Ini adalah kesalahan dalam cara sistem atau program diatur, yang dapat menciptakan celah keamanan.

Apa itu 'secrets'?

Ini adalah informasi sensitif seperti password, API key, atau token yang tidak boleh terekspos di dalam kode atau file konfigurasi.

Detail

Deskripsi asli dari pembuat

Scans container images, Infrastructure-as-Code (Terraform, CloudFormation, Kubernetes manifests, Dockerfile, Helm), filesystems, git repos, and SBOMs with Trivy's vuln, misconfig, secret, and license scanners. Use when building a CI/CD security gate that scans images before push, IaC before apply, or SBOMs for supply-chain weaknesses, and fails the build on policy violations.

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularitas

Bintang GitHub
35k
Peringkat
#8359
Lisensi
Apache-2.0
Diperbarui
31/8/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa