I am helping our DevOps team integrate Snyk into the Jenkins pipelines for SAST. By default, it seems like this Snyk plugin is doing snyk test
(which does open-source dependency scans) and appends the additional arguments provided with it. I identified this behavior by checking the console log where the actual command ran was displayed. We actually want it to do the source code scan snyk code
.
The command I observed in the console log is this: <jenkins tools installation path>/snyk-linux test --json --severity-threshold=high --file=<path>/package.json
; The snyk-linux test
part seems to be predefined.
Can someone please help me regarding this?
Running Snyk CLI directly is indeed the only way at the moment.
However, if any code vulnerabilities are detected, the CLI command seems to be failing the build, with a non-zero exit code most certainly.
The Snyk vendor should support this in a future version of the Snyk Jenkins Plugin.
Another alternative, is the Snyk Maven Plugin but only for Maven projects and IMHO it is not as elegant as the Jenkins Plugin.