Skip to main content

icon-developers.png Use CLI for static scanning

Instead of using the Contrast web interface, you can use the CLI to scan your code.

Before you begin

Steps

  1. Store your Contrast credentials locally with this command in a terminal window:

    contrast auth
    --api-key <ContrastAPIKey>
    --authorization <ContrastAuthorizationHeader>
    --host <YourHosDomain>
    --organization id <ContrastOrganizationID>

    Get the Contrast API key, the authorization header, and organization ID by logging into the Contrast web interface and selecting user menu > User settings.

  2. Upload and scan a package by using this command in a terminal window:

    contrast scan --file <FileName>

CLI commands describes all the valid options for the scan command.

Next steps