Skip to content

Commit 816fb78

Browse files
author
Owen Jones
committed
Address review comments
1 parent c85c7d6 commit 816fb78

File tree

6 files changed

+60
-90
lines changed

6 files changed

+60
-90
lines changed

benchmarks/GENUINE/Alfresco.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@ if [ -z "$SECURITY_SCANNER_HOME" ]; then
55
exit 1
66
fi
77

8-
if [[ ! -d "Alfresco" ]]; then
8+
# Stop script if a command does not succeed
9+
set -e
10+
11+
SCRIPT_WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
12+
REPO_DIR=$SCRIPT_WORKING_DIR/Alfresco
13+
DEPLOY_DIR=$REPO_DIR/__dist__
14+
if [ -z "$OUTPUT_DIR" ]; then
15+
OUTPUT_DIR=$SECURITY_SCANNER_HOME/GENUINE
16+
fi
17+
18+
if [[ ! -d $REPO_DIR ]]; then
19+
# First switch to Java 7
920
java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
1021
if [[ ! "$java_version" < "1.8" ]]; then
1122
echo "WRONG JAVA VERSION: $java_version"
@@ -34,35 +45,25 @@ if [[ ! -d "Alfresco" ]]; then
3445
PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
3546
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/bin
3647
fi
37-
fi
3848

39-
# Stop script if a command does not succeed
40-
set -e
41-
42-
SCRIPT_WORKING_DIR=$(pwd)
43-
REPO_DIR=$SCRIPT_WORKING_DIR/Alfresco
44-
DEPLOY_DIR=$REPO_DIR/__dist__
45-
if [ -z "$OUTPUT_DIR" ]; then
46-
OUTPUT_DIR=$SECURITY_SCANNER_HOME/GENUINE
47-
fi
48-
49-
if [[ ! -d $REPO_DIR ]]; then
50-
# The next two statements are commented out, because they access the old
51-
# repo which was deleted. It was actually a mirror of the SVN repo used
52-
# below.
53-
# git clone [email protected]:Alfresco/community-edition .
54-
# git checkout 5fcc93f009c6fb8578e87e79dc19a44309210602
55-
56-
# We are checking out the revision in which we know about the issue.
49+
# Clone the repository and check out a commit which has the issue.
50+
# Originally we looked at commit 5fcc93f009c6fb8578e87e79dc19a44309210602 in
51+
# the git repository [email protected]:Alfresco/community-edition . It has
52+
# since been deleted, but fortunately it was just a clone of the svn
53+
# repository below.
5754
mkdir -p $REPO_DIR
5855
cd $REPO_DIR
5956
svn checkout -r 74720 https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root .
6057

58+
# Build and install
6159
mvn install -DskipTests
6260

61+
# Deploy web apps
6362
mkdir -p $DEPLOY_DIR/webapps
6463
cp projects/web-client/target/alfresco-4.3.0-SNAPSHOT.war $DEPLOY_DIR/webapps
6564
cp projects/slingshot/target/share-4.3.0-SNAPSHOT.war $DEPLOY_DIR/webapps
65+
66+
# Deploy libraries
6667
mkdir $DEPLOY_DIR/lib
6768
cp projects/3rd-party/lib/devenv/mysql-connector-java-5.1.13-bin.jar $DEPLOY_DIR/lib
6869
cp projects/3rd-party/lib/devenv/postgresql-9.3-1101-jdbc41.jar $DEPLOY_DIR/lib
@@ -73,6 +74,7 @@ if [[ ! -d $REPO_DIR ]]; then
7374
cd ..
7475
fi
7576

77+
# Run security-analyser
7678
cd $SECURITY_SCANNER_HOME
7779

7880
python3 $SCRIPT_WORKING_DIR/../../driver/run.py \

benchmarks/GENUINE/CiteSeerX.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88
# Stop script if a command does not succeed
99
set -e
1010

