[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71BGP0GFJVTZCQX0P4HMX1N":3,"skill-same:01M71BGP0GFJVTZCQX0P4HMX1N":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":29,"publishedAt":50,"linkOnly":51,"markdownContent":52,"markdownBody":53,"frontMatter":54,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":6,"ownerHtmlUrl":63,"ownerBlogUrl":6,"ownerDescription":64,"updatedAt":65,"install":66,"resources":78},"01M71BGP0GFJVTZCQX0P4HMX1N","cyber-scanning-containers-with-trivy-in-cicd",null,"This skill covers integrating Aqua Security''s Trivy scanner into CI\u002FCD pipelines for comprehensive container image vulnerability detection. It addresses scanning Docker images for OS package and application dependency CVEs, detecting misconfigurations in Dockerfiles, scanning filesystem and git repositories, and establishing severity-based quality gates that block deployment of vulnerable images.","nexuslinkproductions\u002Fyuri-os","nexuslinkproductions","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F273246263?v=4","01M718YX9NZRCW50B59B8ZVDKN","Marcel Spatz","01M718YXAQ7530F4B1VKN6SFQV",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-scanning-containers-with-trivy-in-cicd\u002FSKILL.md",[18,23,26],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49],"cyber scanning containers with trivy in cicd","scanning containers with trivy in cicd","containers","with","cicd","trivy","scanning","addresses","git","CI\u002FCD","dependency","scanner","aqua","vulnerability","image","false","cybersecurity","ci","detecting","images","2026-11-10 10:12:30",false,"---\nname: cyber-scanning-containers-with-trivy-in-cicd\ndescription: \"This skill covers integrating Aqua Security''s Trivy scanner into CI\u002FCD pipelines for comprehensive container image vulnerability detection. It addresses scanning Docker images for OS package and application dependency CVEs, detecting misconfigurations in Dockerfiles, scanning filesystem and git repositories, and establishing severity-based quality gates that block deployment of vulnerable images.\"\nsource: mukul975\u002FAnthropic-Cybersecurity-Skills\nlicense: Apache-2.0\nauthorized_lab: false\norigin_frontmatter: \"name: scanning-containers-with-trivy-in-cicd | description: 'This skill covers integrating Aqua Security''s Trivy scanner into CI\u002FCD |   pipelines for comprehensive container image vulnerability detection. It addresses |   scanning Docker images for OS package and application dependency CVEs, detecting |   misconfigurations in Dockerfiles, scanning filesystem and git repositories, and |   establishing severity-based quality gates that block deployment of vulnerable images. |  |   ' | domain: cyb\"\nhide: true\n---\n\n> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Scanning Containers with Trivy in CI\u002FCD\n\n## When to Use\n\n- When building Docker container images in CI\u002FCD and needing automated vulnerability scanning before registry push\n- When establishing quality gates that prevent images with critical or high CVEs from reaching production\n- When compliance requirements mandate vulnerability scanning of all container images before deployment\n- When scanning IaC files (Dockerfiles, Kubernetes manifests) alongside container image scanning\n- When needing a single tool to scan OS packages, language-specific dependencies, and misconfigurations\n\n**Do not use** for runtime container security monitoring (use Falco), for scanning running containers in production (use runtime agents), or when only scanning application source code without containerization (use SAST tools).\n\n## Prerequisites\n\n- Trivy CLI installed (v0.50+) or access to aquasecurity\u002Ftrivy-action GitHub Action\n- Docker daemon available in CI\u002FCD for building and scanning images\n- Container registry credentials for pulling base images and pushing scanned images\n- Trivy vulnerability database accessible (downloaded automatically or cached)\n\n## Workflow\n\n### Step 1: Configure Trivy Scanning in GitHub Actions\n\nSet up a GitHub Actions workflow that builds a Docker image and scans it with Trivy before pushing to a container registry.\n\n```yaml\n# .github\u002Fworkflows\u002Fcontainer-security.yml\nname: Container Security Scan\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n    paths:\n      - 'Dockerfile'\n      - 'docker-compose*.yml'\n      - 'src\u002F**'\n      - 'requirements*.txt'\n      - 'package*.json'\n\njobs:\n  build-and-scan:\n    runs-on: ubuntu-latest\n    permissions:\n      security-events: write\n      contents: read\n\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Build Docker image\n        run: docker build -t app:${{ github.sha }} .\n\n      - name: Run Trivy vulnerability scanner\n        uses: aquasecurity\u002Ftrivy-action@0.28.0\n        with:\n          image-ref: 'app:${{ github.sha }}'\n          format: 'sarif'\n          output: 'trivy-results.sarif'\n          severity: 'CRITICAL,HIGH'\n          exit-code: '1'\n          ignore-unfixed: true\n\n      - name: Upload Trivy scan results\n        uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n        if: always()\n        with:\n          sarif_file: 'trivy-results.sarif'\n          category: 'trivy-container'\n\n      - name: Run Trivy misconfiguration scanner\n        uses: aquasecurity\u002Ftrivy-action@0.28.0\n        with:\n          scan-type: 'config'\n          scan-ref: '.'\n          format: 'table'\n          exit-code: '1'\n          severity: 'CRITICAL,HIGH'\n```\n\n### Step 2: Scan Dockerfiles for Misconfigurations\n\nTrivy detects common Dockerfile security issues such as running as root, using latest tags, and exposing unnecessary ports.\n\n```bash\n# Scan Dockerfile for misconfigurations\ntrivy config --severity HIGH,CRITICAL .\u002FDockerfile\n\n# Scan with custom policy directory\ntrivy config --policy .\u002Fsecurity-policies --severity MEDIUM,HIGH,CRITICAL .\n\n# Example secure Dockerfile practices Trivy checks for:\n# - USER instruction present (not running as root)\n# - HEALTHCHECK instruction defined\n# - Base image uses specific tag, not :latest\n# - No secrets in ENV or ARG instructions\n# - COPY preferred over ADD\n```\n\n### Step 3: Integrate with GitLab CI\u002FCD\n\n```yaml\n# .gitlab-ci.yml\nstages:\n  - build\n  - scan\n  - push\n\nvariables:\n  TRIVY_CACHE_DIR: .trivycache\u002F\n\nbuild:\n  stage: build\n  script:\n    - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .\n    - docker save $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -o image.tar\n  artifacts:\n    paths:\n      - image.tar\n\ntrivy-scan:\n  stage: scan\n  image:\n    name: aquasec\u002Ftrivy:latest\n    entrypoint: [\"\"]\n  cache:\n    paths:\n      - .trivycache\u002F\n  script:\n    - trivy image\n        --input image.tar\n        --exit-code 1\n        --severity CRITICAL,HIGH\n        --ignore-unfixed\n        --format json\n        --output trivy-report.json\n    - trivy image\n        --input image.tar\n        --severity CRITICAL,HIGH,MEDIUM\n        --format table\n  artifacts:\n    reports:\n      container_scanning: trivy-report.json\n    paths:\n      - trivy-report.json\n  allow_failure: false\n\npush:\n  stage: push\n  needs: [trivy-scan]\n  script:\n    - docker load -i image.tar\n    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA\n```\n\n### Step 4: Configure Trivy Ignore and Exception Handling\n\nManage false positives and accepted risks through Trivy's ignore file and VEX statements.\n\n```yaml\n# .trivyignore.yaml\nvulnerabilities:\n  - id: CVE-2023-44487    # HTTP\u002F2 rapid reset - mitigated at load balancer\n    statement: \"Mitigated by WAF rate limiting at ingress layer\"\n    expires: 2026-06-01\n\n  - id: CVE-2024-21626    # runc container escape - patched in base image update\n    statement: \"Tracked in JIRA-SEC-1234, base image update scheduled\"\n    expires: 2026-03-15\n\nmisconfigurations:\n  - id: DS002             # User not set - required for init containers\n    paths:\n      - \"docker\u002Finit-container\u002FDockerfile\"\n    statement: \"Init container requires root for volume permission setup\"\n```\n\n### Step 5: Implement Database Caching and Offline Scanning\n\nCache the Trivy vulnerability database in CI\u002FCD to reduce scan times and enable air-gapped environments.\n\n```yaml\n# GitHub Actions with database caching\n- name: Cache Trivy DB\n  uses: actions\u002Fcache@v4\n  with:\n    path: \u002Ftmp\u002Ftrivy-db\n    key: trivy-db-${{ hashFiles('.github\u002Fworkflows\u002Fcontainer-security.yml') }}\n    restore-keys: trivy-db-\n\n- name: Run Trivy with cached DB\n  uses: aquasecurity\u002Ftrivy-action@0.28.0\n  with:\n    image-ref: 'app:${{ github.sha }}'\n    cache-dir: \u002Ftmp\u002Ftrivy-db\n    format: 'json'\n    output: 'trivy-results.json'\n    severity: 'CRITICAL,HIGH'\n    exit-code: '1'\n```\n\n```bash\n# Air-gapped: Download DB manually and mount\ntrivy image --download-db-only --cache-dir \u002Fpath\u002Fto\u002Fcache\n# Transfer cache to air-gapped system\ntrivy image --skip-db-update --cache-dir \u002Fpath\u002Fto\u002Fcache myimage:tag\n```\n\n### Step 6: Generate SBOM and Scan for License Compliance\n\nUse Trivy to generate Software Bill of Materials alongside vulnerability scanning.\n\n```bash\n# Generate SBOM in CycloneDX format\ntrivy image --format cyclonedx --output sbom.cdx.json app:latest\n\n# Generate SBOM in SPDX format\ntrivy image --format spdx-json --output sbom.spdx.json app:latest\n\n# Scan SBOM for vulnerabilities (decouple generation from scanning)\ntrivy sbom sbom.cdx.json --severity CRITICAL,HIGH\n\n# Scan with license detection\ntrivy image --scanners vuln,license --severity HIGH,CRITICAL app:latest\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| CVE | Common Vulnerabilities and Exposures — standardized identifiers for publicly known security vulnerabilities |\n| Vulnerability DB | Trivy's regularly updated database aggregating CVE data from NVD, vendor advisories, and language-specific sources |\n| Misconfiguration | Security-relevant configuration issue in Dockerfiles, Kubernetes manifests, or IaC templates |\n| SBOM | Software Bill of Materials — complete inventory of all components and dependencies in a container image |\n| Ignore Unfixed | Flag to skip CVEs without available patches, reducing noise from vulnerabilities with no actionable fix |\n| VEX | Vulnerability Exploitability eXchange — machine-readable statements about whether a vulnerability is exploitable in context |\n| Exit Code | Non-zero return code from Trivy when findings exceed the severity threshold, used to fail CI\u002FCD pipelines |\n\n## Tools & Systems\n\n- **Trivy**: Open-source vulnerability scanner by Aqua Security supporting images, filesystems, repos, and IaC\n- **trivy-action**: Official GitHub Action for running Trivy scans in GitHub Actions workflows\n- **Trivy Operator**: Kubernetes operator that continuously scans cluster workloads with Trivy\n- **Grype**: Alternative image scanner by Anchore for comparison and validation of scan results\n- **Harbor**: Container registry with built-in Trivy integration for automatic image scanning on push\n\n## Common Scenarios\n\n### Scenario: Multi-Stage Build with Separate Scan and Push\n\n**Context**: A team builds multi-stage Docker images and needs to scan the final production image before pushing to ECR, while also scanning the build stage for supply chain risks.\n\n**Approach**:\n1. Build the Docker image with `--target production` for the final stage\n2. Run Trivy with `--severity CRITICAL,HIGH --exit-code 1 --ignore-unfixed` to block on exploitable issues\n3. Generate an SBOM in CycloneDX format and store as a build artifact\n4. Upload SARIF results to GitHub Security tab for visibility\n5. Only push to ECR if the Trivy scan exits with code 0\n6. Tag the pushed image with the scan timestamp and Trivy DB version for audit traceability\n\n**Pitfalls**: Scanning only the final stage misses vulnerable packages that were present in build stages and may have influenced the build. Run `trivy fs` on the build context separately. Caching the Trivy DB too aggressively (weekly) means newly published CVEs take days to appear in scans.\n\n## Output Format\n\n```\nTrivy Container Scan Report\n=============================\nImage: app:a1b2c3d4\nBase Image: python:3.12-slim-bookworm\nScan Date: 2026-02-23\nDB Version: 2026-02-23T00:15:00Z\n\nVULNERABILITY SUMMARY:\n  Total: 47\n  Critical: 2\n  High: 5\n  Medium: 18\n  Low: 22\n  Unfixed: 8 (excluded from gate)\n\nCRITICAL FINDINGS:\n  CVE-2025-12345  libssl3    3.0.11-1  3.0.13-1  OpenSSL buffer overflow\n  CVE-2025-67890  curl       7.88.1-10 7.88.1-12 curl HSTS bypass\n\nHIGH FINDINGS:\n  CVE-2025-11111  zlib1g     1.2.13    1.2.13.1  zlib heap buffer overflow\n  CVE-2025-22222  python3.12 3.12.1    3.12.3    CPython path traversal\n  CVE-2025-33333  requests   2.31.0    2.32.0    requests SSRF in redirects\n\nMISCONFIGURATION:\n  DS002  [HIGH]   Dockerfile: USER instruction not set (running as root)\n  DS026  [MEDIUM] Dockerfile: No HEALTHCHECK defined\n\nQUALITY GATE: FAILED (2 Critical, 5 High findings)\n```\n","> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Scanning Containers with Trivy in CI\u002FCD\n\n## When to Use\n\n- When building Docker container images in CI\u002FCD and needing automated vulnerability scanning before registry push\n- When establishing quality gates that prevent images with critical or high CVEs from reaching production\n- When compliance requirements mandate vulnerability scanning of all container images before deployment\n- When scanning IaC files (Dockerfiles, Kubernetes manifests) alongside container image scanning\n- When needing a single tool to scan OS packages, language-specific dependencies, and misconfigurations\n\n**Do not use** for runtime container security monitoring (use Falco), for scanning running containers in production (use runtime agents), or when only scanning application source code without containerization (use SAST tools).\n\n## Prerequisites\n\n- Trivy CLI installed (v0.50+) or access to aquasecurity\u002Ftrivy-action GitHub Action\n- Docker daemon available in CI\u002FCD for building and scanning images\n- Container registry credentials for pulling base images and pushing scanned images\n- Trivy vulnerability database accessible (downloaded automatically or cached)\n\n## Workflow\n\n### Step 1: Configure Trivy Scanning in GitHub Actions\n\nSet up a GitHub Actions workflow that builds a Docker image and scans it with Trivy before pushing to a container registry.\n\n```yaml\n# .github\u002Fworkflows\u002Fcontainer-security.yml\nname: Container Security Scan\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n    paths:\n      - 'Dockerfile'\n      - 'docker-compose*.yml'\n      - 'src\u002F**'\n      - 'requirements*.txt'\n      - 'package*.json'\n\njobs:\n  build-and-scan:\n    runs-on: ubuntu-latest\n    permissions:\n      security-events: write\n      contents: read\n\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - name: Build Docker image\n        run: docker build -t app:${{ github.sha }} .\n\n      - name: Run Trivy vulnerability scanner\n        uses: aquasecurity\u002Ftrivy-action@0.28.0\n        with:\n          image-ref: 'app:${{ github.sha }}'\n          format: 'sarif'\n          output: 'trivy-results.sarif'\n          severity: 'CRITICAL,HIGH'\n          exit-code: '1'\n          ignore-unfixed: true\n\n      - name: Upload Trivy scan results\n        uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n        if: always()\n        with:\n          sarif_file: 'trivy-results.sarif'\n          category: 'trivy-container'\n\n      - name: Run Trivy misconfiguration scanner\n        uses: aquasecurity\u002Ftrivy-action@0.28.0\n        with:\n          scan-type: 'config'\n          scan-ref: '.'\n          format: 'table'\n          exit-code: '1'\n          severity: 'CRITICAL,HIGH'\n```\n\n### Step 2: Scan Dockerfiles for Misconfigurations\n\nTrivy detects common Dockerfile security issues such as running as root, using latest tags, and exposing unnecessary ports.\n\n```bash\n# Scan Dockerfile for misconfigurations\ntrivy config --severity HIGH,CRITICAL .\u002FDockerfile\n\n# Scan with custom policy directory\ntrivy config --policy .\u002Fsecurity-policies --severity MEDIUM,HIGH,CRITICAL .\n\n# Example secure Dockerfile practices Trivy checks for:\n# - USER instruction present (not running as root)\n# - HEALTHCHECK instruction defined\n# - Base image uses specific tag, not :latest\n# - No secrets in ENV or ARG instructions\n# - COPY preferred over ADD\n```\n\n### Step 3: Integrate with GitLab CI\u002FCD\n\n```yaml\n# .gitlab-ci.yml\nstages:\n  - build\n  - scan\n  - push\n\nvariables:\n  TRIVY_CACHE_DIR: .trivycache\u002F\n\nbuild:\n  stage: build\n  script:\n    - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .\n    - docker save $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -o image.tar\n  artifacts:\n    paths:\n      - image.tar\n\ntrivy-scan:\n  stage: scan\n  image:\n    name: aquasec\u002Ftrivy:latest\n    entrypoint: [\"\"]\n  cache:\n    paths:\n      - .trivycache\u002F\n  script:\n    - trivy image\n        --input image.tar\n        --exit-code 1\n        --severity CRITICAL,HIGH\n        --ignore-unfixed\n        --format json\n        --output trivy-report.json\n    - trivy image\n        --input image.tar\n        --severity CRITICAL,HIGH,MEDIUM\n        --format table\n  artifacts:\n    reports:\n      container_scanning: trivy-report.json\n    paths:\n      - trivy-report.json\n  allow_failure: false\n\npush:\n  stage: push\n  needs: [trivy-scan]\n  script:\n    - docker load -i image.tar\n    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA\n```\n\n### Step 4: Configure Trivy Ignore and Exception Handling\n\nManage false positives and accepted risks through Trivy's ignore file and VEX statements.\n\n```yaml\n# .trivyignore.yaml\nvulnerabilities:\n  - id: CVE-2023-44487    # HTTP\u002F2 rapid reset - mitigated at load balancer\n    statement: \"Mitigated by WAF rate limiting at ingress layer\"\n    expires: 2026-06-01\n\n  - id: CVE-2024-21626    # runc container escape - patched in base image update\n    statement: \"Tracked in JIRA-SEC-1234, base image update scheduled\"\n    expires: 2026-03-15\n\nmisconfigurations:\n  - id: DS002             # User not set - required for init containers\n    paths:\n      - \"docker\u002Finit-container\u002FDockerfile\"\n    statement: \"Init container requires root for volume permission setup\"\n```\n\n### Step 5: Implement Database Caching and Offline Scanning\n\nCache the Trivy vulnerability database in CI\u002FCD to reduce scan times and enable air-gapped environments.\n\n```yaml\n# GitHub Actions with database caching\n- name: Cache Trivy DB\n  uses: actions\u002Fcache@v4\n  with:\n    path: \u002Ftmp\u002Ftrivy-db\n    key: trivy-db-${{ hashFiles('.github\u002Fworkflows\u002Fcontainer-security.yml') }}\n    restore-keys: trivy-db-\n\n- name: Run Trivy with cached DB\n  uses: aquasecurity\u002Ftrivy-action@0.28.0\n  with:\n    image-ref: 'app:${{ github.sha }}'\n    cache-dir: \u002Ftmp\u002Ftrivy-db\n    format: 'json'\n    output: 'trivy-results.json'\n    severity: 'CRITICAL,HIGH'\n    exit-code: '1'\n```\n\n```bash\n# Air-gapped: Download DB manually and mount\ntrivy image --download-db-only --cache-dir \u002Fpath\u002Fto\u002Fcache\n# Transfer cache to air-gapped system\ntrivy image --skip-db-update --cache-dir \u002Fpath\u002Fto\u002Fcache myimage:tag\n```\n\n### Step 6: Generate SBOM and Scan for License Compliance\n\nUse Trivy to generate Software Bill of Materials alongside vulnerability scanning.\n\n```bash\n# Generate SBOM in CycloneDX format\ntrivy image --format cyclonedx --output sbom.cdx.json app:latest\n\n# Generate SBOM in SPDX format\ntrivy image --format spdx-json --output sbom.spdx.json app:latest\n\n# Scan SBOM for vulnerabilities (decouple generation from scanning)\ntrivy sbom sbom.cdx.json --severity CRITICAL,HIGH\n\n# Scan with license detection\ntrivy image --scanners vuln,license --severity HIGH,CRITICAL app:latest\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| CVE | Common Vulnerabilities and Exposures — standardized identifiers for publicly known security vulnerabilities |\n| Vulnerability DB | Trivy's regularly updated database aggregating CVE data from NVD, vendor advisories, and language-specific sources |\n| Misconfiguration | Security-relevant configuration issue in Dockerfiles, Kubernetes manifests, or IaC templates |\n| SBOM | Software Bill of Materials — complete inventory of all components and dependencies in a container image |\n| Ignore Unfixed | Flag to skip CVEs without available patches, reducing noise from vulnerabilities with no actionable fix |\n| VEX | Vulnerability Exploitability eXchange — machine-readable statements about whether a vulnerability is exploitable in context |\n| Exit Code | Non-zero return code from Trivy when findings exceed the severity threshold, used to fail CI\u002FCD pipelines |\n\n## Tools & Systems\n\n- **Trivy**: Open-source vulnerability scanner by Aqua Security supporting images, filesystems, repos, and IaC\n- **trivy-action**: Official GitHub Action for running Trivy scans in GitHub Actions workflows\n- **Trivy Operator**: Kubernetes operator that continuously scans cluster workloads with Trivy\n- **Grype**: Alternative image scanner by Anchore for comparison and validation of scan results\n- **Harbor**: Container registry with built-in Trivy integration for automatic image scanning on push\n\n## Common Scenarios\n\n### Scenario: Multi-Stage Build with Separate Scan and Push\n\n**Context**: A team builds multi-stage Docker images and needs to scan the final production image before pushing to ECR, while also scanning the build stage for supply chain risks.\n\n**Approach**:\n1. Build the Docker image with `--target production` for the final stage\n2. Run Trivy with `--severity CRITICAL,HIGH --exit-code 1 --ignore-unfixed` to block on exploitable issues\n3. Generate an SBOM in CycloneDX format and store as a build artifact\n4. Upload SARIF results to GitHub Security tab for visibility\n5. Only push to ECR if the Trivy scan exits with code 0\n6. Tag the pushed image with the scan timestamp and Trivy DB version for audit traceability\n\n**Pitfalls**: Scanning only the final stage misses vulnerable packages that were present in build stages and may have influenced the build. Run `trivy fs` on the build context separately. Caching the Trivy DB too aggressively (weekly) means newly published CVEs take days to appear in scans.\n\n## Output Format\n\n```\nTrivy Container Scan Report\n=============================\nImage: app:a1b2c3d4\nBase Image: python:3.12-slim-bookworm\nScan Date: 2026-02-23\nDB Version: 2026-02-23T00:15:00Z\n\nVULNERABILITY SUMMARY:\n  Total: 47\n  Critical: 2\n  High: 5\n  Medium: 18\n  Low: 22\n  Unfixed: 8 (excluded from gate)\n\nCRITICAL FINDINGS:\n  CVE-2025-12345  libssl3    3.0.11-1  3.0.13-1  OpenSSL buffer overflow\n  CVE-2025-67890  curl       7.88.1-10 7.88.1-12 curl HSTS bypass\n\nHIGH FINDINGS:\n  CVE-2025-11111  zlib1g     1.2.13    1.2.13.1  zlib heap buffer overflow\n  CVE-2025-22222  python3.12 3.12.1    3.12.3    CPython path traversal\n  CVE-2025-33333  requests   2.31.0    2.32.0    requests SSRF in redirects\n\nMISCONFIGURATION:\n  DS002  [HIGH]   Dockerfile: USER instruction not set (running as root)\n  DS026  [MEDIUM] Dockerfile: No HEALTHCHECK defined\n\nQUALITY GATE: FAILED (2 Critical, 5 High findings)\n```\n",{"hide":55,"name":5,"source":56,"license":15,"description":7,"authorized_lab":51,"origin_frontmatter":57},true,"mukul975\u002FAnthropic-Cybersecurity-Skills","name: scanning-containers-with-trivy-in-cicd | description: 'This skill covers integrating Aqua Security''s Trivy scanner into CI\u002FCD |   pipelines for comprehensive container image vulnerability detection. It addresses |   scanning Docker images for OS package and application dependency CVEs, detecting |   misconfigurations in Dockerfiles, scanning filesystem and git repositories, and |   establishing severity-based quality gates that block deployment of vulnerable images. |  |   ' | domain: cyb","main","4c6d8d65f3d6096e2fc25b0845e481dda73c2794",".claude\u002Fskills\u002Fcyber-scanning-containers-with-trivy-in-cicd",0,"https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions","Building deterministic AI governance and continuity systems. Workflow architect + visual storyteller","2026-11-11 16:42:59",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":55},[68,71,74],{"tool":69,"command":70},"npx","npx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-scanning-containers-with-trivy-in-cicd",{"tool":72,"command":73},"bunx","bunx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-scanning-containers-with-trivy-in-cicd",{"tool":75,"command":76},"pnpm","pnpm dlx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-scanning-containers-with-trivy-in-cicd","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-scanning-containers-with-trivy-in-cicd\u002FSKILL.md",[],[80,103,127,155,184,203],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":50},"01M71CG1AME5WC0A79AE65WT0X","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","MIT","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[88,89,33,90,91,92,93,94,95,96,97,98,99,100,101,102],"zoom out","zoom","harness","how","section","re","true","understand","use","perspective","when","you","code","it","context",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":50},"01M71CFY9ATD0BAXV6B14HFG7C","yuri-shura","6-perspective adversarial review for high-stakes turns (architecture decisions, refactor planning, deployment review) — fans out architect, adversary (7-vector attack), maintainer, ops, product, and security perspectives in parallel, then consolidates. Use when user says 'review this decision', '\u002Fshura', 'adversarial review', 'what could go wrong', 'architecture review', or 'deployment review'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-shura\u002FSKILL.md",[],[110,111,90,112,113,114,115,116,117,118,119,96,120,98,121,122,123,124,125,126],"yuri shura","parallel","architecture review","planning","for","deployment","vector","strategic review","decision","strategic","ops","workflow","decisions","architecture","review","perspectives","adversarial",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":136,"publishedAt":50},"01M71CFTTYW1HA2MNX38EV1GJ5","yuri-sales-intelligence","Unified sales and outreach skill generating cold outreach openers, social selling sequences, objection rebuttals, and ad creative for any paid platform — multi-persona aware, adapting tone and offer frame to buyer type. Use when user says 'write a cold email', 'outreach sequence', 'objection handling', 'ad copy', or 'sales pitch'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-sales-intelligence\u002FSKILL.md",[133],{"categoryNo":134,"categoryName":135,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000005","邮件与沟通",[137,138,139,140,141,142,143,144,145,98,146,147,148,149,150,151,152,114,153,154],"intelligence","sales intelligence","yuri sales intelligence","sales","cold","paid","social","persona","pitch","cold email","ad creative","write","sequences","sequence","platform","email","cold outreach","frame",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":169,"publishedAt":50},"01M71CFQMBFTFADJNGP0Z2WCYK","yuri-code-intelligence","Unified code quality intelligence layer that diagnoses code smells (Long Method, Feature Envy, design pattern issues), prescribes targeted Fowler refactoring techniques, and reviews code for security, performance, and clarity. Use when user says 'review this code', 'refactor this', 'what's wrong with this method', 'code smells', or 'clean this up'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-code-intelligence\u002FSKILL.md",[161,164],{"categoryNo":162,"categoryName":163,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":165,"categoryName":166,"taxonomyType":167,"taxonomyTypeDesc":168},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[170,100,171,137,90,172,173,174,114,175,176,177,178,179,180,181,182,183,96,98],"yuri code intelligence","code intelligence","reviews","code quality","feature","performance","code review","long","up","issues","clean","techniques","improve","design",{"skillNo":185,"name":186,"nameZh":6,"description":187,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":188,"categories":189,"keywords":190,"publishedAt":50},"01M71CFP32RT6GD3GKNHCJP8VP","yuri-adw","Invoke when user asks to run the ADW loop \u002F agentic engineering loop \u002F software factory workflow.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-adw\u002FSKILL.md",[],[191,192,193,194,195,196,197,198,199,98,200,121,201,202],"yuri adw","run","engineering loop","software factory","software","agentic engineering","factory","loop","invoke","engineering","agentic","user",{"skillNo":204,"name":205,"nameZh":6,"description":206,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":84,"licenseFileUrl":6,"sourceHtmlUrl":207,"categories":208,"keywords":219,"publishedAt":50},"01M71CFK4VPEKY6A73237P7RSN","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[209,212,215,216],{"categoryNo":210,"categoryName":211,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":213,"categoryName":214,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":217,"categoryName":218,"taxonomyType":167,"taxonomyTypeDesc":168},"01JBSEEDCAT000000000000036","内容创作者",[220,221,222,98,121,223,90,224,115,96,225],"writing","writing skills","new","work","editing","Existing"]