Skip to content

Checkmarx SAST Executor

Category: Source Code Analysis Script: checkmarx_sast.py Integration: REST API Faraday Plugin: Raw JSON Website: https://checkmarx.com/cxsast-source-code-scanning/

Description

Imports static analysis (SAST) findings from a Checkmarx CxSAST server into Faraday. Each CxSAST project becomes a host and the results of its latest scan, or of a scan you choose, are created as vulnerabilities.

Prerequisites

  • A Checkmarx CxSAST 9.x server reachable from the agent
  • A CxSAST user (username and password) with permission to read projects, scans and results

Configuration

Environment Variables (Setup)

Variable Required Description
CXSAST_HOST Yes Base URL of the CxSAST manager (e.g., https://cx.corp.example.com)
CXSAST_USER Yes CxSAST username
CXSAST_PASSWORD Yes CxSAST user password

These variables are also accepted as execution arguments, so a single run can override them.

Execution Arguments

Parameter Type Mandatory Description
CXSAST_PROJECT_ID string No ID of a single project to import. Leave blank to import all projects. Ignored when CXSAST_SCAN_ID is set.
CXSAST_SCAN_ID string No ID of a specific scan to import. When blank, the latest finished scan of each project is used.
CXSAST_MIN_SEVERITY string No Minimum severity to import: info, low, medium, high or critical (default: info). Any other value stops the run.

YAML Configuration Example

executors:
  checkmarx_sast:
    repo_executor: checkmarx_sast.py
    max_size: 65536
    varenvs:
      CXSAST_HOST: "https://cx.corp.example.com"
      CXSAST_USER: "<cxsast_user>"
      CXSAST_PASSWORD: "<cxsast_password>"
    params:
      CXSAST_PROJECT_ID:
        mandatory: false
        type: string
        base: string
      CXSAST_SCAN_ID:
        mandatory: false
        type: string
        base: string
      CXSAST_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string

How It Works

  1. Requests an access token from /cxrestapi/auth/identity/connect/token with the OAuth2 password grant and the user credentials
  2. Lists the projects with GET /cxrestapi/projects (or reads the one in CXSAST_PROJECT_ID) and finds the latest finished scan of each, or uses CXSAST_SCAN_ID directly
  3. Reads the scan results from GET /cxrestapi/sast/results, 100 per page
  4. Creates one vulnerability per result (name prefixed with [SAST]). The description has the file and line, sink location and triage state; CWE and query IDs are added as references.
  5. Maps severity from the Checkmarx value (text or 0-4 index). Triage states NOT_EXPLOITABLE and PROPOSED_NOT_EXPLOITABLE become risk-accepted, FIXED/RESOLVED become closed, everything else is open.

Notes

  • Each project is a host with IP 0.0.0.0 and the project name as hostname, because source code findings do not belong to network addresses.
  • Projects without a finished scan, or without results at or above CXSAST_MIN_SEVERITY, are skipped.
  • TLS certificate verification is disabled for the API calls.
  • A failed login or 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. Use CXSAST_MIN_SEVERITY to filter by severity.