11-
SCRIPT_WORKING_DIR=$(pwd)
11+
SCRIPT_WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
1212
REPO_DIR=$SCRIPT_WORKING_DIR/CiteSeerX
1313
DEPLOY_DIR=$REPO_DIR
1414
FILES_DIR=$SCRIPT_WORKING_DIR/CiteSeerX_files
@@ -23,12 +23,12 @@ if [[ ! -d $REPO_DIR ]]; then
2323
git clone https://github.com/SeerLabs/CiteSeerX.git .
2424
git checkout 8a62545ffc904f2b41b4ecd30ce91900dc7790f4
2525

26-
# There are some example 'template' files that we need to rename to build correctly
27-
rename 's/\.template//' conf/*.template
28-
2926
# Apply the git patch to remove sanitization of query
3027
patch -p1 -f < $FILES_DIR/introduce_XXS_vulnerability.patch
3128

29+
# There are some example 'template' files that we need to rename to build correctly
30+
rename 's/\.template//' conf/*.template
31+
3232
# Build
3333
ant
3434
fi

benchmarks/GENUINE/DSpace.sh

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88
# Stop script if a command does not succeed
99
set -e
1010

11-
SCRIPT_WORKING_DIR=$(pwd)
11+
SCRIPT_WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
1212
REPO_DIR=$SCRIPT_WORKING_DIR/DSpace
1313
DEPLOY_DIR=$REPO_DIR
1414
FILES_DIR=$SCRIPT_WORKING_DIR/DSpace_files
@@ -17,53 +17,33 @@ if [ -z "$OUTPUT_DIR" ]; then
1717
fi
1818

1919
if [[ ! -d $REPO_DIR ]]; then
20-
# 1. Open a terminal in the directory of this readme file and clone DSpace:
20+
# Clone the repository and checkout a commit which builds
2121
mkdir -p $REPO_DIR
2222
cd $REPO_DIR
2323
git clone https://github.com/DSpace/DSpace .
24-
25-
# 2. (Optional) Checkout commit:
2624
git checkout ed7d2980e264901bb60c63da183d620d49772f3e
2725

28-
# and in the file:
29-
# <this-dir>/DSpace/build.properties
30-
# update the variable 'dspace.install.dir' as follows:
31-
# dspace.install.dir=<this-dir>/DSpace/__dist__
32-
33-
echo dspace.install.dir=$DEPLOY_DIR >> build.properties
34-
35-
# The checkout will give you a version with a fixed XSS issue. In order to
36-
# return the XSS issue back comment out lines 94-108 in file:
37-
# <this-dir>/DSpace/dspace-jspui/src/main/java/org/dspace/app/webui/servlet/AbstractBrowserServlet.java
38-
# (NOTE: you can also check out the previous commit; but was not tested)
39-
26+
# Reintroduce the XSS issue
4027
patch -p1 < $FILES_DIR/introduce-xss-vulnerability.patch
4128

42-
# 3. Enter the directory '<this-dir>/DSpace' and type the following command:
29+
# Update 'dspace.install.dir'
30+
echo dspace.install.dir=$DEPLOY_DIR >> build.properties
4331

32+
# Build and package
4433
mvn clean package
4534

46-
# 4. Set the install directory (variable dspace.dir) in dspace/target/dspace-installer/config/dspace.cfg to
47-
# <this-dir>/DSpace/build.properties as above
48-
35+
# Set the install directory (variable 'dspace.dir')
4936
sed -i "[email protected] = /[email protected] = $DEPLOY_DIR@" dspace/target/dspace-installer/config/dspace.cfg
5037

51-
# 5. Enter the directory '<this-dir>/DSpace/dspace/target/dspace-installer'
52-
# and type the following commands:
53-
# ant init_installation
54-
# ant init_configs
55-
# ant install_code
56-
# ant copy_webapps
57-
38+
# install
5839
cd dspace/target/dspace-installer
5940
ant init_installation
6041
ant init_configs
6142
ant install_code
6243
ant copy_webapps
6344
fi
6445

65-
### Finally, analyse it:
66-
46+
# Run security-analyser
6747
cd $SECURITY_SCANNER_HOME
6848

6949
python3 $SCRIPT_WORKING_DIR/../../driver/run.py \

benchmarks/GENUINE/Ginco.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88
# Stop script if a command does not succeed
99
set -e
1010

11-
SCRIPT_WORKING_DIR=$(pwd)
11+
SCRIPT_WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
1212
REPO_DIR=$SCRIPT_WORKING_DIR/Ginco
1313
DEPLOY_DIR=$REPO_DIR/__dist__
1414
FILES_DIR=$SCRIPT_WORKING_DIR/Ginco_files
@@ -17,28 +17,29 @@ if [ -z "$OUTPUT_DIR" ]; then
1717
fi
1818

1919
if [[ ! -d $REPO_DIR ]]; then
20+
# Clone the repository and check out a commit which builds (master branch on
21+
# 2017-11-17 10:18:50)
2022
mkdir -p $REPO_DIR
2123
cd $REPO_DIR
2224
git clone https://github.com/culturecommunication/ginco .
23-
24-
# This is the commit where the XSS issue was fixed: 2fb5a070034deda25b2d50a98e9e6b42754e6425
25-
# This is the subsequent commit mentioned in the README.txt file: fb937f67a78a1f01017cee3a12f4d79d325ec82f
26-
# Nevertheless, we do not checkout any of them. We actually checkout
27-
# latest 'master' branch on 2017-11-17 10:18:50.
2825
git checkout e5b62450f61f76feccd2c2d5bf8ed33d1e258d87
2926

27+
# Reintroduce the XSS issue fixed in commit
28+
# 2fb5a070034deda25b2d50a98e9e6b42754e6425
3029
patch -p1 -f < $FILES_DIR/0001-Reverting-XSS-issue-and-adding-generation-of-jar.patch
3130

31+
# install
3232
mvn install -DskipTests
33-
34-
# Now we create an artificial entry-point project and build it
33+
34+
# Create an artificial entry-point project and build it
3535
cp -r $FILES_DIR/__MAIN__/ .
3636
mkdir -p __MAIN__/src/main/java/org/cprover
3737
cp ../../LIBRARIES/models/model/src/main/java/org/cprover/* __MAIN__/src/main/java/org/cprover
3838
(cd __MAIN__ && mvn package)
3939

40-
# Finally, we deploy built binaries to the deplyment directory
41-
mkdir -p $DEPLOY_DIR/ginco-admin/{webapp,lib}
40+
# Finally, we deploy built binaries to the deployment directory
41+
mkdir -p $DEPLOY_DIR/ginco-admin/webapp
42+
mkdir -p $DEPLOY_DIR/ginco-admin/lib
4243
mkdir -p $DEPLOY_DIR/ginco-webservices/webapp
4344
cp __MAIN__/target/classes/Main.class $DEPLOY_DIR/ginco-admin/webapp
4445
cp __MAIN__/target/classes/SKOSImportService.class __dist__/ginco-admin/webapp
@@ -48,6 +49,7 @@ if [[ ! -d $REPO_DIR ]]; then
4849
cd ..
4950
fi
5051

52+
# Run security-analyser
5153
cd $SECURITY_SCANNER_HOME
5254

5355
python3 $SCRIPT_WORKING_DIR/../../driver/run.py \

benchmarks/GENUINE/Sakai.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88
# Stop script if a command does not succeed
99
set -e
1010

11-
SCRIPT_WORKING_DIR=$(pwd)
11+
SCRIPT_WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
1212
REPO_DIR=$SCRIPT_WORKING_DIR/Sakai
1313
DEPLOY_DIR=$REPO_DIR/__dist__
1414
FILES_DIR=$SCRIPT_WORKING_DIR/Sakai_files
@@ -21,7 +21,7 @@ if [[ ! -d $REPO_DIR ]]; then
2121
mkdir -p $REPO_DIR
2222
cd $REPO_DIR
2323
git clone https://github.com/sakaiproject/sakai.git .
24-
git checkout f333f0c
24+
git checkout f333f0ccd5b652408d7d635289a604cfb018a93d
2525

2626
# Revert the sanitiser introduced in 8550c16
2727
patch -p0 < $FILES_DIR/remove_sanitiser.patch
@@ -30,6 +30,7 @@ if [[ ! -d $REPO_DIR ]]; then
3030
mvn install sakai:deploy -Dmaven.tomcat.home="$DEPLOY_DIR" -DskipTests -Dmaven.test.skip=true
3131
fi
3232

33+
# Run security-analyser
3334
cd $SECURITY_SCANNER_HOME
3435

3536
python3 $SCRIPT_WORKING_DIR/../../driver/run.py \

benchmarks/GENUINE/WebGoat.sh

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LESSONS_WHICH_DO_NOT_WORK='CrossSiteScriptingLesson5a Assignment3 ContentTypeAss
1111
# Stop script if a command does not succeed
1212
set -e
1313

14-
SCRIPT_WORKING_DIR=$(pwd)
14+
SCRIPT_WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
1515
REPO_DIR=$SCRIPT_WORKING_DIR/WebGoat
1616
DEPLOY_DIR=$REPO_DIR
1717
FILES_DIR=$SCRIPT_WORKING_DIR/WebGoat_files
@@ -21,44 +21,29 @@ if [ -z "$OUTPUT_DIR" ]; then
2121
fi
2222

2323
if [[ ! -d $REPO_DIR ]]; then
24-
# 1. git https://github.com/WebGoat/WebGoat.git
25-
# 2. cd WebGoat
24+
# Clone the repository and checkout a commit which builds
2625
mkdir -p $REPO_DIR
2726
cd $REPO_DIR
2827
git clone https://github.com/WebGoat/WebGoat.git .
28+
git checkout a922c001824d4571578e2188d13574597446318b
2929

30-
# 3. git checkout develop
31-
git checkout a922c00
32-
33-
# 4. mvn clean install -DskipTests
30+
#Build and install
3431
mvn clean install -DskipTests
3532

36-
# 5. Create the following files representing the entry point to WebGoat:
33+
# Create an artificial entry-point project
3734
mkdir -p __MAIN__/src/main/java
3835
cp $FILES_DIR/Main.java __MAIN__/src/main/java/Main.java
3936
cp $FILES_DIR/pom.xml __MAIN__/pom.xml
40-
41-
# 6. copy ../../LIBRARIES/models/model/src/main/java/org to ./__MAIN__/src/main/java/
4237
cp -r $MODELS_LIB_DIR/model/src/main/java/org __MAIN__/src/main/java/
4338

44-
# 7. cd __MAIN__
39+
# Build the artificial entry-point project
4540
cd __MAIN__
46-
47-
# 8. python3 ./build.py
48-
if [ -d "./target" ]; then
49-
rm -rf ./target
50-
fi
41+
rm -rf ./target
5142
mvn clean package
52-
if [ -d "./target/classes/org" ]; then
53-
rm -rf ./target/classes/org
54-
fi
55-
if [ -e "./target/__MAIN__-8.0.0.M3.jar" ]; then
56-
rm ./target/__MAIN__-8.0.0.M3.jar
57-
fi
5843

59-
# 9. cd ..
60-
# 10. cd ..
61-
# 11. rm -rf ./webgoat-container
44+
# Remove unneeded files
45+
rm -rf ./target/classes/org
46+
rm -f ./target/__MAIN__-8.0.0.M3.jar
6247
rm -rf ../../webgoat-container
6348
fi
6449

0 commit comments

Comments
 (0)