About Scala SCA Agent-Based Scanning

Veracode Software Composition Analysis

You can find vulnerabilities in your Scala applications using Veracode Software Composition Analysis agent-based scanning. You can run a scan on Scala repositories using the agent-based scanning command-line interface or the CI integrations.

For packaging instructions for Veracode Static Analysis and Veracode SCA upload scans, see Packaging Scala Applications.


Scanning a repository which utilizes Scala and SBT requires the ability to assemble the projects dependencies within the environment you intend to scan the project in. This includes the following requirements:

SBT Requirements

  • Meet the requirements for the Veracode SCA agent.
  • Include build.sbt in the projects root folder.
  • Build the project with SBT version 0.13.16 or later. If you are overriding the version in the project build.properties file, ensure the version is set to 0.13.16 or later.
  • For Coursier and SBT, be able to successfully run sbt clean compile from the root of the project where you perform scans.

Running a Scan

You can use agent-based scanning to scan any code repository which you have access to and fulfills the above requirements. To demonstrate how to run a scan, you can clone one of the Veracode SCA public repositories:

git clone https://github.com/srcclr/example-sbt  
Note: You can also scan code repositories hosted on git by using the --url argument with the CLI agent (see documentation for usage), but for the purposes of this guide it will be assumed you have the code stored locally.

Once the code has been cloned to your desktop, point the Veracode SCA CLI agent at the directory of the repository and scan:

# Replace "example-sbt" with the project folder name of your choosing
srcclr scan path/to/example-sbt

To view more verbose output during the scan process, you can add the --loud argument as well:

srcclr scan path/to/example-sbt --loud

The Veracode SCA agent will then proceed to use the native package managers in order to identify the dependencies and their versions in your project. The command used varies depending on the build or package manager. Once the agent has evaluated the open-source libraries in use, a summary of the scan results will be produced which will include counts for total libraries used, vulnerable libraries, percentage of third-party code, as well as a list of the vulnerabilities found.

Viewing Scan Results

After completing a scan, the bottom of the output in your terminal will include a link to the Veracode Platform to view the scan results in more detail:

Unique Library Licenses                   7
Libraries Using GPL                       1
Libraries With No License                 0
Libraries With Multiple Licenses          3

Full Report Details                  https://sca.analysiscenter.veracode.com/teams/abzs0qx/scans/22679557

Navigating to this link will allow you to view the results of your scan in it’s entirety.

The scan results are broken down into the following categories:

  • Issues: This is comprised of out of date libraries, license violations, and vulnerabilities uniquely associated to a specific version of a library within a specific repository.
  • Vulnerabilities: This list represents the set of unique vulnerabilities across a specific project. If multiple libraries in a given project are associated with the same vulnerability, the vulnerability will only appear once in this list.
  • Libraries: Libraries consist of each open source library that Veracode SCA has identified within a code project.
  • Licenses: Licenses allow users to view the software license information associated with each open source library in use.

You can find more details on these categories in the Issues, Vulnerabilities, Libraries, and Licenses documentation article.

Fixing Vulnerability Issues

After viewing the scan results, users will likely want to fix the vulnerabilities discovered in their SBT project. Veracode SCA provides clear instructions for fixing vulnerability issues through the Veracode Platform.

Fixing a Direct Vulnerability

When a library is specifically referenced in your configuration file, Veracode SCA refers to the library as a “direct” dependency. Fixing a vulnerability in a direct dependency using agent-based scanning is simple. Using the open source projects mentioned in the Running a scan section and after having navigated to the project scan results within the Veracode Platform, you can filter down to “Vulnerability” issues which are included only in “Direct Libraries”.

After filtering the scan results, you can drill into an issue to find out how to fix it by clicking the issue id next to the vulnerability name. This will bring you to the issue details page, where you will find information on fixing the vulnerability. In general, the best way to fix a vulnerability in a direct dependency is to update the version in use to the version recommended by Veracode SCA. The agent-based scan recommends a version which is not associated with the vulnerability you are subject to, in addition to any other vulnerabilities which might result from switching to a different version. In order to prevent the update from having significant impact on your code, the recommended version will be the closest to your current version while still not being associated with other vulnerabilities.

Note: Some libraries include vulnerabilities which have not yet been fixed, and therefore Veracode SCA cannot provide a version to update to. In cases such as this, it is recommended you either create a pull request to the unfixed library or use a different library in your code.

Validating a Fixed Vulnerability

Validate the fix you have made to your repository by running an agent-based scan prior to committing your code changes by adding the --allow-dirty option to ignore uncommitted changes within your code:

srcclr scan /path/to/example-sbt --allow-dirty

Once you have verified the vulnerability no longer shows up in the scan output, you can proceed to commit your code and you will have fixed the vulnerability.