Skip to main content

Query Editor API Compatibility

Overview

This page details the APIs and their changes in the new QueryEditor version.

In this version of QueryEditor, most of the APIs were improved to work with the new UI. Due to this update, Checkmarx cannot ensure their backward compatibility. Ensure your environment is updated before using a changed API.

Details:

  • SAST: APIs related explicitly to the QueryEditor SAST engine. These APIs will be gradually supported on other engines (like KICS)

  • NEWUI: APIs related to the UI and templates; these APIs are relevant to the QueryEditor UI/UX.

  • ASYNC: APIs are asynchronous and will return the request UUID. The process will run in the background, and to check the progress/final result, please use the get request API:

Flow Mechanism

The API flow mechanism to create/run a query and obtain the results has changed:

Old version:

  1. Create Session

  2. Detect Languages

  3. ASYNC Scan Project

    1. Return the Scan Project request number (1)

  4. ⏳Check if the SAST Engine is ready to use

    1. Wait for Scan to finish (get sast-status API)

  5. ASYNC Compile Query

    1. Return the Run Query request number (2)

  6. ⏳Check if the query compilation has finished

    1. Wait for query compilation to finish (get request-status API)

  7. Create Query

  8. ASYNC Run Query

    1. Return the Run Query request number (3)

  9. ⏳Check if the run request status has finished

    1. Wait for the run query to finish (get request-status API)

    2. Get all the results/debug message structure.

New Version:

  1. ASYNC Create Session

    1. Starts the Detect Languages process.

    2. Return the Detect Languages request identifier (UUID)

  2. ⏳Check the Detect Languages request

    1. Wait for Detect Languages to finish (get request-status API)

  3. ASYNC Scan Project

    1. Return the Scan Project request identifier (UUID)

  4. ⏳Check if the SAST Engine is ready to use

    1. Wait for Scan to finish (get request-status API)

  5. ASYNC Create Query

    1. Compiles the query

      1. The Validate Queries API could also be triggered to validate/compile queries.

    2. Return the Create Query request identifier.

  6. ⏳Check if the query was created

    1. Wait for the create query to finish (get request-status API)

  7. ASYNC Run Query

    1. Return the Run Query request identifier.

  8. ⏳Check if the run request status has finished

    1. Wait for the run query to finish (get request-status API)

  9. Get Results

    1. Get Vulnerabilities

      1. Get Vulnerability Data (attack vector)

    2. Get Debug Messages

APIs version comparison

A lot of changes were made to improve the QueryEditor experience. One of the primary changes is that almost all the APIs have the sessionId as a required parameter. This will allow it to match all of its operations to a unique session and apply filter permissions to that operation.

Sessions

APIs related to QueryEditor sessions:

Sources

APIs related to QueryEditor scan sources (get sources tree, get source content, and scan source files with SAST engine):

Queries

APIs related to QueryEditor SAST queries:

Requests

APIs related to QueryEditor asynchronous requests:

Notice

Please check the ASYNC operations.

Results

APIs related to QueryEditor SAST query results (vulnerabilities, debug messages, and attach vector).

These are new APIs that replace the old query mechanism. Previously, Run queries returned all the results and debug messages for each run. Now, Run queries return the run ID, and the results/debug messages are divided into the following 4 different APIs:

  • Get Results: Get all the results in the data summary tree for all the session runs.

  • Get Vulnerabilities: get all vulnerabilities related to a given result (result key from previous API)

  • Get Vulnerability: get specific vulnerability data, such as the attack vector for the given vulnerability (vulnerabilityId from the previous API)

  • Get Debug Messages: get debug messages for a specific result (result key from get results API)

Assistant SAST

APIs related to Query Builder Assistant (GPT):

Notice

The SAST QueryEditor uses the following APIs.