-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathowasp-zap-ui-scan-template.yml
57 lines (46 loc) · 2.41 KB
/
owasp-zap-ui-scan-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
parameters:
- name: url
- name: publishAsTestResults
jobs:
- job: RunOwaspZapUiFullScan
pool: UKHO Ubuntu 1804
workspace:
clean: all
steps:
- task: CmdLine@2
inputs:
script: 'chmod 777 -R $(Build.ArtifactStagingDirectory)'
displayName: "Set chmod permissions for ArtifactStagingDirectory"
- script: |
wget -O $(Build.ArtifactStagingDirectory)/ZapTransform.ps1 "https://raw.githubusercontent.com/UKHO/owasp-zap-scan/master/src/ZapTransform.ps1"
displayName: "Download ZapTransform.ps1 to ArtifactStagingDirectory"
- script: |
wget -O $(Build.ArtifactStagingDirectory)/ZapTransformTemplate.xslt "https://raw.githubusercontent.com/UKHO/owasp-zap-scan/master/src/ZapTransformTemplate.xslt"
displayName: "Download ZapTransformTemplate.xslt to ArtifactStagingDirectory"
- task: CmdLine@2
inputs:
script: 'docker run --rm --mount type=bind,source=$(Build.ArtifactStagingDirectory),target=/zap/wrk/ -t owasp/zap2docker-stable zap-full-scan.py -t ${{ parameters.url }} -g gen.conf -r OWASP-Zap-Report.html -x Report.xml || true'
continueOnError: true
displayName: "Run OWASP ZAP UI Full Scan"
- task: CmdLine@2
condition: and(succeeded(), eq(${{ parameters.publishAsTestResults }}, true))
inputs:
script: docker run --rm --mount type=bind,source=$(Build.ArtifactStagingDirectory),target=/tmp/nunit/ --mount type=bind,source=$(Build.ArtifactStagingDirectory),target=/tmp/report/ mcr.microsoft.com/powershell:ubuntu-18.04 pwsh -File '/tmp/nunit/ZapTransform.ps1'
displayName: "Create Nunit Test Report"
- task: PublishTestResults@2
condition: and(succeeded(), eq(${{ parameters.publishAsTestResults }}, true))
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: 'Converted-OWASP-ZAP-Report.xml'
searchFolder: '$(Build.ArtifactStagingDirectory)'
displayName: "Publish OWASP ZAP UI Test Report"
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/OWASP-Zap-Report.html'
ArtifactName: 'Owasp Zap HTML Report'
publishLocation: 'Container'
displayName: "Publish OWASP ZAP UI HTML Report"
- task: CmdLine@2
inputs:
script: 'chmod 755 -R $(Build.ArtifactStagingDirectory)'
displayName: "Revert chmod permissions for ArtifactStagingDirectory"