Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
SecurityAqua TrivyGrypeQuarantine

Configure security scanning

Enable a built-in container scanner on a Docker or Helm registry, attach a policy set to quarantine violations, and validate Cargo metadata.

Harness Artifacts supports automatic security scanning on push for container registries and metadata validation for select package registries. Scanning happens at ingest time; every artifact is evaluated as it enters the registry.

What you will learn from this topic

  • Enable a container scanner (Aqua Trivy or Grype) on a Docker or Helm registry

  • Attach a policy set to quarantine artifacts that fail a security check

  • Enable metadata validation on a Cargo registry

Before you begin

Enable container scanning (Docker and Helm)

Container scanning is available for Docker and Helm OCI registries. When enabled, Harness creates a scan pipeline that runs automatically every time an artifact is pushed.

  1. In the left navigation, select Registries.

  2. Click the Docker or Helm registry you want to configure.

  3. Select the Configuration tab.

  4. In the Security section, click the edit icon to open the Security drawer.

  5. Select the scanner you want to use:

    Scanner
    Best for

    Aqua Trivy

    Broad OS and library vulnerability coverage

    Grype

    Fast, SBOM-aware scanning

  6. Save the setting.

Scanning begins on the next push to the registry. Scan results appear on each artifact's version details page in the Vulnerabilities tab.

Attach a policy set

A policy set defines rules that evaluate scan results and take action, for example, quarantine any image with a Critical severity finding.

Policy sets attached to a registry must be of type Security Tests. Go to Dependency Firewall overview to understand how policy sets are configured.

To attach a policy set to a registry:

  1. In the registry's Configuration tab, open the Security edit drawer.

  2. Under Policy sets, click Add policy set and select the policy set from the list.

  3. Save the setting.

You can attach multiple policy sets for layered enforcement.

What happens when an artifact fails a policy

When an artifact violates a policy with an Error and exit action, Harness quarantines it automatically. Quarantined artifacts cannot be pulled or downloaded until the quarantine is removed. Go to Quarantine to review and release quarantined artifacts.

Enable metadata validation (Cargo)

For Cargo registries, Harness can validate crate metadata on publish, checking that required fields are present and correctly formatted.

  1. Open the Cargo registry.

  2. Select the Configuration tab.

  3. In the Security section, open the edit drawer.

  4. Enable Metadata validation.

  5. Save the setting.

When enabled, a publish request that contains invalid crate metadata is rejected with an error message identifying the missing or malformed field.

Troubleshooting

The Security section does not appear in Configuration

Container scanning configuration is available only on Docker and Helm OCI registries. Metadata validation is available only on Cargo registries. For all other formats, the Security section is not shown.

Scanner selection is missing, only one scanner is shown

Both Aqua Trivy and Grype are available in production. If only one scanner appears, confirm your account is on a production environment and that the Supply Chain Security module is fully provisioned. Contact Harness Support if both scanners do not appear.

Scan results are not appearing on newly pushed artifacts

Scan pipelines run asynchronously. Results typically appear within a few minutes of the push. If no results appear after 10 minutes, check whether the Supply Chain Security module is enabled and that the scan pipeline was created successfully in the registry configuration.

Next steps

Last updated

Was this helpful?