Skip to content

Commit 48a6ab9

Browse files
authored
Merge pull request #216 from kingthorin/auth-fw4
auth tests: Use report for further details
2 parents 9358da1 + 9b3d636 commit 48a6ab9

File tree

5 files changed

+86
-20
lines changed

5 files changed

+86
-20
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
# Workflows & scans
1515
# ------------------
16-
*/output
16+
output/
1717
scans/auth/all_vars.env

scans/auth/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Types
1111

12-
- bba - Browser Based Auth
12+
- stdbba - Browser Based Auth
1313
- bbaplus - Browser Based Auth with manual config or extra steps
1414
- csa - Client Script Auth
1515

@@ -18,4 +18,4 @@
1818
1919
# One-offs
2020

21-
1. To run a one-off: `docker run --rm -v $(pwd):/zap/wrk/:rw --env-file scans/auth/all_vars.env -t zaproxy/zap-nightly /zap/zap.sh -cmd -autorun /zap/wrk/scans/auth/plans_and_scripts/testfire/bba.yaml`.
21+
1. To run a one-off: `docker run --rm -v $(pwd):/zap/wrk/:rw --env-file scans/auth/all_vars.env -t zaproxy/zap-nightly /zap/zap.sh -cmd -autorun /zap/wrk/scans/auth/plans_and_scripts/testfire/bbaplus.yaml`.

scans/auth/auth_plan_tests.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ runplan()
77
FILE=$2
88
TYPE=$3
99
echo "Target: $TARGET Plan: $FILE"
10-
echo -ne "$INDENT$TYPE"|tee -a "$OUTPUT" > /dev/null
10+
echo -ne "$INDENT"- type: "$TYPE\n"|tee -a "$OUTPUT" > /dev/null
11+
echo -ne "$INDENT$INDENT"auth:|tee -a "$OUTPUT" > /dev/null
1112

1213
/zap/zap.sh -cmd -autorun "$FILE"
1314
RET=$?
14-
AUTHREPORT=../../auth-report.json
15-
15+
if [[ $TYPE == "stdbba" ]]
16+
then
17+
AUTHREPORT=../../auth-report.json
18+
else
19+
AUTHREPORT=auth-report.json
20+
fi
1621
if [ -f $AUTHREPORT ]
1722
then
1823
echo "Using data from the authentication report"
@@ -23,6 +28,7 @@ runplan()
2328
echo "PASS"
2429
echo " true"|tee -a "$OUTPUT" > /dev/null
2530
summary="${summary} Plan: $TYPE\tPASS\n"
31+
getreportdetails $AUTHREPORT
2632
else
2733
if [ "$AUTH" != "false" ]
2834
then
@@ -31,6 +37,7 @@ runplan()
3137
echo "ERROR"
3238
echo " false"|tee -a "$OUTPUT" > /dev/null
3339
summary="${summary} Plan: $TYPE\tERROR\n"
40+
getreportdetails $AUTHREPORT
3441
RES=1
3542
fi
3643
rm $AUTHREPORT
@@ -50,6 +57,19 @@ runplan()
5057
fi
5158
}
5259

60+
getreportdetails()
61+
{
62+
AUTHREPORT=$1
63+
USER_SUCCESS=`jq -r '.summaryItems[] | select(.key == "auth.summary.username") | .passed' $AUTHREPORT`
64+
echo "$INDENT$INDENT"username: $USER_SUCCESS|tee -a "$OUTPUT" > /dev/null
65+
PASS_SUCCESS=`jq -r '.summaryItems[] | select(.key == "auth.summary.password") | .passed' $AUTHREPORT`
66+
echo "$INDENT$INDENT"password: $PASS_SUCCESS|tee -a "$OUTPUT" > /dev/null
67+
SESS_SUCCESS=`jq -r '.summaryItems[] | select(.key == "auth.summary.session") | .passed' $AUTHREPORT`
68+
echo "$INDENT$INDENT"session: $SESS_SUCCESS|tee -a "$OUTPUT" > /dev/null
69+
VERIF_SUCCESS=`jq -r '.summaryItems[] | select(.key == "auth.summary.verif") | .passed' $AUTHREPORT`
70+
echo "$INDENT$INDENT"verification: $VERIF_SUCCESS|tee -a "$OUTPUT" > /dev/null
71+
}
72+
5373
RES=0
5474

