[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AG7Y300YF9S175PW635J1E":3,"skill-same:01M6AG7Y300YF9S175PW635J1E":111},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":66,"commitSha":67,"skillDirectory":68,"forksCount":69,"repositoryHtmlUrl":70,"repositoryHomepageUrl":71,"ownerHtmlUrl":72,"ownerBlogUrl":73,"ownerDescription":74,"updatedAt":75,"install":76,"resources":89},"01M6AG7Y300YF9S175PW635J1E","scanning-iac-and-images-with-trivy","Trivy 扫描 IaC 与镜像安全","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\u002FCD security gate that scans images before push, IaC before apply, or SBOMs for supply-chain weaknesses, and fails the build on policy violations.","使用 Trivy 的 vuln、misconfig、secret 和 license 扫描器扫描容器镜像、基础设施即代码（Terraform、CloudFormation、Kubernetes 清单、Dockerfile、Helm）、文件系统、git 仓库和 SBOM。在构建 CI\u002FCD 安全门控时使用，可在推送前扫描镜像、apply 前扫描 IaC、扫描 SBOM 以发现供应链弱点，并在违反策略时使构建失败。","mukul975\u002FAnthropic-Cybersecurity-Skills","mukul975","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42860185?v=4","01M6ADEQR8T5M4EEG6C67BQCWF","Mahipal","01M6ADJPMYWG1E5GM1FWBE3128",36146,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fscanning-iac-and-images-with-trivy\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BR4MYFKGCC4WCWVJ50KJ2C","安全工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C32Q37WAMK06SGMFC02VFP","软件供应链安全","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"scanning iac and images with trivy","trivy","ci","vulnerability","ci-cd","vulnerability-scanning","infrastructure-as-code","supply-chain","SBOM","container-security","devsecops","push","git","code","infrastructure","dockerfile","repos","cybersecurity","policy","security","2026-11-10 10:12:30",false,"---\nname: scanning-iac-and-images-with-trivy\ndescription: Scans container images, Infrastructure-as-Code (Terraform, CloudFormation,\n  Kubernetes manifests, Dockerfile, Helm), filesystems, git repos, and SBOMs with Trivy's\n  vuln, misconfig, secret, and license scanners. Use when building a CI\u002FCD security\n  gate that scans images before push, IaC before apply, or SBOMs for supply-chain\n  weaknesses, and fails the build on policy violations.\ndomain: cybersecurity\nsubdomain: devsecops\ntags:\n- devsecops\n- trivy\n- container-security\n- vulnerability-scanning\n- iac-security\n- sbom\n- ci-cd\n- misconfiguration\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- ID.RA-01\nmitre_attack:\n- T1525\n---\n# Scanning IaC and Images with Trivy\n\n## Overview\n\nTrivy (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\u002FCD 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.\n\nTrivy bundles four primary scanners that can be toggled with `--scanners`:\n\n- **vuln** — OS package and language-dependency vulnerability detection (CVE matching against the Trivy vulnerability DB).\n- **misconfig** — Infrastructure-as-Code and configuration misconfiguration detection (Terraform, CloudFormation, Kubernetes manifests, Dockerfile, Helm) using built-in and custom Rego policies.\n- **secret** — Hard-coded secret\u002Fcredential detection (API keys, tokens, private keys).\n- **license** — Software license identification and policy enforcement.\n\nThis skill covers building a Trivy-based scanning workflow that gates a CI\u002FCD 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.\n\n## When to Use\n\n- When integrating vulnerability and misconfiguration scanning into a CI\u002FCD pipeline as a quality\u002Fsecurity gate before images are pushed or infrastructure is applied.\n- When auditing container images in a registry for known CVEs prior to deployment.\n- When validating Terraform, CloudFormation, Kubernetes, Dockerfile, or Helm IaC for security misconfigurations.\n- When generating an SBOM (CycloneDX\u002FSPDX) for supply-chain transparency and later re-scanning that SBOM for newly disclosed CVEs.\n- When scanning a running Kubernetes cluster for vulnerable workloads and misconfigured RBAC\u002Fresources.\n- When enforcing license compliance policy on dependencies.\n\n## Prerequisites\n\n- A Linux\u002FmacOS\u002FWindows host or CI runner with network access to download the Trivy vulnerability database.\n- Docker (optional) if scanning local images by name or using the containerized Trivy.\n- Install Trivy (Aqua Security official methods):\n\n```bash\n# Debian\u002FUbuntu (APT repository)\nsudo apt-get install -y wget gnupg\nwget -qO - https:\u002F\u002Faquasecurity.github.io\u002Ftrivy-repo\u002Fdeb\u002Fpublic.key | gpg --dearmor | sudo tee \u002Fusr\u002Fshare\u002Fkeyrings\u002Ftrivy.gpg > \u002Fdev\u002Fnull\necho \"deb [signed-by=\u002Fusr\u002Fshare\u002Fkeyrings\u002Ftrivy.gpg] https:\u002F\u002Faquasecurity.github.io\u002Ftrivy-repo\u002Fdeb generic main\" | sudo tee \u002Fetc\u002Fapt\u002Fsources.list.d\u002Ftrivy.list\nsudo apt-get update\nsudo apt-get install -y trivy\n\n# RHEL\u002FCentOS (YUM repository), macOS (Homebrew), and install script\nbrew install trivy\ncurl -sfL https:\u002F\u002Fraw.githubusercontent.com\u002Faquasecurity\u002Ftrivy\u002Fmain\u002Fcontrib\u002Finstall.sh | sudo sh -s -- -b \u002Fusr\u002Flocal\u002Fbin\n\n# Containerized usage (no install)\ndocker run --rm -v \u002Fvar\u002Frun\u002Fdocker.sock:\u002Fvar\u002Frun\u002Fdocker.sock aquasec\u002Ftrivy:latest image python:3.10-alpine\n\n# Verify\ntrivy --version\n```\n\n- For air-gapped or rate-limited environments, pre-download the DB with `trivy image --download-db-only` and the Java\u002Fpolicy bundles as needed.\n\n## Objectives\n\n- Scan a container image for OS and language vulnerabilities and fail the build above a severity threshold.\n- Scan IaC (Terraform\u002FKubernetes\u002FDockerfile) for misconfigurations.\n- Detect hard-coded secrets in a repository or filesystem.\n- Generate a CycloneDX or SPDX SBOM and re-scan it for vulnerabilities.\n- Emit SARIF for GitHub code scanning and JSON for programmatic gating.\n- Wire Trivy into a CI\u002FCD pipeline with `--exit-code` to enforce policy.\n\n## MITRE ATT&CK Mapping\n\n| Technique ID | Name | Tactic | Relevance |\n|--------------|------|--------|-----------|\n| T1525 | Implant Internal Image | Persistence | Trivy detects vulnerable or malicious images\u002Flayers and embedded secrets before they are implanted in a registry and propagated to running workloads. |\n\n## Workflow\n\n### 1. Scan a container image for vulnerabilities\n\nRun a vulnerability-only scan of a registry image, restricting to high\u002Fcritical findings and ignoring CVEs with no available fix:\n\n```bash\ntrivy image \\\n  --scanners vuln \\\n  --severity HIGH,CRITICAL \\\n  --ignore-unfixed \\\n  --format table \\\n  python:3.10-alpine\n```\n\nScan an image saved as a tarball (useful when the image is built but not yet pushed):\n\n```bash\ndocker save myorg\u002Fapp:1.4.0 -o app.tar\ntrivy image --input app.tar --severity CRITICAL --format json --output app-vulns.json\n```\n\n### 2. Enable multiple scanners on an image\n\nRun vulnerability, misconfiguration, secret, and license scanners together:\n\n```bash\ntrivy image \\\n  --scanners vuln,misconfig,secret,license \\\n  --severity MEDIUM,HIGH,CRITICAL \\\n  myorg\u002Fapp:1.4.0\n```\n\nScan the image's embedded config (Dockerfile-equivalent build history and history secrets):\n\n```bash\ntrivy image --image-config-scanners misconfig,secret myorg\u002Fapp:1.4.0\n```\n\n### 3. Scan Infrastructure-as-Code (misconfiguration)\n\nScan a directory of Terraform \u002F Kubernetes \u002F Dockerfile \u002F Helm \u002F CloudFormation for misconfigurations using the `config` target:\n\n```bash\n# Scan a Terraform \u002F IaC directory\ntrivy config \\\n  --severity HIGH,CRITICAL \\\n  --format table \\\n  .\u002Finfra\n\n# Scan with custom Rego policies and a specific policy namespace\ntrivy config \\\n  --config-policy .\u002Fpolicies \\\n  --policy-namespaces user \\\n  .\u002Finfra\n```\n\nAlternatively use the `fs` (filesystem) target with the misconfig scanner explicitly:\n\n```bash\ntrivy fs --scanners misconfig,secret --severity HIGH,CRITICAL .\u002Finfra\n```\n\n### 4. Scan a repository and detect secrets\n\nScan a local working tree (or remote repo) for vulnerabilities in lockfiles and hard-coded secrets:\n\n```bash\n# Local filesystem (dependencies + secrets)\ntrivy fs --scanners vuln,secret --severity HIGH,CRITICAL .\n\n# Remote Git repository\ntrivy repository --scanners vuln,secret https:\u002F\u002Fgithub.com\u002Fmyorg\u002Fmyrepo\n```\n\n### 5. Generate and re-scan an SBOM\n\nProduce a CycloneDX SBOM from an image, then scan the SBOM itself for vulnerabilities (so a stored SBOM can be re-evaluated as new CVEs are disclosed):\n\n```bash\n# Generate CycloneDX SBOM\ntrivy image --format cyclonedx --output sbom.cdx.json myorg\u002Fapp:1.4.0\n\n# Generate SPDX SBOM\ntrivy image --format spdx-json --output sbom.spdx.json myorg\u002Fapp:1.4.0\n\n# Re-scan the SBOM for vulnerabilities later\ntrivy sbom --severity HIGH,CRITICAL sbom.cdx.json\n```\n\n### 6. Emit SARIF for code-scanning dashboards\n\nProduce SARIF for GitHub Advanced Security \u002F code scanning ingestion:\n\n```bash\ntrivy image \\\n  --format sarif \\\n  --output trivy-results.sarif \\\n  --severity HIGH,CRITICAL \\\n  myorg\u002Fapp:1.4.0\n```\n\n### 7. Gate the CI\u002FCD pipeline with exit codes\n\nUse `--exit-code 1` so the pipeline step fails when findings at or above the chosen severity are present. Separate the \"report everything\" run (exit 0) from the \"enforce\" run (exit 1):\n\n```bash\n# 1) Informational report (never fails the build)\ntrivy image --severity LOW,MEDIUM,HIGH,CRITICAL --exit-code 0 --format table myorg\u002Fapp:1.4.0\n\n# 2) Enforcement gate (fails build on HIGH\u002FCRITICAL with a fix available)\ntrivy image \\\n  --severity HIGH,CRITICAL \\\n  --ignore-unfixed \\\n  --exit-code 1 \\\n  --format json --output gate.json \\\n  myorg\u002Fapp:1.4.0\n```\n\nExample GitHub Actions step using the official action:\n\n```yaml\n- name: Run Trivy image scan (gate)\n  uses: aquasecurity\u002Ftrivy-action@master\n  with:\n    image-ref: 'myorg\u002Fapp:1.4.0'\n    format: 'sarif'\n    output: 'trivy-results.sarif'\n    severity: 'HIGH,CRITICAL'\n    ignore-unfixed: true\n    exit-code: '1'\n```\n\n### 8. Manage false positives and the DB\n\nSuppress accepted-risk findings with a `.trivyignore` file and keep the DB current:\n\n```bash\n# .trivyignore — one CVE\u002FAVD\u002Fsecret rule ID per line\necho \"CVE-2023-12345\" >> .trivyignore\necho \"AVD-AWS-0089\"   >> .trivyignore\n\n# Refresh DBs explicitly (useful for caching layers in CI)\ntrivy image --download-db-only\ntrivy image --download-java-db-only\n\n# Scan a Kubernetes cluster (summary report)\ntrivy k8s --report summary --severity HIGH,CRITICAL cluster\n```\n\n## Tools and Resources\n\n| Tool \u002F Resource | Purpose | Link |\n|------------------|---------|------|\n| Trivy | Core scanner CLI | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy |\n| Trivy Documentation | Official docs (targets, scanners, flags) | https:\u002F\u002Ftrivy.dev\u002Flatest\u002Fdocs\u002F |\n| trivy-action | GitHub Actions integration | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy-action |\n| Trivy Operator | In-cluster Kubernetes continuous scanning | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy-operator |\n| Trivy vulnerability DB | OSS vulnerability data source | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy-db |\n| CycloneDX | SBOM standard emitted by Trivy | https:\u002F\u002Fcyclonedx.org\u002F |\n\n## Validation Criteria\n\n- [ ] Trivy installed and `trivy --version` reports a valid version.\n- [ ] Container image scanned for vulnerabilities with severity filtering applied.\n- [ ] Image scanned with multiple scanners (vuln, misconfig, secret, license).\n- [ ] IaC directory scanned with `trivy config` and misconfigurations reviewed.\n- [ ] Secret scanning run against the repository.\n- [ ] CycloneDX\u002FSPDX SBOM generated and successfully re-scanned with `trivy sbom`.\n- [ ] SARIF output produced for the code-scanning dashboard.\n- [ ] CI\u002FCD gate fails the build on HIGH\u002FCRITICAL findings via `--exit-code 1`.\n- [ ] `.trivyignore` configured for accepted-risk findings with documented justification.\n","# Scanning IaC and Images with Trivy\n\n## Overview\n\nTrivy (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\u002FCD 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.\n\nTrivy bundles four primary scanners that can be toggled with `--scanners`:\n\n- **vuln** — OS package and language-dependency vulnerability detection (CVE matching against the Trivy vulnerability DB).\n- **misconfig** — Infrastructure-as-Code and configuration misconfiguration detection (Terraform, CloudFormation, Kubernetes manifests, Dockerfile, Helm) using built-in and custom Rego policies.\n- **secret** — Hard-coded secret\u002Fcredential detection (API keys, tokens, private keys).\n- **license** — Software license identification and policy enforcement.\n\nThis skill covers building a Trivy-based scanning workflow that gates a CI\u002FCD 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.\n\n## When to Use\n\n- When integrating vulnerability and misconfiguration scanning into a CI\u002FCD pipeline as a quality\u002Fsecurity gate before images are pushed or infrastructure is applied.\n- When auditing container images in a registry for known CVEs prior to deployment.\n- When validating Terraform, CloudFormation, Kubernetes, Dockerfile, or Helm IaC for security misconfigurations.\n- When generating an SBOM (CycloneDX\u002FSPDX) for supply-chain transparency and later re-scanning that SBOM for newly disclosed CVEs.\n- When scanning a running Kubernetes cluster for vulnerable workloads and misconfigured RBAC\u002Fresources.\n- When enforcing license compliance policy on dependencies.\n\n## Prerequisites\n\n- A Linux\u002FmacOS\u002FWindows host or CI runner with network access to download the Trivy vulnerability database.\n- Docker (optional) if scanning local images by name or using the containerized Trivy.\n- Install Trivy (Aqua Security official methods):\n\n```bash\n# Debian\u002FUbuntu (APT repository)\nsudo apt-get install -y wget gnupg\nwget -qO - https:\u002F\u002Faquasecurity.github.io\u002Ftrivy-repo\u002Fdeb\u002Fpublic.key | gpg --dearmor | sudo tee \u002Fusr\u002Fshare\u002Fkeyrings\u002Ftrivy.gpg > \u002Fdev\u002Fnull\necho \"deb [signed-by=\u002Fusr\u002Fshare\u002Fkeyrings\u002Ftrivy.gpg] https:\u002F\u002Faquasecurity.github.io\u002Ftrivy-repo\u002Fdeb generic main\" | sudo tee \u002Fetc\u002Fapt\u002Fsources.list.d\u002Ftrivy.list\nsudo apt-get update\nsudo apt-get install -y trivy\n\n# RHEL\u002FCentOS (YUM repository), macOS (Homebrew), and install script\nbrew install trivy\ncurl -sfL https:\u002F\u002Fraw.githubusercontent.com\u002Faquasecurity\u002Ftrivy\u002Fmain\u002Fcontrib\u002Finstall.sh | sudo sh -s -- -b \u002Fusr\u002Flocal\u002Fbin\n\n# Containerized usage (no install)\ndocker run --rm -v \u002Fvar\u002Frun\u002Fdocker.sock:\u002Fvar\u002Frun\u002Fdocker.sock aquasec\u002Ftrivy:latest image python:3.10-alpine\n\n# Verify\ntrivy --version\n```\n\n- For air-gapped or rate-limited environments, pre-download the DB with `trivy image --download-db-only` and the Java\u002Fpolicy bundles as needed.\n\n## Objectives\n\n- Scan a container image for OS and language vulnerabilities and fail the build above a severity threshold.\n- Scan IaC (Terraform\u002FKubernetes\u002FDockerfile) for misconfigurations.\n- Detect hard-coded secrets in a repository or filesystem.\n- Generate a CycloneDX or SPDX SBOM and re-scan it for vulnerabilities.\n- Emit SARIF for GitHub code scanning and JSON for programmatic gating.\n- Wire Trivy into a CI\u002FCD pipeline with `--exit-code` to enforce policy.\n\n## MITRE ATT&CK Mapping\n\n| Technique ID | Name | Tactic | Relevance |\n|--------------|------|--------|-----------|\n| T1525 | Implant Internal Image | Persistence | Trivy detects vulnerable or malicious images\u002Flayers and embedded secrets before they are implanted in a registry and propagated to running workloads. |\n\n## Workflow\n\n### 1. Scan a container image for vulnerabilities\n\nRun a vulnerability-only scan of a registry image, restricting to high\u002Fcritical findings and ignoring CVEs with no available fix:\n\n```bash\ntrivy image \\\n  --scanners vuln \\\n  --severity HIGH,CRITICAL \\\n  --ignore-unfixed \\\n  --format table \\\n  python:3.10-alpine\n```\n\nScan an image saved as a tarball (useful when the image is built but not yet pushed):\n\n```bash\ndocker save myorg\u002Fapp:1.4.0 -o app.tar\ntrivy image --input app.tar --severity CRITICAL --format json --output app-vulns.json\n```\n\n### 2. Enable multiple scanners on an image\n\nRun vulnerability, misconfiguration, secret, and license scanners together:\n\n```bash\ntrivy image \\\n  --scanners vuln,misconfig,secret,license \\\n  --severity MEDIUM,HIGH,CRITICAL \\\n  myorg\u002Fapp:1.4.0\n```\n\nScan the image's embedded config (Dockerfile-equivalent build history and history secrets):\n\n```bash\ntrivy image --image-config-scanners misconfig,secret myorg\u002Fapp:1.4.0\n```\n\n### 3. Scan Infrastructure-as-Code (misconfiguration)\n\nScan a directory of Terraform \u002F Kubernetes \u002F Dockerfile \u002F Helm \u002F CloudFormation for misconfigurations using the `config` target:\n\n```bash\n# Scan a Terraform \u002F IaC directory\ntrivy config \\\n  --severity HIGH,CRITICAL \\\n  --format table \\\n  .\u002Finfra\n\n# Scan with custom Rego policies and a specific policy namespace\ntrivy config \\\n  --config-policy .\u002Fpolicies \\\n  --policy-namespaces user \\\n  .\u002Finfra\n```\n\nAlternatively use the `fs` (filesystem) target with the misconfig scanner explicitly:\n\n```bash\ntrivy fs --scanners misconfig,secret --severity HIGH,CRITICAL .\u002Finfra\n```\n\n### 4. Scan a repository and detect secrets\n\nScan a local working tree (or remote repo) for vulnerabilities in lockfiles and hard-coded secrets:\n\n```bash\n# Local filesystem (dependencies + secrets)\ntrivy fs --scanners vuln,secret --severity HIGH,CRITICAL .\n\n# Remote Git repository\ntrivy repository --scanners vuln,secret https:\u002F\u002Fgithub.com\u002Fmyorg\u002Fmyrepo\n```\n\n### 5. Generate and re-scan an SBOM\n\nProduce a CycloneDX SBOM from an image, then scan the SBOM itself for vulnerabilities (so a stored SBOM can be re-evaluated as new CVEs are disclosed):\n\n```bash\n# Generate CycloneDX SBOM\ntrivy image --format cyclonedx --output sbom.cdx.json myorg\u002Fapp:1.4.0\n\n# Generate SPDX SBOM\ntrivy image --format spdx-json --output sbom.spdx.json myorg\u002Fapp:1.4.0\n\n# Re-scan the SBOM for vulnerabilities later\ntrivy sbom --severity HIGH,CRITICAL sbom.cdx.json\n```\n\n### 6. Emit SARIF for code-scanning dashboards\n\nProduce SARIF for GitHub Advanced Security \u002F code scanning ingestion:\n\n```bash\ntrivy image \\\n  --format sarif \\\n  --output trivy-results.sarif \\\n  --severity HIGH,CRITICAL \\\n  myorg\u002Fapp:1.4.0\n```\n\n### 7. Gate the CI\u002FCD pipeline with exit codes\n\nUse `--exit-code 1` so the pipeline step fails when findings at or above the chosen severity are present. Separate the \"report everything\" run (exit 0) from the \"enforce\" run (exit 1):\n\n```bash\n# 1) Informational report (never fails the build)\ntrivy image --severity LOW,MEDIUM,HIGH,CRITICAL --exit-code 0 --format table myorg\u002Fapp:1.4.0\n\n# 2) Enforcement gate (fails build on HIGH\u002FCRITICAL with a fix available)\ntrivy image \\\n  --severity HIGH,CRITICAL \\\n  --ignore-unfixed \\\n  --exit-code 1 \\\n  --format json --output gate.json \\\n  myorg\u002Fapp:1.4.0\n```\n\nExample GitHub Actions step using the official action:\n\n```yaml\n- name: Run Trivy image scan (gate)\n  uses: aquasecurity\u002Ftrivy-action@master\n  with:\n    image-ref: 'myorg\u002Fapp:1.4.0'\n    format: 'sarif'\n    output: 'trivy-results.sarif'\n    severity: 'HIGH,CRITICAL'\n    ignore-unfixed: true\n    exit-code: '1'\n```\n\n### 8. Manage false positives and the DB\n\nSuppress accepted-risk findings with a `.trivyignore` file and keep the DB current:\n\n```bash\n# .trivyignore — one CVE\u002FAVD\u002Fsecret rule ID per line\necho \"CVE-2023-12345\" >> .trivyignore\necho \"AVD-AWS-0089\"   >> .trivyignore\n\n# Refresh DBs explicitly (useful for caching layers in CI)\ntrivy image --download-db-only\ntrivy image --download-java-db-only\n\n# Scan a Kubernetes cluster (summary report)\ntrivy k8s --report summary --severity HIGH,CRITICAL cluster\n```\n\n## Tools and Resources\n\n| Tool \u002F Resource | Purpose | Link |\n|------------------|---------|------|\n| Trivy | Core scanner CLI | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy |\n| Trivy Documentation | Official docs (targets, scanners, flags) | https:\u002F\u002Ftrivy.dev\u002Flatest\u002Fdocs\u002F |\n| trivy-action | GitHub Actions integration | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy-action |\n| Trivy Operator | In-cluster Kubernetes continuous scanning | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy-operator |\n| Trivy vulnerability DB | OSS vulnerability data source | https:\u002F\u002Fgithub.com\u002Faquasecurity\u002Ftrivy-db |\n| CycloneDX | SBOM standard emitted by Trivy | https:\u002F\u002Fcyclonedx.org\u002F |\n\n## Validation Criteria\n\n- [ ] Trivy installed and `trivy --version` reports a valid version.\n- [ ] Container image scanned for vulnerabilities with severity filtering applied.\n- [ ] Image scanned with multiple scanners (vuln, misconfig, secret, license).\n- [ ] IaC directory scanned with `trivy config` and misconfigurations reviewed.\n- [ ] Secret scanning run against the repository.\n- [ ] CycloneDX\u002FSPDX SBOM generated and successfully re-scanned with `trivy sbom`.\n- [ ] SARIF output produced for the code-scanning dashboard.\n- [ ] CI\u002FCD gate fails the build on HIGH\u002FCRITICAL findings via `--exit-code 1`.\n- [ ] `.trivyignore` configured for accepted-risk findings with documented justification.\n",{"name":5,"tags":56,"author":60,"domain":48,"license":16,"version":61,"nist_csf":62,"subdomain":41,"description":7,"mitre_attack":64},[41,32,40,36,57,58,35,59],"iac-security","sbom","misconfiguration","mahipal","1.0",[63],"ID.RA-01",[65],"T1525","main","54a798831d2266a3ca61ce68a7acb80b81160d57","skills\u002Fscanning-iac-and-images-with-trivy",4425,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","https:\u002F\u002Fmahipal.engineer\u002FAnthropic-Cybersecurity-Skills\u002F","https:\u002F\u002Fgithub.com\u002Fmukul975","Mahipal.engineer","🔐 Cybersecurity | 💻 Dev | 📷 Street Photographer\r\n🎓 MSc | 📚 Research & AI Security","2026-08-31 12:32:44",{"source":9,"skillName":5,"commands":77,"prompt":87,"zipAvailable":88},[78,81,84],{"tool":79,"command":80},"npx","npx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill scanning-iac-and-images-with-trivy",{"tool":82,"command":83},"bunx","bunx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill scanning-iac-and-images-with-trivy",{"tool":85,"command":86},"pnpm","pnpm dlx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill scanning-iac-and-images-with-trivy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fscanning-iac-and-images-with-trivy\u002FSKILL.md",true,[90,95,101,105],{"path":91,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":93,"sourceHtmlUrl":94},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fscanning-iac-and-images-with-trivy\u002FLICENSE",{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fapi-reference.md","REFERENCE","参考文档",2940,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fscanning-iac-and-images-with-trivy\u002Freferences\u002Fapi-reference.md",{"path":102,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fstandards.md",1424,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fscanning-iac-and-images-with-trivy\u002Freferences\u002Fstandards.md",{"path":106,"resourceType":107,"resourceTypeDesc":108,"sizeBytes":109,"sourceHtmlUrl":110},"scripts\u002Fagent.py","SCRIPT","脚本",6174,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fscanning-iac-and-images-with-trivy\u002Fscripts\u002Fagent.py",[112,138,166,197,228,259],{"skillNo":113,"name":114,"nameZh":115,"description":116,"descriptionZh":117,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":118,"categories":119,"keywords":122,"publishedAt":51},"01M6AGDM3HJXTKXX15ZZ0ZVCJ3","verifying-build-provenance-with-slsa-sigstore","SLSA 构建来源验证","Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI\u002FCD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during incident response or admission control.","使用 Sigstore 的 cosign（verify、verify-attestation、verify-blob-attestation）和 slsa-verifier（verify-artifact）验证工件签名和 SLSA 来源（provenance），强制校验 keyless OIDC 构建者身份和源仓库是否符合 SLSA Build 级别。适用于 CI\u002FCD 中部署工件前、消费第三方证明时、建立 SLSA Build L3 管道，或在事件响应或准入控制期间确认来源的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fverifying-build-provenance-with-slsa-sigstore\u002FSKILL.md",[120,121],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[123,124,125,126,50,48,127,128,129,44,130,33,38,131,132,133,134,135,136,137],"sigstore","provenance","slsa","verifying build provenance with slsa sigstore","incident response","identity","pr","artifacts","pipeline","supply-chain-security","t1195","attestation","code-signing","cosign","keyless",{"skillNo":139,"name":140,"nameZh":141,"description":142,"descriptionZh":143,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":144,"categories":145,"keywords":150,"publishedAt":51},"01M6AGDGBPWYVZ2F11GFKJ4HZ9","validating-tpm-measured-boot-attestation","TPM 测量启动验证","Verifies TPM 2.0 measured-boot integrity and remote attestation with tpm2-tools -- reading PCRs (tpm2_pcrread), replaying the boot event log, generating and checking signed quotes (tpm2_quote\u002Ftpm2_checkquote), and sealing secrets to a PCR policy. Use to confirm a system booted trusted firmware\u002Fkernel for Zero Trust device posture, detect boot-chain tampering via PCR drift, or build a golden-value baseline for fleet attestation.","使用 tpm2-tools 验证 TPM 2.0 测量启动（measured boot）的完整性和远程证明：读取 PCR（tpm2_pcrread）、重放启动事件日志、生成并检查签名报价（tpm2_quote\u002Ftpm2_checkquote），以及将机密封印（seal）到 PCR 策略。适用于确认系统已启动可信固件\u002F内核以实现零信任（Zero Trust）设备状态、通过 PCR 漂移检测启动链篡改，或构建黄金值基线用于机群（fleet）证明。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-tpm-measured-boot-attestation\u002FSKILL.md",[146,147],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":148,"categoryName":149,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C89JJEXGGRGHS6XVXDA46K","终端安全加固",[151,134,152,153,50,49,48,129,154,155,156,157,158,159,160,161,162,163,164,165],"boot","TPM","validating tpm measured boot attestation","verification","ZeRO","firmware","Tools","measured-boot","PCR","integrity","secrets","remote-attestation","tpm2-tools","integrity-verification","trusted-computing",{"skillNo":167,"name":168,"nameZh":169,"description":170,"descriptionZh":171,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":172,"categories":173,"keywords":180,"publishedAt":51},"01M6AGDCW0Y4FXZ3362GT1941M","validating-backup-integrity-for-recovery","备份完整性验证","Validates backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to confirm backups are reliable for disaster recovery and ransomware response. Use before relying on backups for recovery, when building post-backup validation pipelines, auditing backup infrastructure for compliance, or checking immutable\u002Fair-gapped backups for silent corruption or tampering.","通过加密哈希验证、自动化恢复测试、损坏检测和可恢复性检查来验证备份完整性，确认备份对于灾难恢复和勒索软件响应是可靠的。适用于在依赖备份进行恢复之前、构建备份后验证管道、审计备份基础设施以满足合规要求，或检查不可变\u002Fair-gapped（气隙）备份是否存在静默损坏或篡改的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[174,177],{"categoryNo":175,"categoryName":176,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD4WETX0HM3SM9QKQ15B","SRE 工程师",{"categoryNo":178,"categoryName":179,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSSTY86MWS6W5GDQWB1ADQ","备份与灾难恢复",[160,181,182,183,184,48,45,185,154,186,187,188,189,190,191,192,193,194,195,196],"backup","recovery","validating backup integrity for recovery","testing","validation","compliance","hash-verification","incident-response","ransomware","cryptocurrency","detection","t1078","t1490","immutable","disaster-recovery","restore-testing",{"skillNo":198,"name":199,"nameZh":200,"description":201,"descriptionZh":202,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":203,"categories":204,"keywords":209,"publishedAt":51},"01M6AGD9GBG2KZ336AE763J3WH","triaging-windows-with-kape","KAPE Windows 取证收集","Runs KAPE (Kroll Artifact Parser and Extractor) to collect targeted forensic artifacts (registry hives, $MFT, event logs, prefetch, browser data) via Targets and parse them with Modules wrapping Eric Zimmerman's EZ Tools (PECmd, MFTECmd, RECmd). Use during early incident containment\u002Ftriage when full disk imaging is impractical but a defensible, parseable Windows artifact set is needed quickly, including at-scale remote collection.","运行 KAPE（Kroll Artifact Parser and Extractor），通过 Targets 收集目标取证工件（注册表配置单元、$MFT、事件日志、prefetch、浏览器数据），并使用封装 Eric Zimmerman 的 EZ Tools（PECmd、MFTECmd、RECmd）的 Modules 进行解析。适用于事件遏制\u002F分诊早期阶段——此时完整磁盘镜像不切实际，但需要快速获得可采信、可解析的 Windows 工件集，包括大规模远程收集。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-windows-with-kape\u002FSKILL.md",[205,206],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":207,"categoryName":208,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C9JZH3GWXPJ6CQG5P7J48Y","数字取证与电子证据分析",[210,211,212,48,213,214,215,216,217,218,219,220,221,222,223,224,157,225,226,227],"windows","kape","triaging windows with kape","registry","browser","logs","windows-forensics","dfir","mft","mftecmd","data","prefetch","eric-zimmerman","digital-forensics","SET","collection","pecmd","artifact-collection",{"skillNo":229,"name":230,"nameZh":231,"description":232,"descriptionZh":233,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":234,"categories":235,"keywords":240,"publishedAt":51},"01M6AGD5PW5J4EVZM958WD74ZQ","triaging-vulnerabilities-with-ssvc-framework","SSVC 漏洞优先级分诊","Triages and prioritizes vulnerabilities with CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree, weighing exploitation status (via the CISA KEV catalog and FIRST EPSS API), technical impact, automatability, and mission prevalence to output Track\u002FTrack*\u002FAttend\u002FAct decisions. Use when prioritizing vulnerability scan results (OpenVAS, Nessus, Qualys) for remediation planning beyond raw CVSS scores.","使用 CISA 的 Stakeholder-Specific Vulnerability Categorization（SSVC，利益相关方特定漏洞分类）决策树对漏洞进行分诊和优先级排序，权衡利用状态（通过 CISA KEV 目录和 FIRST EPSS API）、技术影响、自动化程度和任务普遍性，输出 Track\u002FTrack*\u002FAttend\u002FAct 决策。适用于对漏洞扫描结果（OpenVAS、Nessus、Qualys）进行优先级排序以制定修复计划，而不局限于原始 CVSS 分数的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[236,239],{"categoryNo":237,"categoryName":238,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQV98CYQ7TEW2D1MRQ00TE","安全公告与漏洞管理",{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},[241,242,243,48,244,245,246,247,248,249,250,251,252,253,254,34,255,256,257,258],"vulnerabilities","framework","triaging vulnerabilities with ssvc framework","status","planning","CISA","vulnerability-management","risk-management","nessus","qualys","openvas","cvss","remediation","risk","api","prioritization","ssvc","decision-tree",{"skillNo":260,"name":261,"nameZh":262,"description":263,"descriptionZh":264,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":265,"categories":266,"keywords":271,"publishedAt":51},"01M6AGD24TTQQM4CXG69E3B9TJ","triaging-security-incident","安全事件初步分诊","Performs initial triage of security incidents using the NIST SP 800-61r3 and SANS PICERL frameworks, classifying incident type, assigning priority by business impact, and routing to the appropriate response team. Use when a SIEM\u002FEDR alert needs human classification, concurrent alerts must be prioritized, or a user report or threat-intel IOC match requires initial incident categorization.","使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初步分诊，分类事件类型、按业务影响分配优先级，并路由到相应的响应团队。适用于 SIEM\u002FEDR 告警需要人工分类、并发告警必须确定优先级，或用户报告或威胁情报 IOC 匹配需要初步事件分类的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-security-incident\u002FSKILL.md",[267,268],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":269,"categoryName":270,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTHYSJPJ500X64JJ5CH06D","安全事件响应与威胁狩猎",[50,272,48,273,274,275,276,277,278,279,280,192,281,193,282,283,284,285,286,287],"triaging security incident","siem","file","ioc","soc","NIST-800-61","NIST","severity","edr","execution","analysis","classification","severity-classification","incident-triage","SANS-PICERL","SOC-operations"]