File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ # https://www.zaproxy.org/
2+ # https://www.zaproxy.org/docs/
3+ # https://github.com/zaproxy/
4+ # https://www.zaproxy.org/docs/automate/
5+ # https://github.com/zaproxy/action-full-scan
6+
7+ name : DAST - Zed Attack Proxy (ZAP) Full Scan
8+
9+ on :
10+ push :
11+ branches : [main]
12+ schedule :
13+ - cron : 0 1 * * 0
14+
15+ env :
16+ ZAP_TARGET : " http://127.0.0.1:8080/" # Change this to your target URL
17+ buildAndStart : " true" # Change to "true" to build and start the application if not running
18+ imageName : " webapp01"
19+ tag : ${{ github.sha }}
20+ HOST_PORT : " 8080"
21+ CONTAINER_PORT : " 8000"
22+
23+ jobs :
24+ zap_scan :
25+ name : ZAP Full Scan
26+ runs-on : ubuntu-latest
27+
28+ permissions :
29+ contents : read
30+ issues : write # to create issues for alerts
31+
32+ steps :
33+ - uses : actions/checkout@v4
34+ # build and start your application here
35+ # conditionally run the build step
36+ # assuming the application is a Docker container
37+ - name : Check if application is running, if not, build and start it
38+ if : env.buildAndStart == 'true'
39+ run : |
40+ if ! curl -s --head --request GET ${{ env.ZAP_TARGET }} | grep "200 OK" > /dev/null; then
41+ echo "Application is not running. Building and starting the application..."
42+ docker build ./src/webapp01 --file ./src/webapp01/Dockerfile -t ${{ env.imageName }}:${{ env.tag }}
43+ docker run -d --rm -p ${{ env.HOST_PORT }}:${{ env.CONTAINER_PORT }} ${{ env.imageName }}:${{ env.tag }}
44+ else
45+ echo "Application is already running."
46+ fi
47+ - name : Run ZAP Scan
48+ uses : zaproxy/action-full-scan@v0.12.0
49+ id : zap
50+ with :
51+ target : " ${{ env.ZAP_TARGET }}"
You can’t perform that action at this time.
0 commit comments