Skip to main content

Coverity scanner reference for STO

You can ingest scan results from Coverity Scan, a Synopsis service that scans open-source coding projects for developers that have registered their products with Coverity Scan.

Important notes for running Coverity scans in STO

Root access requirements

You need to run the scan step with root access if either of the following apply:


You can set up your STO scan images and pipelines to run scans as non-root and establish trust for your own proxies using custom certificates. For more information, go to Configure STO to Download Images from a Private Registry.

For more information

The following topics contain useful information for setting up scanner integrations in STO:

Coverity step configuration

The following steps outline the recommended workflow:

  1. Add a CI Build or an STO Security stage to your pipeline.

  2. Add a Run step to upload your Coverity scan results to the pipeline workspace.

  3. Add a Coverity step after the Run step and then configure it as described below.


Scan Mode

Scan Configuration

The predefined configuration to use for the scan. All scan steps have at least one configuration.



The target type to scan for vulnerabilities.

  • Repository Scan a codebase repo.

    In most cases, you specify the codebase using a code repo connector that connects to the Git account or repository where your code is stored. For information, go to Configure codebase.

Target and variant detection

When auto-detect is enabled for code repositories, the step detects these values using git:

  • To detect the target, the step runs git config --get remote.origin.url.
  • To detect the variant, the step runs git rev-parse --abbrev-ref HEAD. The default assumption is that the HEAD branch is the one you want to scan.

Note the following:

  • Auto-detection is not available when the Scan Mode is Ingestion.
  • Auto-detect is the default selection for new pipelines. Manual is the default for old pipelines, but you might find that neither radio button is selected in the UI.


The identifier for the target, such as codebaseAlpha or jsmith/myalphaservice. Descriptive target names make it much easier to navigate your scan data in the STO UI.

It is good practice to specify a baseline for every target.


The identifier for the specific variant to scan. This is usually the branch name, image tag, or product version. Harness maintains a historical trend for each variant.

Ingestion File

The path to your scan results when running an Ingestion scan, for example /shared/scan_results/myscan.latest.sarif.

  • The data file must be in a supported format for the scanner.

  • The data file must be accessible to the scan step. It's good practice to save your results files to a shared path in your stage. In the visual editor, go to the stage where you're running the scan. Then go to Overview > Shared Paths. You can also add the path to the YAML stage definition like this:

        - stage:
    - /shared/scan_results

Log Level

The minimum severity of the messages you want to include in your scan logs. You can specify one of the following:

  • INFO

Fail on Severity

Every Security step has a Fail on Severity setting. If the scan finds any vulnerability with the specified severity level or higher, the pipeline fails automatically. You can specify one of the following:

  • HIGH
  • LOW
  • INFO
  • NONE — Do not fail on severity

The YAML definition looks like this: fail_on_severity : critical # | high | medium | low | info | none

Additional Configuration

In the Additional Configuration settings, you can use the following options:

Advanced settings

In the Advanced settings, you can use the following options:

YAML pipeline example

The following pipeline example illustrates an ingestion workflow. It consists of two steps:

  • A Run step that generates a simple Coverity data file.
  • A Coverity step that ingests the XML data.

name: coverity-example
identifier: coverityexample
projectIdentifier: STO
orgIdentifier: default
tags: {}
- stage:
name: coverity-ingest
identifier: coverityingest
description: ""
type: SecurityTests
cloneCodebase: false
os: Linux
arch: Amd64
type: Cloud
spec: {}
- step:
type: Run
name: generate_coverity_results_file
identifier: Run_1
shell: Sh
command: |-
cat <<EOF >> coverity-results.xml
<?xml version='1.0' encoding='UTF-8'?><!--Document generated on Wed Jun 28 15:27:21 GMT 2023-->
<cov:exportedProjectDefects xmlns:cov="">
<cov:mergedDefect cid="153368" type="Resource leak" impact="High" status="New" firstDetected="10/24/15" owner="Unassigned" classification="Unclassified" severity="High" action="Undecided" displayComponent="Other" category="Resource leaks" file="/webgoat-container/src/main/java/org/owasp/webgoat/session/" function="UserDatabase.getUsers" checker="RESOURCE_LEAK" occurrenceCount="1" cwe="404" externalReference="" issueKind="Various" Language="Java" LineNumber="132" Score=""/>
<cov:mergedDefect cid="59180" type="Explicit null dereferenced" impact="Medium" status="New" firstDetected="09/20/14" owner="Unassigned" classification="Unclassified" severity="Medium" action="Undecided" displayComponent="Other" category="Null pointer dereferences" file="/webgoat-container/src/main/java/org/owasp/webgoat/session/" function="WebgoatProperties.main" checker="FORWARD_NULL" occurrenceCount="1" cwe="476" externalReference="" issueKind="Quality" Language="Java" LineNumber="143" Score=""/>
- step:
type: Coverity
name: ingest_coverity_data
identifier: ingest_coverity_data
mode: ingestion
config: default
type: repository
name: coverity-test
variant: test
level: info
file: coverity-results.xml