Skillpedia
الوكلاء35k · #8359

scanning-iac-and-images-with-trivy

ما الذي تفعله

تفحص هذه المهارة صور البرامج (مثل تلك المستخدمة في الحاويات)، وملفات إعداد البنية التحتية (مثل Terraform وKubernetes)، والشيفرة، بحثاً عن مشكلات أمنية. تبحث عن الثغرات المعروفة والإعدادات الخاطئة والمعلومات الحساسة التي ربما تُركت مكشوفة عن طريق الخطأ.

متى تستخدمها

  • ✓عندما تبني برنامجاً جديداً وتريد التأكد من أمانه قبل استخدامه.
  • ✓عندما تجري تغييرات على إعداد البنية التقنية وتريد التحقق من أن التغييرات آمنة.
  • ✓عندما تفحص المعلومات الحساسة، مثل كلمات المرور أو المفاتيح، المكشوفة في الشيفرة أو ملفات الإعداد.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/scanning-iac-and-images-with-trivy/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“ساعدني في فحص صورة الحاوية « my-app:latest » بحثاً عن الثغرات والإعدادات الخاطئة.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تستخدم هذه المهارة برنامج Trivy لتحليل الملفات والصور. تقارن ما تجده بقواعد بيانات المشكلات المعروفة وقواعد الأمان لتحديد المخاطر.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من 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

…

الأسئلة الشائعة

ما هي الثغرات؟

هي نقاط ضعف أمنية معروفة في البرمجيات قد يستغلها أشخاص خبيثون للإضرار أو سرقة المعلومات.

ما هي الإعدادات الخاطئة؟

هي أخطاء في طريقة تهيئة الأنظمة أو البرامج، وقد تفتح ثغرات أمنية.

ما هي الأسرار؟

هي معلومات حساسة مثل كلمات المرور ومفاتيح API والرموز (tokens)، ولا يجب أن تظهر في الشيفرة أو ملفات الإعداد.

التفاصيل

الوصف الأصلي من المؤلف

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

الشعبية

نجوم GitHub
35k
الترتيب
#8359
الترخيص
Apache-2.0
آخر تحديث
31‏/8‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة