Veracode Scanner Reference
Veracode is a popular tool for scanning code repos 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.
Prerequisites
- 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<+secrets.getValue("<
my_secret
>")>
. - The Veracode - Automated Data Load and Veracode - Activate Scenario blog posts include useful information about how to ingest Veracode scan results into Harness.
Required Settings
product_name
=veracode
scan_type
=repository
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 Orchestrated 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.
product_config_name
=default
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.product_auth_type
apiKey
— Recommended.
Go to the Veracode docs and search for Generate Veracode API Credentials.usernamePassword
— Not recommended.
product_access_id
- For
usernamePassword
authentication, this is your username. - For
apiKey
authorization, this is your API key.
- For
product_access_token
- For
usernamePassword
authentication, this is your password. - For
apiKey
authorization, this is your API Secret key.
- For
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 specify1973759
.https://analysiscenter.veracode.com/auth/index.jsp#HomeAppProfile:88881:1973759
product_project_name
— The Veracode project with the scan results you want to ingest.
The Veracode - Automated Data Load blog post describes how you can find your application ID's and project names.
Ingestion settings
Ingestion scan settings
The following settings are required for Security steps where the policy_type
is ingestionOnly
.
target name
The Identifier that you want to assign to the target you’re scanning in the pipeline. Use a unique, descriptive name such as codebaseAlpha or jsmith/myalphaservice.variant
An identifier for a specific target to scan, such as the branch name or image tag. This identifier is used to differentiate or group results for a target. Harness maintains a historical trend for each variant.ingestion_file
The results data file to use when running an Ingestion scan. You should specify the full path to the data file in your workspace, such as/shared/customer_artifacts/my_scan_results.json
.
The following steps outline the general workflow for ingesting scan data into your pipeline:
Specify a shared folder for your scan results, such as
/shared/customer_artifacts
. You can do this in the Overview tab of the Security stage where you're ingesting your data.Create a Run step that copies your scan results to the shared folder. You can run your scan externally, before you run the build, or set up the Run step to run the scan and then copy the results.
Add a Security step after the Run step and add the
target name
,variant
, andingestion_file
settings as described above.
For a complete workflow description and example, go to Ingest Scan Results into an STO Pipeline.
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:
CRITICAL
HIGH
MEDIUM
LOW
INFO
NONE
— Do not fail on severity
The YAML definition looks like this: fail_on_severity : critical # | high | medium | low | info | none