Skip to content

Commit 90092cc

Browse files
committed
Update runCodeQL scripts and Dockerfile.
1 parent 1be8c55 commit 90092cc

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

VMs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This dockerfile builds a container that pulls down and runs the latest version of Benchmark
1+
# This dockerfile builds a container that pulls down and runs the latest version of BenchmarkJava
22
FROM ubuntu:latest
33
MAINTAINER "Dave Wichers [email protected]"
44

scripts/mvnFortifyTranslate.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
sourceanalyzer -b benchmark -clean
2-
sourceanalyzer -b benchmark mvn com.fortify.sca.plugins.maven:sca-maven-plugin:translate -Dfortify.sca.source.version=1.7
2+
sourceanalyzer -b benchmark mvn com.fortify.sca.plugins.maven:sca-maven-plugin:translate -Dfortify.sca.source.version=1.8
33

scripts/runCodeQL.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
# This script assumes the owasp-benchmark database has already been initialized by running this first:
2-
# ../../Tools/codeql-home/codeql/codeql database create owasp-benchmark --language=java
3-
../../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
1+
# The following is based on the instructions at: https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/setting-up-the-codeql-cli. Follow the instructions at: Setting up the CodeQL CLI
2+
3+
# Prerequisites:
4+
# 1) Install codeql in a tools/ directory that is a peer to the folder containing BenchmarkJava. For example, if you have a git/ folder, which contains BenchmarkJava, BenchmarkUtils, etc., then the tools/ folder would be at the same level as the git/ folder. i.e., relative to BenchmarkJava, it is at ../../tools/code-ql-home.
5+
# 2) Then the owasp-benchmark database has to be initialized by running this:
6+
# ../../tools/codeql-home/codeql/codeql database create owasp-benchmark --language=java
7+
8+
# Mac Users: "If you are using macOS on Apple Silicon (for example, Apple M1), ensure that the Xcode command-line developer tools and Rosetta 2 are installed."
9+
## For Xcode command line, run: xcode-select -p 1>/dev/null;echo $? - If this returns 0, its installed, if 2, its not installed.
10+
## For Rosetta 2, run: lsbom -f /Library/Apple/System/Library/Receipts/com.apple.pkg.RosettaUpdateAuto.bom - And if it returns a list of files, it's installed.
11+
12+
13+
# 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
415

scripts/runCodeQLFull.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# The full list of java CodeQL query sets is:
22
# tested: java-code-scanning.qls - Standard Code Scanning queries for Java - This does NOT include Weak Random rule.
3-
# tested: java-security-extended.qls - Security-extended queries for Java - Same score.
4-
## this one builds on the previous one a litte
5-
# tested: java-security-and-quality.qls - Security-and-quality queries for Java - This ONE adds Weak Random rule.
6-
## this one builds on the previous one. But detects nothing additional - Also does NOT include Weak Random rule.
7-
# tested: java-lgtm.qls - Standard LGTM queries for Java - scores lower than lgtm-full by 1 category (Random)
8-
# tested: java-lgtm-full.qls - Standard LGTM queries for Java, including ones not displayed by default - This ONE adds Weak Random rule.
3+
# tested: java-security-extended.qls - Adds a bunch of rules to previous ruleset.
4+
# tested: java-security-and-quality.qls - Adds a bunch of other rules, but scores identical to security-extended ruleset.
5+
# tested: java-lgtm.qls - Standard LGTM queries for Java - scores the same as standard java-code-scanning.qls
6+
# tested: java-lgtm-full.qls - Standard LGTM queries for Java, including ones not displayed by default. Scores the same as security-extended ruleset.
97

108
# This script assumes the owasp-benchmark database has already been initialized by running this first:
119
# ../../Tools/codeql-home/codeql/codeql database create owasp-benchmark --language=java

0 commit comments

Comments
 (0)