Download the Scan local engine application
Contrast provides a reusable script that lets you download the the latest version of Scan local engine application. The downloaded application is a Java JAR file.
Before you begin
The script provided in this topic is designed to run in a terminal window as a bash script.
The script uses these environment variables:
CONTRAST__API__ORGANIZATION
CONTRAST__API__URL
CONTRAST__API__USER_NAME
CONTRAST__API__API_KEY
CONTRAST__API__SERVICE_KEY
To find these keys in the Contrast web interface, select usermenu > User settings > Profile and locate the keys under Your keys.
Steps
Create a script named
download-release.sh
that includes the following code:#!/bin/bash RELEASE=latest if [ -n "$1" ] then RELEASE=$1 fi OUTPUT_FILE=sast-local-scanner-$RELEASE.zip AUTH_TOKEN=$(echo -n $CONTRAST__API__USER_NAME:$CONTRAST__API__SERVICE_KEY | base64) curl \ -H "api-key: $CONTRAST__API__API_KEY" \ -H "authorization: $AUTH_TOKEN" \ -L \ -o $OUTPUT_FILE \ $CONTRAST__API__URL/organizations/$CONTRAST__API__ORGANIZATION/release-artifacts/local-scanner/$RELEASE?download=true
In a terminal window, set the environment variables with commands similar to the following:
export CONTRAST__API__ORGANIZATION=<Contrast_organization_ID> export CONTRAST__API__URL=https://<your_teamserver_environment>/Contrast/api/sast export CONTRAST__API__USER_NAME=<Contrast_user_name> export CONTRAST__API__API_KEY=<Contrast_API_key> export CONTRAST__API__SERVICE_KEY=<Contrast_service_key>
Replace
<Contrast_organization_ID>
with your organization ID.Replace
<your_teamserver_environment>
with the address of the Contrast installation where you want to report scan results. For example:https://teamserver-mycompany/Contrast/api/sast
.Replace
<Contrast_user_name>
with the user name for your Contrast account (usually, your login ID).Replace
<Contrast_API_key>
with your Contrast API key.Replace
<Contrast_service_key>
with your Contrast service key.
Run the script using bash (for example,
bash download-release.sh)
You'll see output results similar to the following:
The script downloads
sast-local-scanner-latest.zip
which includes the latest version of the Scan local engine. The ZIP file is approximately 145 MB in size.Extract the Scan local engine files to a convenient location.
Update any custom scripts with the correct version of the Scan local engine