File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-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+ permissions :
24+ contents : read
25+
26+ jobs :
27+ zap_scan :
28+ name : ZAP Full Scan
29+ runs-on : ubuntu-latest
30+
31+ steps :
32+ - uses : actions/checkout@v4
33+ # build and start your application here
34+ # conditionally run the build step
35+ # assuming the application is a Docker container
36+ - name : Check if application is running, if not, build and start it
37+ if : env.buildAndStart == 'true'
38+ run : |
39+ if ! curl -s --head --request GET ${{ env.ZAP_TARGET }} | grep "200 OK" > /dev/null; then
40+ echo "Application is not running. Building and starting the application..."
41+ docker build ./src/webapp01 --file ./src/webapp01/Dockerfile -t ${{ env.imageName }}:${{ env.tag }}
42+ docker run -d --rm -p ${{ env.HOST_PORT }}:${{ env.CONTAINER_PORT }} ${{ env.imageName }}:${{ env.tag }}
43+ else
44+ echo "Application is already running."
45+ fi
46+ - name : Run ZAP Scan
47+ uses : zaproxy/action-full-scan@v0.12.0
48+ id : zap
49+ with :
50+ target : " ${{ env.ZAP_TARGET }}"
You can’t perform that action at this time.
0 commit comments