INFOSemgrep Supply Chain supports the scanning of Java projects built using Maven or Gradle Wrapper without the need for lockfiles. Learn more about scanning your project without generating a Maven dependency tree.
pom.xml files to parse Maven projects. Instead it parses a dependency tree generated by Maven (mvn).
The general steps to enable Semgrep Supply Chain to correctly parse Maven projects are as follows:
Generate a file outlining the project’s dependency tree by adding the following command to your build pipeline:For specific steps to add the command into your build pipeline, refer to your CI provider’s documentation.
For each
pom.xml file with dependencies you want to scan, create additional dependency trees in their respective directories. Semgrep Supply Chain can detect and parse them all.
Scanning Apache Maven projects with specific CI providers
This section describes steps to set up Apache Maven with specific CI providers.GitHub Actions
To successfully run a Semgrep Supply Chain scan in GitHub Actions, the GitHub Actions workflow must generate all dependency trees in one job and then run Semgrep after.Sample GitHub Actions Maven workflow
- Multiple pom.xml files
- Single pom.xml file
In the following code snippet, dependency trees are shared between the two jobs through a zip file that gathers all the lockfiles and, in the next job, unzips the lockfiles and runs Semgrep as usual.