5575
mkdir -p /zap/wrk/output
@@ -85,24 +105,24 @@ do
85105
export username=$(eval echo \$\{TARGET\}_user)
86106
export zapusername=${!username}
87107

88-
runplan $TARGET /zap/wrk/scans/auth/bba-auth-test.yaml "stdbba:"
108+
runplan $TARGET /zap/wrk/scans/auth/bba-auth-test.yaml "stdbba"
89109
else
90110
echo "No $TARGET/config file"
91111
fi
92112

93113
shopt -s nullglob # May be no yaml files
94114
for file in *.yaml
95115
do
96-
runplan $TARGET /zap/wrk/scans/auth/plans_and_scripts/$TARGET/$file $(echo "$file"|cut -d"." -f1)":"
116+
runplan $TARGET /zap/wrk/scans/auth/plans_and_scripts/$TARGET/$file $(echo "$file"|cut -d"." -f1)
97117
sleep 2
98118
done
99119
shopt -u nullglob
100120

101121
if [ -f notes.txt ]
102122
then
103123
echo -ne "$INDENT"|tee -a "$OUTPUT" > /dev/null
104-
echo -ne "note: "|tee -a "$OUTPUT" > /dev/null
105-
echo \""$(cat notes.txt)"\"|tee -a "$OUTPUT" > /dev/null
124+
echo -ne "- note: "|tee -a "$OUTPUT" > /dev/null
125+
echo "\"$(cat notes.txt)\""|tee -a "$OUTPUT" > /dev/null
106126
fi
107127
cd ..
108128
fi

scans/auth/plans_and_scripts/testfire/bbaplus.yaml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,35 @@ env:
2727
password: ${testfire_pass}
2828
username: ${testfire_user}
2929
jobs:
30+
- type: passiveScan-config
31+
parameters:
32+
disableAllRules: true
33+
rules:
34+
- name: Authentication Request Identified
35+
id: 10111
36+
threshold: medium
37+
- name: Session Management Response Identified
38+
id: 10112
39+
threshold: medium
40+
- name: Verification Request Identified
41+
id: 10113
42+
threshold: medium
3043
- type: requestor
3144
parameters:
3245
user: testuser
3346
requests:
34-
- name: Get Account Details
35-
url: 'http://testfire.net/bank/showAccount?listAccounts=800002'
36-
method: GET
37-
responseCode: 200
38-
47+
- url: http://testfire.net
48+
- type: passiveScan-wait
49+
parameters: {}
50+
- name: auth-test-report
51+
type: report
52+
parameters:
53+
template: auth-report-json
54+
theme: null
55+
reportDir: .
56+
reportFile: auth-report.json
57+
reportTitle: ZAP by Checkmarx Scanning Report
58+
sections:
59+
- summary
60+
- afenv
61+
- statistics

scans/auth/plans_and_scripts/testfire/csa.yaml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,35 @@ env:
2020
Username: ${testfire_user}
2121
Password: ${testfire_pass}
2222
jobs:
23+
- type: passiveScan-config
24+
parameters:
25+
disableAllRules: true
26+
rules:
27+
- name: Authentication Request Identified
28+
id: 10111
29+
threshold: medium
30+
- name: Session Management Response Identified
31+
id: 10112
32+
threshold: medium
33+
- name: Verification Request Identified
34+
id: 10113
35+
threshold: medium
2336
- type: requestor
2437
parameters:
2538
user: testuser
2639
requests:
27-
- name: Get Account Details
28-
url: 'http://testfire.net/bank/showAccount?listAccounts=800002'
29-
method: GET
30-
responseCode: 200
31-
40+
- url: http://testfire.net
41+
- type: passiveScan-wait
42+
parameters: {}
43+
- name: auth-test-report
44+
type: report
45+
parameters:
46+
template: auth-report-json
47+
theme: null
48+
reportDir: .
49+
reportFile: auth-report.json
50+
reportTitle: ZAP by Checkmarx Scanning Report
51+
sections:
52+
- summary
53+
- afenv
54+
- statistics

0 commit comments

Comments
 (0)