Veracode is a popular tool for scanning code repositories for security issues and vulnerabilities. Veracode performs dynamic (automated penetration test) and static (automated code review) code analysis and finds security vulnerabilities that include malicious code as well as the absence of functionality that can lead to security breaches.
Important notes for running Veracode scans in STO
- Before you can ingest scan results, you must perform all the Veracode prerequisites for the repo that you're scanning. If you're scanning a Java repo, for example, the Veracode documentation outlines the specific packaging and compilation requirements for scanning your Java applications.
For specific requirements, got to the Veracode docs and search for Veracode Packaging Requirements.
- You also need access credentials so that STO can communicate with your Veracode instance. Harness recommends using API keys, not usernames and passwords, for your Veracode integrations
For instructions, go to the Veracode docs and search for Generate Veracode API Credentials.
Harness recommends you create text secrets for your authentication credentials — password, API key, API secret key, etc. — and access your secrets using
- The Veracode - Automated Data Load and Veracode - Activate Scenario blog posts include useful information about how to ingest Veracode scan results into Harness.
The following use cases require a Docker-in-Docker background step in your pipeline:
- Container image scans on Kubernetes and Docker build infrastructures
- Required for Orchestration and Dataload scan modes
- Security steps (not step palettes) on Kubernetes and Docker build infrastructures
- Required for all target types and Orchestration/DataLoad modes
The following use cases do not require Docker-in-Docker:
- Harness Cloud AMD64 build infrastructures
- SAST/DAST/configuration scans that use scanner templates (not Security steps)
- Ingestion scans where the data file has already been generated
Set up a Docker-in-Docker background step
Go to the stage where you want to run the scan.
In Overview, add the shared path
In Execution, do the following:
Click Add Step and then choose Background.
Configure the Background step as follows:
Dependency Name =
Container Registry = The Docker connector to download the DinD image. If you don't have one defined, go to Docker connector settings reference.
Under Entry Point, add the following:
In most cases, using
dockerdis a faster and more secure way to set up the background step. For more information, go to the TLS section in the Docker quick reference.
If the DinD service doesn't start with
dockerd, clear the Entry Point field and then run the pipeline again. This starts the service with the default entry point.
- Under Optional Configuration, select the Privileged checkbox.
- Visual setup
- YAML setup
Add a Background step to your pipeline and set it up as follows:
Root access requirements
You need to run the scan step with root access if either of the following apply:
You need to run a Docker-in-Docker background service.
You need to add trusted certificates to your scan images at runtime.
You can set up your STO scan images and pipelines to run scans as non-root and establish trust for your own proxies using self-signed 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:
Required Settings for Veracode scans in STO
To set up a Veracode scan, add a Security step to your pipeline and add the following settings:
policy_type— STO supports the following scan policy types for Veracode:
orchestratedScan— A Security step in the pipeline runs the scan and ingests the results. This is the easiest to set up and supports scans with default or predefined settings. See Run an Orchestration Scan in an STO Pipeline.
ingestionOnly— Run the scan in a Run step, or outside the pipeline, and then ingest the results. This is useful for advanced workflows that address specific security needs. See Ingest scan results into an STO pipeline.
dataLoad— A Security step downloads and ingests results from an external scanner.
repository_project— The name of the repo that gets scanned as shown in the Veracode UI. You use the Codebase Config object in the Harness pipeline to determine the URL of the repo to scan.
In most cases, this should match the repo name used in your Git provider.
repository_branch— The branch that gets reported in STO for the ingested results. You can specify a hardcoded string or use the runtime variable
<+codebase.branch>. This sets the branch based on the user input or trigger payload at runtime.
In most cases, this field should match the name of Git branch that is getting scanned.
fail_on_severity- See Fail on Severity.
Go to the Veracode docs and search for Generate Veracode API Credentials.
usernamePassword— Not recommended.
usernamePasswordauthentication, this is your username.
apiKeyauthorization, this is your API key.
usernamePasswordauthentication, this is your password.
apiKeyauthorization, this is your API Secret key.
product_app_id— The Veracode GUID, separated with hyphens, for the target application.
To determine the App ID, go to the home page for the Veracode app with the results you want to scan. The App ID is the string immediately after the port number in the URL. Thus, for the following app, you would specify
The Veracode - Automated Data Load blog post describes in more detail how you can find your application IDs and project names.
ingestion_file= The path to your scan results when running an Ingestion scan, for example
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:
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:
NONE— Do not fail on severity
The YAML definition looks like this:
fail_on_severity : critical # | high | medium | low | info | none
Veracode pipeline example (dataLoad)
The following pipeline example illustrates a dataLoad workflow to ingest data from Veracode. It consists of two steps:
A Background step that runs a Docker-in-Docker service (required if you're using a Security step to configure your integration).
A Security step that specifies the information needed to ingest the scan results from the Veracode server.