Install the Contrast CLI

To install the Contrast CLI:

  1. Install Node.js. The Contrast CLI is executed as a Node.js package, so this is required. Versions 10, 12, and 14 are currently supported.

  2. Instrument your application.

    Note

    It is also possible to register an application that has not yet been instrumented. However, all applications should be instrumented so that your application has a library score and the data in the library grid is populated.

  3. Use the cli_proxy property in your agent configuration to establish communication with Contrast over a proxy.

    If authentication is required, provide the username and password with the protocol, host and port. For example:

    http://username:password@<host>:<port>
  4. Be sure the source code for target applications is available locally. Follow these requirements for your application's language:

    • Java: You must have a pom.xml file present and install Maven, including the dependency plugin. For a Gradle project, version 4.8 and above, make sure you have a gradle-wrapper.properties file before building a dependency tree from your build.gradle file.

      Note

      You must successfully build a dependency tree by running mvn dependency:tree or ./gradlew dependencies to make sure the CLI works with your project.

    • .NET and .NET Core: You must have one .csproj file and one package.lock.json file present.

    • Node.js: You must have either a package-lock.json or a .yarn.lock file present.

    • Python: You must have the pipfile and pipfile.lock files present.

    • Ruby: You must have gemfile and gemfile.lock files present.

    • Go: You must have go.mod file present

    Note

    Only single language applications are supported at this time.

  5. Run the following command:

    npm install -g @contrast/contrast-cli

    Alternatively, you can install the CLI with Yarn with the following command:

    yarn global add @contrast/contrast-cl

    Note

    The Contrast CLI must be installed globally.

  6. Once the installation is complete you can register an application to begin analyzing your code.