-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestowasp.yaml
96 lines (79 loc) · 4.75 KB
/
testowasp.yaml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
trigger: none
variables:
swaggerDefUrl: "https://capstonefinal.azurewebsites.net/"
definitionFormat: "openapi"
buildConfiguration: "Test"
webRepository: "capstonefinal"
tag: "$(Build.BuildId)"
publishAsTestResults: "variables.PublishTestResults"
jobs:
- job: Run_Owasp_Zap_API_Scan
pool:
vmImage: "ubuntu-latest"
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 $(swaggerDefUrl) -g gen.conf -r OWASP-Zap-Report.html -x Report.xml || true'
continueOnError: true
displayName: "Run OWASP ZAP UI Full Scan"
- task: CmdLine@2
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
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 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-api-scan.py -t $(swaggerDefUrl) -f $(definitionFormat) -g gen.conf -r OWASP-Zap-Report.html -x Report.xml || true"
# continueOnError: true
# displayName: "Run OWASP ZAP API Scan"
# - task: CmdLine@2
# 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
# inputs:
# testResultsFormat: "NUnit"
# testResultsFiles: "Converted-OWASP-ZAP-Report.xml"
# searchFolder: "$(Build.ArtifactStagingDirectory)"
# displayName: "Publish OWASP ZAP API Test Report"
# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: "$(Build.ArtifactStagingDirectory)/OWASP-Zap-Report.html"
# ArtifactName: "Owasp Zap HTML Report"
# publishLocation: "Container"
# displayName: "Publish OWASP ZAP API HTML Report"
# - task: CmdLine@2
# inputs:
# script: "chmod 755 -R $(Build.ArtifactStagingDirectory)"
# displayName: "Revert chmod permissions for ArtifactStagingDirectory"