Skip to main content

Configuring the Checkmarx One CLI

Prerequisites

Before configuring the CLI, download and install the Checkmarx One CLI. For platform-specific installation instructions, click here.

Configuration Methods

CLI configuration parameters can be submitted using three different methods, as follows:

  • CLI parameters - when submitting any CLI command you can add the configuration parameters.

  • Configuration file - a configuration file can be created by running the CLI configure command. See configure

    Note

    By default, the configuration file is stored in the user's home directory under a subdirectory named ($HOME/.checkmarx). It is possible to store the file in a different location and use the environment variable CX_CONFIG_FILE_PATH to reference the file location.

  • Environment variables - the environment variables of your system.

Variables Hierarchy

The following precedence applies when the same value is provided by more than one method - higher numbers override lower numbers:

  1. Environment variables (lowest precedence)

  2. Configuration file

  3. CLI parameters (highest precedence)

Note

Interactive Login stores a refresh token as cx_apikey in the configuration file. If cx_apikey is also set as an environment variable or passed as a CLI parameter, the CLI parameter takes precedence.

Authentication

To submit CLI commands, you must be authenticated with your Checkmarx One account.

The Checkmarx One CLI supports the following authentication methods:

  • Interactive login – Enables you to authenticate using your standard Checkmarx One sign-in flow without first generating an API Key or configuring an OAuth Client. Run cx auth login to sign in through your browser, including multi-factor authentication (MFA). This method only requires your Tenant and Base Auth URI, which can be stored in the CLI configuration or provided as as options in the login command. After you sign in, the CLI obtains a refresh token and stores it as the cx_apikey value used to authenticate subsequent CLI commands. By default, the value is stored in the CLI configuration file. For additional storage options and usage details, see auth login.

  • API Key – Enables you to authenticate using an API Key generated for your Checkmarx One account. The API Key contains the information required by the CLI to identify your Checkmarx One environment, so no additional authentication parameters are generally required.

  • OAuth Client – Enables you to authenticate using OAuth client credentials. This method requires you to provide the OAuth Client ID and Client Secret, together with the Tenant, Base URL, and Base Auth URI.

For API Key and OAuth Client authentication, you can provide the required authentication parameters individually with each CLI command. To avoid providing them repeatedly, you can configure them for reuse across commands using CLI Config or Environment variables. See Checkmarx One CLI Config and Environment Variables for details.

Required Parameters

The following parameters are required for authentication, depending on the authentication method used.

Interactive Login
  • cx_base_auth_uri

  • cx_tenant

These values can be stored in the CLI configuration or provided using the --base-auth-uri and --tenant options when running cx auth login.

API Key
  • cx_apikey

    To generate an API Key use the following procedure:

Notice

The CLI automatically extracts all relevant account info (Base URL, Auth URL, Tenant name) from the API Key. You can use arguments to submit these values explicitly, overriding the extracted values. However, this is generally not recommended.

OAuth Client
  • cx_base_uri

  • cx_base_auth_uri

  • cx_tenant

  • cx_client_id

  • cx_client_secret

    To create an OAuth client, use the following procedure: