Contrast Security Executor¶
Category: Source Code Analysis
Script: contrast_security.py
Integration: REST API
Faraday Plugin: Raw JSON
Website: https://www.contrastsecurity.com/contrast-assess
Description¶
Imports Contrast Assess (IAST) vulnerabilities from Contrast Security TeamServer into Faraday. Each Contrast application becomes a host and each trace (finding) becomes a vulnerability with its request, rule and recommendation.
Prerequisites¶
- A Contrast Security organization with API access
- Your organization ID, API key, service key and the authorization value shown under "Your keys" in the Contrast profile page
- Network access to your TeamServer URL
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
CONTRAST_HOST |
Yes | TeamServer base URL (e.g., https://app.contrastsecurity.com). The /Contrast path is added automatically when missing. |
CONTRAST_ORG_ID |
Yes | Organization ID |
CONTRAST_AUTH |
Yes | Authorization value from "Your keys". Either the ready-made base64 string, or your username/email, in which case CONTRAST_SERVICE_KEY is also needed. |
CONTRAST_API_KEY |
Yes | Organization API key |
CONTRAST_SERVICE_KEY |
No | Service key, needed only when CONTRAST_AUTH is a username instead of the base64 string |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
CONTRAST_APP_ID |
string | No | ID of a single application to import. Leave blank to import all applications. |
CONTRAST_MIN_SEVERITY |
string | No | Minimum severity to import: info, low, medium, high or critical (default: info). Unrecognized values fall back to info. |
YAML Configuration Example¶
executors:
contrast_security:
repo_executor: contrast_security.py
max_size: 65536
varenvs:
CONTRAST_HOST: "https://app.contrastsecurity.com"
CONTRAST_ORG_ID: "<org_id>"
CONTRAST_AUTH: "<authorization_key>"
CONTRAST_API_KEY: "<api_key>"
CONTRAST_SERVICE_KEY: "<service_key>"
params:
CONTRAST_APP_ID:
mandatory: false
type: string
base: string
CONTRAST_MIN_SEVERITY:
mandatory: false
type: string
base: string
How It Works¶
- Sends the
AuthorizationandAPI-Keyheaders on every request - Lists applications with
GET /api/ng/{org}/applications(or reads the one inCONTRAST_APP_ID) - For each application, reads its traces with
POST /api/ng/{org}/orgtraces/{app}/filterand enriches each one withGET /api/ng/{org}/traces/{app}/trace/{uuid}(request, recommendation) - Creates one
[IAST]vulnerability per trace, with the rule, category, language, offending request and recommendation. CWE, OWASP category and CVEs are added as references. - Maps severity (Contrast
NOTEbecomesinfo) and status:Reported,ConfirmedandSuspiciousare open,Not a Problem(or a false-positive / acceptable-risk sub-status) is risk-accepted,RemediatedandFixedare closed.
Notes¶
- Each application is a host with IP
0.0.0.0and the application name as hostname, because findings belong to deployed applications and not to IP addresses. - Applications with no findings at or above
CONTRAST_MIN_SEVERITYare skipped. - TLS certificate verification is disabled for the API calls.
- A 401 response stops the run; other HTTP errors are written to the agent log.
- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor. UseCONTRAST_MIN_SEVERITYto filter by severity.