Skip to content

Commit 8e5f83e

Browse files
author
owen-jones-diffblue
authored
Merge pull request diffblue#569 from diffblue/webgoat-demo-working-branch
[SEC-638] [SEC-639] Webgoat demo working branch
2 parents 17b2e31 + 67c1a69 commit 8e5f83e

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

driver/run.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
def _get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
1616

1717

18-
def _get_common_libraries():
18+
def _get_common_libraries(diffblue_models_library_location):
1919

2020
def get_benchmark_library_dir():
2121
return os.path.abspath(os.path.join(_get_my_dir(), "../benchmarks/LIBRARIES"))
2222

23-
def get_diffblue_models_library_props():
23+
def get_diffblue_models_library_props(pathname):
2424
props = {"diffblue_models_library": {"paths": [], "error": None}}
25-
pathname = os.path.join(get_benchmark_library_dir(), "models", "model", "target", "models.jar")
25+
if pathname is None:
26+
pathname = os.path.join(get_benchmark_library_dir(), "models", "model", "target", "models.jar")
2627
if os.path.isfile(pathname):
2728
props["diffblue_models_library"]["paths"].append(pathname)
2829
else:
@@ -82,7 +83,7 @@ def get_javax_xxe_library_props():
8283
return props
8384

8485
result = {}
85-
result.update(get_diffblue_models_library_props())
86+
result.update(get_diffblue_models_library_props(diffblue_models_library_location))
8687
result.update(get_java_runtime_library())
8788
result.update(get_apache_tomcat_props())
8889
result.update(get_spring_framework_props())
@@ -162,6 +163,9 @@ def create_parser():
162163
parser.add_argument("--use-models-library", action="store_true",
163164
help="Add the Diffblue Models Library's JAR file to the classpath of the security-scanner. "
164165
"It will be put in front of the JARs of the analysed web application.")
166+
parser.add_argument("--models-library-location", type=str,
167+
help="Absolute path of the models library. Only works if --use-models-library is set. (Will be "
168+
"removed soon)")
165169
parser.add_argument("--use-java-runtime-library", action="store_true",
166170
help="Add the Java standard library to the classpath. First, there will be attempt to add "
167171
"OpenJDK version of the library. If it is not found (e.g. not installed), then the "
@@ -428,7 +432,7 @@ def __main():
428432
analyser.get_missing_binary_error_message())
429433
return
430434

431-
common_libraries = _get_common_libraries()
435+
common_libraries = _get_common_libraries(cmdline.models_library_location)
432436

433437
if cmdline.use_models_library:
434438
if common_libraries["diffblue_models_library"]["error"] is not None:

platform-image-builder/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ RUN apt-get install -y cmake g++ flex bison doxygen patch python3
99

1010
ADD build-security-analyzer.sh /build-security-analyzer.sh
1111

12-
ENTRYPOINT bash /build-security-analyzer.sh
12+
ENTRYPOINT ["/build-security-analyzer.sh"]

platform-image-builder/README

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ expected by Diffblue's platform and export a tarball suitable for building the
33
security scanner platform image.
44

55
Pre-requisite: the deeptest-base Docker image must be available to build
6-
against. If it isn't already present (try
7-
`docker image inspect eu.gcr.io/diffblue-cr/deeptest-base`),
8-
build it by:
6+
against. If it isn't already present, i.e.
7+
`docker image inspect eu.gcr.io/diffblue-cr/deeptest-base` does not give any
8+
output, build it by:
99

1010
$ git clone https://github.com/diffblue/platform
1111
$ cd platform/docker/docker-jobs
@@ -17,6 +17,8 @@ $ cd $REPO_ROOT/platform-image-builder
1717
$ mkdir -p /tmp/output-dir # for example
1818
$ ./make-security-release.sh /tmp/output-dir [branch-or-commit]
1919

20+
'branch-or-commit' refers to the github repository, not your local repository.
21+
2022
If 'branch-or-commit' is not specified we'll build a release tarball from the
2123
tip of 'develop'.
2224

platform-image-builder/build-security-analyzer.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/sh
2+
13
# Runs inside the security-analyzer-builder container.
24

35
set -e
@@ -9,9 +11,9 @@ fi
911

1012
cd /
1113
git clone [email protected]:diffblue/security-scanner
12-
if [ $# -eq 1 ]; then git checkout $1; fi
1314

1415
cd security-scanner
16+
if [ $# -eq 1 ]; then git checkout $1; fi
1517
git submodule update --init
1618

1719
mkdir build
@@ -28,6 +30,7 @@ mkdir /tmp/release/lib
2830
cp dist/lib/libboost* /tmp/release/lib/
2931
cp -r dist/lib/driver/*.py /tmp/release
3032
cp src/java-class-info/default_config.json /tmp/release
33+
cp benchmarks/LIBRARIES/models/model/target/models.jar /tmp/release
3134

3235
cd /tmp/release
3336
tar cvzf /output/release.tar.gz .

platform-image-builder/make-security-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [ $# -lt 1 ]; then
1010
exit 1
1111
fi
1212

13-
docker image inspect security-analyzer-builder:latest >/dev/null 2>&1 || ./create-builder-image.sh
13+
./create-builder-image.sh
1414

1515
mkdir -p $1
1616

0 commit comments

Comments
 (0)