Veracode step configuration
You can scan your code repositories and ingest results from Veracode.
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, go 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")>
.
Workflow descriptions
Orchestration/extraction workflows
This workflow applies to scanner integrations that support orchestratedScan
or dataLoad
scan modes.
-
Add a Build or Security stage to your pipeline.
-
If you're scanning a code repository, set up your codebase.
-
Add a Custom Scan step.
-
Review the Important notes for Custom Scan steps for additional requirements and relevant information.
If you're setting up a scan on a Kubernetes or Docker build infrastructure, you need to add a Docker-in-Docker background step to the stage.
-
Add the relevant
key:value
pairs to Settings.
Ingestion workflows
This workflow applies to scanner integrations that support Ingestion mode.
-
Add a Build or Security stage to your pipeline.
-
Add a Run step and set it up to save your scan results to a shared folder.
For more information, go to Run an ingestion scan in an STO Pipeline.
-
Add a Custom Scan step.
-
Review the Important notes for Custom Scan steps for additional requirements and relevant information.
-
Add the relevant
key:value
pairs to Settings.
Custom Scan step settings for Veracode scans
The recommended workflow is to add a Custom Scan step to a Security or Build stage and then configure it as described below.
Scanner settings
These settings are required for most scanners. For more information, go to the reference for the scanner integration you're setting up.
Product name
The scanner name. This is required for all Custom Scan steps.
Key
product_name
Value
veracode
Scan type
The target type to scan.
Key
scan_type
Value
repository
Policy type
The scan mode to use.
Key
policy_type
Value
orchestratedScan
ingestionOnly
dataLoad
Product config name
Key
product_config_name
Value
default
Repository
These settings apply to Custom Scan steps when both of these conditions are true:
- The
policy_type
isorchestratedScan
ordataLoad
. - The
scan_type
isrepository
.
Repository project
Key
repository_project
Value
The name of the repo to scan. To specify the repo URL, edit the Codebase Config object in the Harness pipeline.
In most cases, this should match the repo name used in your Git provider.
Repository branch
Key
repository_branch
Value
The branch that gets reported in STO for the ingested results. In most cases, this field should match the name of the Git branch that is getting scanned.
You can specify a hardcoded string or use a variable such as <+codebase.branch>
to specify the branch at runtime. For more information, go to CI codebase variables reference.
Product access
These settings are available to access your Veracode instance when policy_type
is orchestratedScan
or dataLoad
.
You should create Harness text secrets for your encrypted passwords/tokens and reference them using the format <+secrets.getValue("my-access-token")>
.
Product authorization type
Key
product_auth_type
Value
apiKey
Go to the Veracode docs and search for Generate Veracode API Credentials.
usernamePassword
is not recommended.
Product access Id
Key
product_access_id
Value
Your API key.
Product access token
Key
product_access_token
Value
Your API Secret key.
Product application Id
Key
product_app_id
Value
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 1973759
.
https://analysiscenter.veracode.com/auth/index.jsp#HomeAppProfile:88881:1973759
Ingestion file
This setting applies to Custom Scan steps when the policy_type
is ingestionOnly
.
Key
ingestion_file
Value
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 scan results 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:
spec:
sharedPaths:
- /shared/scan_results
Fail on Severity
If the scan finds any vulnerability with the specified severity level or higher, the pipeline fails automatically. NONE
means do not fail on severity.
For more information, go to:
- STO workflows for blocking builds and PRs.
- Exemptions to override Fail on Severity thresholds for specific issues in STO
Key
fail_on_severity
Value
CRITICAL
MEDIUM
LOW
INFO
NONE
View Veracode policy failures
Veracode policy failures will appear in scan results as Info
severity issues, with the issue type set to EXTERNAL_POLICY
. Successfully passed policies will not be included in the scan results. Additionally, you can apply OPA policies in Harness STO to enforce or manage the policy failures.
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 Custom Scan step to configure your integration).
-
A Custom Ingest step that specifies the information needed to ingest the scan results from the Veracode server.
pipeline:
allowStageExecutions: false
projectIdentifier: YOUR_PROJECT_ID
orgIdentifier: YOUR_HARNESS_ORG_ID
tags: {}
stages:
- stage:
name: scan1
identifier: build
type: SecurityTests
spec:
cloneCodebase: false
infrastructure:
type: KubernetesDirect
spec:
connectorRef: YOUR_KUBERNETES_CLUSTER_CONNECTOR_ID
namespace: YOUR_NAMESPACE
automountServiceAccountToken: true
nodeSelector: {}
os: Linux
sharedPaths:
- /var/run
execution:
steps:
- step:
type: Background
name: dind-bg-step
identifier: dindbgstep
spec:
connectorRef: YOUR_CONTAINER_IMAGE_REGISTRY_CONNECTOR_ID
image: docker:dind
shell: Sh
entrypoint:
- dockerd
- step:
type: Security
name: Veracode
identifier: bandit
spec:
privileged: true
settings:
policy_type: dataLoad
scan_type: repository
repository_project: YOUR_VERACODE_REPOSITORY_PROJECT
repository_branch: YOUR_VERACODE_REPOSITORY_BRANCH
product_name: veracode
product_config_name: veracode-agent
product_access_token: <+secrets.getValue("YOUR_VERACODE_TOKEN_SECRET")>
product_access_id: <+secrets.getValue("YOUR_VERACODE_ID")>
product_app_id: YOUR_VERACODE_PRODUCT_APP_ID
product_auth_type: apiKey
imagePullPolicy: Always
variables: []
identifier: Veracodedataloadexample
name: Veracode-dataload-example