Define vulnerability security controls for pipelines in Jenkins
You can use the contrastAgent pipeline step to download the Contrast agent, then instrument and exercise your application. You can use the contrastVerification pipeline step to verify your application and set parameters for a security control.
Download with contrastAgent
A pipeline step with the name contrastAgent downloads the latest Contrast agent.
Parameter | Required | Description | Examples |
|---|---|---|---|
| Required | Contrast connection profile used to communicate with Contrast |
|
| Required | This defines where to put the downloaded agent. |
|
| Required if | Type of agent used to instrument the application (not case sensitive) Options are: |
|
Here is an example of how to add a pipeline step with the name contrastAgent :
node{ stage('Download Latest Contrast Agent'){ contrastAgent profile:'MyConnection', outputDirectory: env.WORKSPACE, agentType: 'Java' } }
Verify application with contrastVerification
You can use a pipeline step with the name contrastVerification to verify whether an application is vulnerable.
Parameter | Required | Description | Examples |
|---|---|---|---|
| Required | Use | Contrast Connection |
| Required | Use Enter the option number for how you want to query vulnerabilities (defaults to 1):
| 1 |
| Required, if | The ID of the application or application module you are trying to verify |
|
| Required, if | The name of the application you are trying to verify (not case sensitive) | MyApp |
| Optional | The total number of allowed vulnerabilities, defaults to 0 | 10 |
| Optional | Defaults to All |
|
| Optional | Defaults to All. Other options are Critical, High, Medium and Low. | High |
| Optional | The value that was passed to the | v1.2.3 |
Here are some examples of how to add a pipeline step with the name contrastVerification :
Use
queryBystartDate:contrastVerification applicationId: '1e6ad9c6-89d4-4f06-bdf6-92c569ec89de', count: 1, profile: 'new-profile', queryBy: 3, rule: 'cache-controls-missing', severity: 'High'
Use
queryBycustomappVersionTagparameter:contrastVerification applicationId: '1e6ad9c6-89d4-4f06-bdf6-92c569ec89de', count: 1, profile: 'new-profile', queryBy: 4, appVersionTag: 'v1.2.3' rule: 'cache-controls-missing', severity: 'High'
Use
applicationNameandAgentTypeto define the application:contrastVerification applicationName: 'MyApp', agentType: 'Java', count: 1, profile: 'new-profile', queryBy: 3, rule: 'cache-controls-missing', severity: 'High'
Verify an application with a preset or overridden vulnerability security control.
If you know that the vulnerability security control has been preset in Contrast, then you only need to define the profile and either the
applicationIdor (applicationNameandagentType):contrastVerification applicationId: '35ae7b89-1c76-414b-b317-c444ce27608b', profile: 'ContrastConnection'