Skip to content

Commit 74a165b

Browse files
committed
Update CodeQL scan scripts, and add Contrast CodeSec and Snyk SAST scripts.
1 parent 90092cc commit 74a165b

5 files changed

+15
-3
lines changed

scripts/runCodeQL.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111

1212

1313
# This then runs the codeql scan:
14-
../../tools/codeql-home/codeql/codeql database analyze owasp-benchmark java-code-scanning.qls --format=sarifv2.1.0 --output=results/Benchmark_1.2-codeql_java-code-scanning_qls.sarif
14+
benchmark_version=$(scripts/getBenchmarkVersion.sh)
15+
../../tools/codeql-home/codeql/codeql database analyze owasp-benchmark java-code-scanning.qls --format=sarifv2.1.0 --output=results/Benchmark_$benchmark_version-codeql_java-code-scanning_qls.sarif
1516

scripts/runCodeQLFull.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
# This script assumes the owasp-benchmark database has already been initialized by running this first:
99
# ../../Tools/codeql-home/codeql/codeql database create owasp-benchmark --language=java
1010
#../../Tools/codeql-home/codeql/codeql database analyze owasp-benchmark java-security-extended.qls --format=sarifv2.1.0 --output=results/Benchmark_1.2-codeql_java-security-extended.sarif
11-
../../Tools/codeql-home/codeql/codeql database analyze owasp-benchmark java-security-and-quality.qls --format=sarifv2.1.0 --output=results/Benchmark_1.2-codeql_java-security-and-quality.sarif
11+
benchmark_version=$(scripts/getBenchmarkVersion.sh)
12+
../../Tools/codeql-home/codeql/codeql database analyze owasp-benchmark java-security-and-quality.qls --format=sarifv2.1.0 --output=results/Benchmark_$benchmark_version-codeql_java-security-and-quality.sarif
1213

scripts/runContrastCodeSec.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Note: you have to do 'contrast auth' first, and successfully authenticate before you can run this.
2+
benchmark_version=$(scripts/getBenchmarkVersion.sh)
3+
4+
contrast scan -f target/benchmark.war --save
5+
mv results.sarif results/Benchmark_$benchmark_version-ContrastCodeSec.sarif
6+

scripts/runSnykSAST.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Install Snyk per: https://docs.snyk.io/snyk-cli/install-or-update-the-snyk-cli
2+
benchmark_version=$(scripts/getBenchmarkVersion.sh)
3+
snyk code test --json-file-output=results/Benchmark_$benchmark_version-snykCodeCli.json
4+

scripts/verifyBenchmarkPluginAvailable.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Verify the benchmarkutils plugin is installed. And if not, explain how to install it
2-
mvn -Djava.awt.headless=true -Dplugin=org.owasp:benchmarkutils-maven-plugin help:describe 2>&1 >/dev/null
2+
mvn -Dplugin=org.owasp:benchmarkutils-maven-plugin help:describe 2>&1 >/dev/null
33

44
if [ $? -ne 0 ]
55
then

0 commit comments

Comments
 (0)