Skip to main content

Setup the required security tokens in Jenkins.

  1. Navigate to the “Credentials” page under the Manage Jenkins Security settings.
  2. Choose Add Credential and select Secret Text from the Kind menu.
  • SLS_CLIENT_ID & SLS_CLIENT_SECRET - used to authenticate to our Container Registry and provided by SLS
  • SLS_SCAN_KEY - The Scan Key can be found under Product Data Sources -> Start Left Scanner -> Scan Key (It is also available on the Asset details page for the repository.)
Credentials The job will pass the credentials to the scanner as environment variables.

To create and run this pipeline, follow these steps:

  1. Go to your Jenkins dashboard and click on New Item.
  2. Enter a name for your pipeline (e.g., SLS Scan) and select Pipeline. Then click OK.
  3. On the configuration page, scroll down to the Pipeline section and select Pipeline script from the Definition drop-down menu.
  4. Paste the script below ito the script section. Replace the Git Checkout with the desired code Repository location. You can leave the other fields as default.
  5. Click Save to save your pipeline.
The following pipeline script creates a Jenkins job to run both SCA and SAST scans.
pipeline {
    agent any
    environment {
        WORKDIR = 'Workspace'
        SCAN_KEY = credentials('SLS_SCAN_KEY')
        SLS_CLIENT_ID = credentials('SLS_CLIENT_ID')
        SLS_CLIENT_SECRET = credentials('SLS_CLIENT_SECRET')
    }
    stages{
        stage ('Git Checkout') {
            steps {
                dir("${WORKDIR}") {
                    git branch: 'master', url: 'https://github.com/<org>/<repo>.git'
                }
            }
        }
        stage ('ScanProject'){
            steps {
                sh 'docker login -u ${SLS_CLIENT_ID} -p ${SLS_CLIENT_SECRET} tauruseer.azurecr.io'

                // Run SCA Scan
                sh 'docker pull tauruseer.azurecr.io/sca-scanner-pipeline:latest'
                sh 'docker run -v ${WORKSPACE}:/source tauruseer.azurecr.io/sca-scanner-pipeline:latest --scan-key=${SCAN_KEY}'

                // Run SAST Scan
                sh 'docker pull tauruseer.azurecr.io/sast-scanner-pipeline:latest'
                sh 'docker run -v ${WORKSPACE}:/source tauruseer.azurecr.io/sast-scanner-pipeline:latest --scan-key=${SCAN_KEY}'
            }
        }   
    }
}