-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathazure-pipelines.yml
329 lines (311 loc) · 11.7 KB
/
azure-pipelines.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# Example Continuous Delivery Pipeline with Fortify on Demand (FoD) and Fortify ScanCentral SAST/DAST support
name: InsecureWebApp-CD
trigger:
batch: true
branches:
include:
- main
- develop
- feature/*
- release/*
exclude:
- experimental/*
paths:
exclude:
- InsecureProductService/
- InsecurePaymentService/
- InsecureShippingService/
- README.md
- bin/*
- lib/*
- etc/*
- media/*
pr:
branches:
include:
- main
- develop
paths:
exclude:
- InsecureProductService/
- InsecurePaymentService/
- InsecureShippingService/
- README.md
- bin/*
- lib/*
- etc/*
- media/*
variables:
#
# In order for the pipeline to execute successfully you should create and set the following variables in the Pipeline UI.
#
# For FoD:
# FOD_BASE_URL - FoD Base Url, e.g. "https://ams.fortify.com"
# FOD_API_URL - FoD API URL, e.g. "https://api.ams.fortify.com"
# FOD_TENANT - FoD Tenant Name
# FOD_CLIENT_ID - FoD API Client Id
# FOD_CLIENT_SECRET - FoD API Client Secret
# FOD_SERVICE_CONNECTION - The name of the Service Connection created when configuring the Fortify Azure DevOps plugin
#
# For SSC:
# SSC_URL - SSC URL
# SSC_CI_TOKEN - SSC CIToken
#
# For Debricked:
# DEBRICKED_TOKEN - Debricked Access Token
#
# For ScanCentral SAST:
# SCANCENTRAL_CLIENT_AUTH_TOKEN - ScanCentral SAST Client Authentication Token
#
# For ScanCentral DAST:
# Nothing Yet
#
# The pipeline job templates make use of the Fortify CLI tool (https://github.com/fortify/fcli) and Debricked CLI tool (https://github.com/debricked/cli)
# There are tasks which make use of preview extensions (not published to the Azure DevOps marketplace) to install these tools included, e.g.:
# - FcliInstaller - https://github.com/fortify-presales/azure-pipelines-fcli-tasks
# Follow the instructions on the GitHub repos to install these extensions.
# If you are using a self-hosted agent you can install the fcli and debricked tools yourselves, add to the path and comment out the these extension tasks.
#
# IMPORTANT: if using a self-hosted agent, please ensure a Java 17x64 SDK is installed and the environment variable JAVA_HOME_17_X64 is set to its location
# Change these variables depending on which parts of the pipeline to execute:
- name: USE_FOD_SAST
value: true
- name: USE_FOD_OSS
value: false
- name: USE_DEBRICKED
value: true
- name: USE_FOD_DAST
value: false
- name: USE_SCANCENTRAL_SAST
value: false
- name: USE_SCANCENTRAL_DAST
value: false
#
# By default the FoD/SSC application name is set to the name of the Git repository
# By default the FoD/SSC release/application version name is set to the name of the Git branch
# If you wish to override any of these please set the following variables from the pipelines UI:
#
# FORTIFY_APP_NAME_OVERRIDE
# FORTIFY_RELEASE_NAME_OVERRIDE
#
- name: FORTIFY_APP_NAME
value: $(Build.Repository.Name)
- name: FORTIFY_RELEASE_NAME
value: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]
stages:
#
# Build and Unit Test the application components
#
- stage: BuildAndUnitTest
displayName: 'Build and Unit Test'
jobs:
# Build InsecureWebApp and run its tests
- template: 'devops-integrations/azure-pipelines/templates/build-and-test.yml'
parameters:
srcProject: 'InsecureWebApp/InsecureWebApp.csproj'
testProject: 'InsecureWebAppTests/InsecureWebAppTests.csproj'
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Software Composition Analysis - OSS Scan from Debricked
#
- stage: Debricked_OSS
displayName: 'Debricked OSS'
condition: eq(variables['USE_DEBRICKED'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run Debricked OSS Scan on Project
- template: 'devops-integrations/azure-pipelines/templates/debricked-oss-scan.yml'
parameters:
workingDirectory: '.'
debrickedToken: $(DEBRICKED_TOKEN)
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Software Composition Analysis - OSS Scan from Fortify on Demand
#
- stage: FoD_OSS
displayName: 'FoD OSS'
condition: eq(variables['USE_FOD_OSS'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run FoD OSS Scan on Project
- template: 'devops-integrations/azure-pipelines/templates/fod-oss-scan.yml'
parameters:
workingDirectory: 'InsecureWebApp'
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
vsEdition: "Enterprise"
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Static Application Security Testing with Fortify on Demand
#
- stage: FoD_SAST
displayName: 'FoD SAST'
condition: eq(variables['USE_FOD_SAST'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run FoD SAST Scan on Project
- template: 'devops-integrations/azure-pipelines/templates/fod-sast-scan.yml'
parameters:
workingDirectory: 'InsecureWebApp'
projectFile: 'InsecureWebApp.csproj'
fodServiceConnection: $(FOD_SERVICE_CONNECTION)
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
vsEdition: "Enterprise"
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Static Application Security Testing with ScanCentral SAST
#
- stage: ScanCentral_SAST
displayName: 'ScanCentral SAST'
condition: eq(variables['USE_SCANCENTRAL_SAST'], 'true')
dependsOn:
- BuildAndUnitTest
jobs:
# Run Scancentral SAST Scan on Project
- template: 'devops-integrations/azure-pipelines/templates/scancentral-sast-scan.yml'
parameters:
workingDirectory: 'InsecureWebApp'
projectFile: 'InsecureWebApp.csproj'
scanCentralClientToken: $(SCANCENTRAL_CLIENT_AUTH_TOKEN)
sscUrl: $(SSC_URL)
sscCiToken: $(SSC_CI_TOKEN)
sscAppName: "$(FORTIFY_APP_NAME)"
sscAppVerName: "$(FORTIFY_RELEASE_NAME)"
#notificationEmail: 'your_email_address'
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Deploy the application - use an appropriate set of tasks for your application/environment here
#
- stage: DeployApp
displayName: 'Deploy Application'
dependsOn:
- FoD_SAST
- FoD_OSS
- Debricked_OSS
- ScanCentral_SAST
jobs:
# This is a simulated deployment and does nothing
- template: 'devops-integrations/azure-pipelines/templates/simulate-deployment.yml'
parameters:
workingDirectory: 'InsecureWebApp'
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
# More likely you will be using something like the following:
#- template: 'devops-integrations/azure-pipelines/templates/deploy-to-azure.yml'
# parameters:
# workingDirectory: 'InsecureWebApp'
# pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
# vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Dynamic Application Security Testing with Fortify on Demand
#
- stage: FoD_DAST
displayName: 'FoD DAST'
condition: eq(variables['USE_FOD_DAST'], 'true')
dependsOn: DeployApp
jobs:
# Run FoD DAST Scan on Project
- template: 'devops-integrations/azure-pipelines/templates/fod-dast-scan.yml'
parameters:
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Dynamic Application Security Testing with ScanCentral DAST
#
- stage: ScanCentral_DAST
displayName: 'ScanCentral DAST'
condition: eq(variables['USE_SCANCENTRAL_DAST'], 'true')
dependsOn: DeployApp
jobs:
# Run ScanCentral DAST Scan on Project
- template: 'devops-integrations/azure-pipelines/templates/scancentral-dast-scan.yml'
parameters:
sscUrl: $(SSC_URL)
sscCiToken: $(SSC_CI_TOKEN)
sscAppName: "$(FORTIFY_APP_NAME)"
sscAppVerName: "$(FORTIFY_RELEASE_NAME)"
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Verify FoD Security Policy
#
- stage: FoD_SecurityGate
displayName: 'FoD Security Gate'
condition: always()
dependsOn:
- FoD_SAST
- FoD_DAST
jobs:
# Verify Security Policy for the Release
- template: 'devops-integrations/azure-pipelines/templates/fod-security-gate.yml'
parameters:
workingDirectory: 'InsecureWebApp'
fodApiUrl: $(FOD_API_URL)
fodClientId: $(FOD_CLIENT_ID)
fodClientSecret: $(FOD_CLIENT_SECRET)
fodAppName: "$(FORTIFY_APP_NAME)"
fodReleaseName: "$(FORTIFY_RELEASE_NAME)"
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x
#
# Verify SSC Security Policy
#
- stage: SSC_SecurityGate
displayName: 'SSC Security Gate'
condition: always()
dependsOn:
- ScanCentral_SAST
- ScanCentral_DAST
jobs:
# Verify Security Policy for the Application Version
- template: 'devops-integrations/azure-pipelines/templates/ssc-security-gate.yml'
parameters:
workingDirectory: 'InsecureWebApp'
sscUrl: $(SSC_URL)
sscCiToken: $(SSC_CI_TOKEN)
sscAppName: "$(FORTIFY_APP_NAME)"
sscAppVerName: "$(FORTIFY_RELEASE_NAME)"
pool:
#name: 'Fortify' # uncomment to use named self-hosted pool
vmImage: 'windows-2022' # uncomment to use Azure Devops cloud-hosted pool
#vmImage: 'ubuntu-20.04' # uncomment to use Linux Agent with DotNet Core 6.x