Skip to content

Commit 9bf9cb1

Browse files
authored
Merge pull request #12 from psiinon/main
Check for JSP compilation failures
2 parents 79ca4ae + 47eee05 commit 9bf9cb1

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,36 @@ jobs:
2121
cache: maven
2222
- name: Build with Maven
2323
run: mvn clean package
24+
25+
- name: Test wavsep
26+
run: |
27+
# Run wavsep, mapping the logs
28+
mkdir logs
29+
30+
# Pre create the logfile we need access to
31+
LOG_FILE=localhost.$(date +%F).log
32+
touch logs/$LOG_FILE
33+
chmod -R a+r logs
34+
35+
docker run --rm -v $(pwd)/logs:/opt/tomcat/logs/:rw -v $(pwd)/target/wavsep.war:/opt/tomcat/webapps/wavsep.war:rw -p 8080:8080 -p 3306:3306 zaproxy/wavsep &
36+
37+
sleep 5
38+
39+
docker run --rm -v $(pwd):/zap/wrk/:rw --network host ghcr.io/zaproxy/zaproxy:nightly zap.sh -cmd -port 9090 -silent -autorun /zap/wrk/test/zap-spider.yaml
40+
41+
sleep 5
42+
43+
echo List logs dir
44+
ls -l logs
45+
46+
cat logs/$LOG_FILE
47+
48+
grep "Unable to compile class" logs/$LOG_FILE >> grepout || true
49+
50+
if [ -s grepout ]; then
51+
echo "Compilation failed"
52+
exit 1
53+
else
54+
echo "Compilation passed"
55+
exit 0
56+
fi

‎test/zap-spider.yaml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
env:
2+
contexts:
3+
- name: wavsep
4+
urls:
5+
- http://127.0.0.1:8080/wavsep
6+
includePaths:
7+
- http://127.0.0.1:8080/wavsep.*
8+
excludePaths:
9+
# This URL is a test page with a deliberate compilation error
10+
- http://127.0.0.1:8080/wavsep/passive/info/info-server-stack-trace.jsp
11+
authentication:
12+
verification:
13+
method: response
14+
pollFrequency: 60
15+
pollUnits: requests
16+
pollUrl: ""
17+
pollPostData: ""
18+
sessionManagement:
19+
method: cookie
20+
technology:
21+
exclude:
22+
- Windows
23+
structure: {}
24+
parameters: {}
25+
jobs:
26+
- name: spider active
27+
type: spider
28+
parameters:
29+
url: http://127.0.0.1:8080/wavsep/index-active.jsp
30+
maxDepth: 0
31+
tests:
32+
- name: At least 100 URLs found
33+
type: stats
34+
onFail: INFO
35+
statistic: automation.spider.urls.added
36+
operator: '>='
37+
value: 100
38+
- name: spider passive
39+
type: spider
40+
parameters:
41+
url: http://127.0.0.1:8080/wavsep/index-passive.jsp

0 commit comments

Comments
 (0)