configure-container-scan
Add container image scanning steps to existing Harness pipelines using Harness STO scanners. Supports Harness SCA (default), Aqua Trivy, Grype, Snyk, Prisma Cloud, Anchore, Black Duck, and Wiz. Supports Docker Hub, ECR, GCR, and other Third-Party registries as well as Harness and Local registries. Can insert the scan step into an existing CI stage or create a dedicated SecurityTests stage. Use when asked to add container scanning, configure image scanning, set up SCA for Docker images, scan container images for vulnerabilities, or add container security checks to a pipeline. Trigger phrases: add container scan, scan docker image, configure image scanning, set up SCA, add vulnerability scan for container, scan container before deploy, add Trivy scan, add Grype scan, add Snyk container scan.
harness · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add harness/harness-skills --skill configure-container-scan技能说明
name: configure-container-scan description: >- Add container image scanning steps to existing Harness pipelines using Harness STO scanners. Supports Harness SCA (default), Aqua Trivy, Grype, Snyk, Prisma Cloud, Anchore, Black Duck, and Wiz. Supports Docker Hub, ECR, GCR, and other Third-Party registries as well as Harness and Local registries. Can insert the scan step into an existing CI stage or create a dedicated SecurityTests stage. Use when asked to add container scanning, configure image scanning, set up SCA for Docker images, scan container images for vulnerabilities, or add container security checks to a pipeline. Trigger phrases: add container scan, scan docker image, configure image scanning, set up SCA, add vulnerability scan for container, scan container before deploy, add Trivy scan, add Grype scan, add Snyk container scan. metadata: author: Harness version: 1.0.0 mcp-server: harness-mcp-v2 license: Apache-2.0 compatibility: Requires Harness MCP v2 server (harness-mcp-v2)
Configure Container Scan
Add a container image scanning step to an existing Harness pipeline using the native HarnessSCA STO scanner.
Instructions
Step 1: Establish Scope and Pipeline Context
Ask for org, project, and pipeline identifier if not already known. This skill only works with existing pipelines.
Call MCP tool: harness_get
Parameters:
resource_type: "pipeline"
resource_id: "<pipeline_identifier>"
org_id: "<organization>"
project_id: "<project>"
Step 2: Analyze Pipeline Structure
Parse the pipeline YAML to identify:
- All stages and their types (
CI,SecurityTests,Deployment,Approval) - Whether a
SecurityTestsstage already exists - Existing steps in each stage
Present the structure to the user:
Pipeline: <name>
Stage 1: <stage_name> (type: <stage_type>)
- Step 1: <step_name> (type: <step_type>)
...
Ask the user where they want the scanner step added:
Present the available insertion points:
- Any existing
CIstage (scanner step is added directly into that stage'sexecution.steps) - Any existing
SecurityTestsstage (scanner step is added into that stage'sexecution.steps) - A new
SecurityTestsstage (appended to the pipeline if no suitable stage exists or user prefers isolation)
Recommendation guidance:
- Adding into an existing
CIstage — simpler, no extra infrastructure needed, scan runs as part of the build - Adding a new
SecurityTestsstage — isolated, runs independently, useful when scanning images built elsewhere or from a registry
If the user doesn't specify, default to adding inside the existing CI stage if one exists.
Step 3: Recommend Scanner Type
Present the available container image scanners supported in Harness STO:
Available Container Scanners:
- Harness SCA (default — native Harness container scanner, zero config)
- Aqua Trivy (open-source, broad OS and library coverage)
- Grype (open-source by Anchore, fast and accurate)
- Snyk (commercial, developer-friendly with fix advice)
- Prisma Cloud (commercial, enterprise runtime + image scanning)
- Anchore Enterprise (commercial, policy-based enforcement)
- Black Duck (commercial, license compliance + vulnerabilities)
- Wiz (commercial, cloud-native security)
Default recommendation: Use Harness SCA — native, no additional credentials required, and integrates directly with Harness STO results.
Ask the user which scanner they prefer. If they don't specify, use Harness SCA as the default.
Step type mapping and scanner product auth requirements:
| Scanner | type field | Product auth needed? | Auth fields |
|---|---|---|---|
| Harness SCA | HarnessSCA | No | — |
| Aqua Trivy | AquaTrivy | No | — |
| Grype | Grype | No | — |
| Snyk | Snyk | Yes | access_token (Snyk API token) |
| Prisma Cloud | PrismaCloud | Yes | access_id (Access Key), access_token (Secret Key) |
| Anchore Enterprise | AnchoreEnterprise | Yes | access_id (username), access_token (password/API key) |
| Black Duck | BlackDuck | Yes | access_token (Hub API token) |
| Wiz | Wiz | Yes | access_id (Client ID), access_token (Client Secret) |
If the user picks a commercial scanner (Snyk, Prisma Cloud, Anchore Enterprise, Black Duck, Wiz):
- Inform the user that this scanner requires product-level authentication credentials
- Ask for the required secret references from the table above — these must already exist as Harness secrets
- Format them as
<+secrets.getValue("project.<secret_identifier>")> - These go into the
authblock of the step spec — separate from the registry image credentials
Example prompt to user:
"Snyk requires an API token. Please provide the Harness secret identifier for your Snyk API token (e.g.,
snyk_api_token). I'll reference it as<+secrets.getValue("project.snyk_api_token")>."
If the secret doesn't exist yet, suggest creating it first via /create-secret before proceeding.
Step 4: Collect Container Image Details (skip for Prisma Cloud / Wiz — they pull from registry via connector)
Ask the user which registry type their image is in, then collect the fields for that type:
Option A — Harness Registry
The image is stored in the Harness internal container registry.
| Field | Required | Description |
|---|---|---|
| Registry | Yes | Harness registry connector ref (e.g., account.account-level-test) |
| Image Path | Yes | e.g., harness/todolist-sample — maps to image_path in YAML |
YAML:
image:
type: harness
registry: <harness_registry_connector_ref>
image_path: <image_path>
Option B — Third-Party Registry (Docker Hub, ECR, GCR, ACR, JFrog, etc.)
| Field | Required | Description |
|---|---|---|
| Type | Yes | Registry protocol — almost always docker_v2 |
| Domain | No | Defa |