devsecops-engine-tools 1.56.1__py3-none-any.whl → 1.56.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of devsecops-engine-tools might be problematic. Click here for more details.
- devsecops_engine_tools/engine_core/src/domain/usecases/break_build.py +187 -338
- devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/runtime_local.py +2 -0
- devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py +4 -1
- devsecops_engine_tools/version.py +1 -1
- {devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/METADATA +1 -1
- {devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/RECORD +9 -9
- {devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/WHEEL +0 -0
- {devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/entry_points.txt +0 -0
- {devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
from itertools import chain
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from functools import reduce
|
|
5
4
|
|
|
6
5
|
from devsecops_engine_tools.engine_core.src.domain.model.input_core import InputCore
|
|
7
6
|
from devsecops_engine_tools.engine_core.src.domain.model.finding import (
|
|
@@ -31,6 +30,45 @@ class BreakBuild:
|
|
|
31
30
|
self.devops_platform_gateway = devops_platform_gateway
|
|
32
31
|
self.printer_table_gateway = printer_table_gateway
|
|
33
32
|
|
|
33
|
+
def process(self, findings_list: "list[Finding]", input_core: InputCore, args: any, warning_release: bool):
|
|
34
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
35
|
+
devops_platform_gateway = self.devops_platform_gateway
|
|
36
|
+
threshold = input_core.threshold_defined
|
|
37
|
+
exclusions = input_core.totalized_exclusions
|
|
38
|
+
custom_message = input_core.custom_message_break_build
|
|
39
|
+
|
|
40
|
+
scan_result = {
|
|
41
|
+
"findings_excluded": [],
|
|
42
|
+
"vulnerabilities": {},
|
|
43
|
+
"compliances": {},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if findings_list:
|
|
47
|
+
self._apply_policie_exception_new_vulnerability_industry(
|
|
48
|
+
findings_list, exclusions, args
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
findings_excluded, findings_without_exclusions = self._filter_findings(findings_list, exclusions)
|
|
52
|
+
scan_result["findings_excluded"] = [self._map_finding_excluded(item) for item in findings_excluded]
|
|
53
|
+
|
|
54
|
+
vulnerabilities = [v for v in findings_without_exclusions if v.category == Category.VULNERABILITY]
|
|
55
|
+
compliances = [v for v in findings_without_exclusions if v.category == Category.COMPLIANCE]
|
|
56
|
+
|
|
57
|
+
vulnerability_counts = self._count_severities(vulnerabilities)
|
|
58
|
+
compliance_counts = self._count_severities(compliances)
|
|
59
|
+
|
|
60
|
+
self._handle_vulnerabilities(vulnerability_counts, vulnerabilities, threshold, warning_release, scan_result)
|
|
61
|
+
self._handle_cve_policy(vulnerabilities, threshold)
|
|
62
|
+
self._handle_compliances(compliance_counts, compliances, threshold, warning_release, scan_result)
|
|
63
|
+
self._handle_exclusions(findings_excluded, exclusions)
|
|
64
|
+
else:
|
|
65
|
+
print(devops_platform_gateway.message("succeeded", "There are no findings"))
|
|
66
|
+
print(devops_platform_gateway.result_pipeline("succeeded"))
|
|
67
|
+
|
|
68
|
+
print()
|
|
69
|
+
print(devops_platform_gateway.message("info", custom_message))
|
|
70
|
+
return scan_result
|
|
71
|
+
|
|
34
72
|
def _apply_policie_exception_new_vulnerability_industry(
|
|
35
73
|
self, findings_list: "list[Finding]", exclusions: "list[Exclusions]", args: any
|
|
36
74
|
):
|
|
@@ -53,353 +91,164 @@ class BreakBuild:
|
|
|
53
91
|
)
|
|
54
92
|
)
|
|
55
93
|
|
|
56
|
-
def
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
scan_result = {
|
|
65
|
-
"findings_excluded": [],
|
|
66
|
-
"vulnerabilities": {},
|
|
67
|
-
"compliances": {},
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if len(findings_list) != 0:
|
|
71
|
-
self._apply_policie_exception_new_vulnerability_industry(
|
|
72
|
-
findings_list, exclusions, args
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
findings_excluded_list = list(
|
|
76
|
-
filter(
|
|
77
|
-
lambda item: any(
|
|
78
|
-
exclusion.id == item.id
|
|
79
|
-
and (exclusion.where in item.where or "all" in exclusion.where)
|
|
80
|
-
and exclusion.severity == item.severity
|
|
81
|
-
for exclusion in exclusions
|
|
82
|
-
),
|
|
83
|
-
findings_list,
|
|
84
|
-
)
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
scan_result["findings_excluded"] = list(
|
|
88
|
-
map(
|
|
89
|
-
lambda item: {
|
|
90
|
-
"id": item.id,
|
|
91
|
-
"severity": item.severity,
|
|
92
|
-
"category": item.category.value,
|
|
93
|
-
},
|
|
94
|
-
findings_excluded_list,
|
|
95
|
-
)
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
findings_without_exclusions_list = list(
|
|
99
|
-
filter(
|
|
100
|
-
lambda v: v not in findings_excluded_list,
|
|
101
|
-
findings_list,
|
|
102
|
-
)
|
|
94
|
+
def _filter_findings(self, findings_list, exclusions):
|
|
95
|
+
findings_excluded_list = [
|
|
96
|
+
item for item in findings_list if any(
|
|
97
|
+
exclusion.id == item.id and
|
|
98
|
+
(exclusion.where in item.where or "all" in exclusion.where) and
|
|
99
|
+
exclusion.severity == item.severity
|
|
100
|
+
for exclusion in exclusions
|
|
103
101
|
)
|
|
102
|
+
]
|
|
103
|
+
findings_without_exclusions_list = [
|
|
104
|
+
v for v in findings_list if v not in findings_excluded_list
|
|
105
|
+
]
|
|
106
|
+
return findings_excluded_list, findings_without_exclusions_list
|
|
107
|
+
|
|
108
|
+
def _map_finding_excluded(self, item):
|
|
109
|
+
return {
|
|
110
|
+
"id": item.id,
|
|
111
|
+
"severity": item.severity,
|
|
112
|
+
"category": item.category.value,
|
|
113
|
+
}
|
|
104
114
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
def _count_severities(self, findings_list):
|
|
116
|
+
counts = {
|
|
117
|
+
"critical": 0,
|
|
118
|
+
"high": 0,
|
|
119
|
+
"medium": 0,
|
|
120
|
+
"low": 0
|
|
121
|
+
}
|
|
122
|
+
for finding in findings_list:
|
|
123
|
+
severity = finding.severity.lower()
|
|
124
|
+
if severity in counts:
|
|
125
|
+
counts[severity] += 1
|
|
126
|
+
return counts
|
|
111
127
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
117
|
-
)
|
|
128
|
+
def _handle_vulnerabilities(self, counts, vulnerabilities_list, threshold, warning_release, scan_result):
|
|
129
|
+
devops_platform_gateway = self.devops_platform_gateway
|
|
130
|
+
printer_table_gateway = self.printer_table_gateway
|
|
131
|
+
print()
|
|
118
132
|
|
|
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
|
-
0,
|
|
153
|
-
|
|
133
|
+
total = sum(counts[severity] for severity in ["critical", "high", "medium", "low"])
|
|
134
|
+
if total == 0:
|
|
135
|
+
print(devops_platform_gateway.message("succeeded", "There are no vulnerabilities"))
|
|
136
|
+
print(devops_platform_gateway.result_pipeline("succeeded"))
|
|
137
|
+
return
|
|
138
|
+
|
|
139
|
+
if (counts["critical"] >= threshold.vulnerability.critical or
|
|
140
|
+
counts["high"] >= threshold.vulnerability.high or
|
|
141
|
+
counts["medium"] >= threshold.vulnerability.medium or
|
|
142
|
+
counts["low"] >= threshold.vulnerability.low):
|
|
143
|
+
|
|
144
|
+
print("Below are all vulnerabilities detected.")
|
|
145
|
+
printer_table_gateway.print_table_findings(vulnerabilities_list)
|
|
146
|
+
print(devops_platform_gateway.message(
|
|
147
|
+
"error",
|
|
148
|
+
"Security count issues (critical: {0}, high: {1}, medium: {2}, low: {3}) is greater than or equal to failure criteria (critical: {4}, high: {5}, medium: {6}, low:{7}, operator: or)".format(
|
|
149
|
+
counts["critical"], counts["high"], counts["medium"], counts["low"],
|
|
150
|
+
threshold.vulnerability.critical, threshold.vulnerability.high,
|
|
151
|
+
threshold.vulnerability.medium, threshold.vulnerability.low
|
|
152
|
+
)
|
|
153
|
+
))
|
|
154
|
+
print(devops_platform_gateway.result_pipeline("failed"))
|
|
155
|
+
|
|
156
|
+
scan_result["vulnerabilities"] = {
|
|
157
|
+
"threshold": counts,
|
|
158
|
+
"status": "failed",
|
|
159
|
+
"found": [{"id": item.id, "severity": item.severity} for item in vulnerabilities_list],
|
|
160
|
+
}
|
|
161
|
+
else:
|
|
162
|
+
print("Below are all vulnerabilities detected.")
|
|
163
|
+
printer_table_gateway.print_table_findings(vulnerabilities_list)
|
|
164
|
+
print(devops_platform_gateway.message(
|
|
165
|
+
"warning",
|
|
166
|
+
"Security count issues (critical: {0}, high: {1}, medium: {2}, low: {3}) is not greater than or equal to failure criteria (critical: {4}, high: {5}, medium: {6}, low:{7}, operator: or)".format(
|
|
167
|
+
counts["critical"], counts["high"], counts["medium"], counts["low"],
|
|
168
|
+
threshold.vulnerability.critical, threshold.vulnerability.high,
|
|
169
|
+
threshold.vulnerability.medium, threshold.vulnerability.low
|
|
170
|
+
)
|
|
171
|
+
))
|
|
172
|
+
result = "succeeded_with_issues" if warning_release or devops_platform_gateway.get_variable("stage") == "build" else "succeeded"
|
|
173
|
+
print(devops_platform_gateway.result_pipeline(result))
|
|
174
|
+
|
|
175
|
+
scan_result["vulnerabilities"] = {
|
|
176
|
+
"threshold": counts,
|
|
177
|
+
"status": "succeeded",
|
|
178
|
+
"found": [{"id": item.id, "severity": item.severity} for item in vulnerabilities_list],
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
def _handle_cve_policy(self, vulnerabilities_list: list[Finding], threshold):
|
|
182
|
+
devops_platform_gateway = self.devops_platform_gateway
|
|
154
183
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
),
|
|
159
|
-
compliances_without_exclusions_list,
|
|
160
|
-
0,
|
|
184
|
+
ids_vulnerabilities = list(
|
|
185
|
+
chain.from_iterable(
|
|
186
|
+
([x.id, x.description] if x.tool == "XRAY" else [x.id]) for x in vulnerabilities_list
|
|
161
187
|
)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
devops_platform_gateway.message(
|
|
176
|
-
"succeeded", "There are no vulnerabilities"
|
|
177
|
-
)
|
|
178
|
-
)
|
|
179
|
-
print(devops_platform_gateway.result_pipeline("succeeded"))
|
|
180
|
-
elif (
|
|
181
|
-
vulnerabilities_critical >= threshold.vulnerability.critical
|
|
182
|
-
or vulnerabilities_high >= threshold.vulnerability.high
|
|
183
|
-
or vulnerabilities_medium >= threshold.vulnerability.medium
|
|
184
|
-
or vulnerabilities_low >= threshold.vulnerability.low
|
|
185
|
-
):
|
|
186
|
-
print("Below are all vulnerabilities detected.")
|
|
187
|
-
printer_table_gateway.print_table_findings(
|
|
188
|
-
vulnerabilities_without_exclusions_list
|
|
189
|
-
)
|
|
190
|
-
print(
|
|
191
|
-
devops_platform_gateway.message(
|
|
192
|
-
"error",
|
|
193
|
-
"Security count issues (critical: {0}, high: {1}, medium: {2}, low: {3}) is greater than or equal to failure criteria (critical: {4}, high: {5}, medium: {6}, low:{7}, operator: or)".format(
|
|
194
|
-
vulnerabilities_critical,
|
|
195
|
-
vulnerabilities_high,
|
|
196
|
-
vulnerabilities_medium,
|
|
197
|
-
vulnerabilities_low,
|
|
198
|
-
threshold.vulnerability.critical,
|
|
199
|
-
threshold.vulnerability.high,
|
|
200
|
-
threshold.vulnerability.medium,
|
|
201
|
-
threshold.vulnerability.low,
|
|
202
|
-
),
|
|
203
|
-
)
|
|
204
|
-
)
|
|
205
|
-
print(devops_platform_gateway.result_pipeline("failed"))
|
|
206
|
-
|
|
207
|
-
scan_result["vulnerabilities"] = {
|
|
208
|
-
"threshold": {
|
|
209
|
-
"critical": vulnerabilities_critical,
|
|
210
|
-
"high": vulnerabilities_high,
|
|
211
|
-
"medium": vulnerabilities_medium,
|
|
212
|
-
"low": vulnerabilities_low,
|
|
213
|
-
},
|
|
214
|
-
"status": "failed",
|
|
215
|
-
"found": list(
|
|
216
|
-
map(
|
|
217
|
-
lambda item: {
|
|
218
|
-
"id": item.id,
|
|
219
|
-
"severity": item.severity,
|
|
220
|
-
},
|
|
221
|
-
vulnerabilities_without_exclusions_list,
|
|
222
|
-
)
|
|
223
|
-
),
|
|
224
|
-
}
|
|
225
|
-
else:
|
|
226
|
-
print("Below are all vulnerabilities detected.")
|
|
227
|
-
printer_table_gateway.print_table_findings(
|
|
228
|
-
vulnerabilities_without_exclusions_list
|
|
229
|
-
)
|
|
230
|
-
print(
|
|
231
|
-
devops_platform_gateway.message(
|
|
232
|
-
"warning",
|
|
233
|
-
"Security count issues (critical: {0}, high: {1}, medium: {2}, low: {3}) is not greater than or equal to failure criteria (critical: {4}, high: {5}, medium: {6}, low:{7}, operator: or)".format(
|
|
234
|
-
vulnerabilities_critical,
|
|
235
|
-
vulnerabilities_high,
|
|
236
|
-
vulnerabilities_medium,
|
|
237
|
-
vulnerabilities_low,
|
|
238
|
-
threshold.vulnerability.critical,
|
|
239
|
-
threshold.vulnerability.high,
|
|
240
|
-
threshold.vulnerability.medium,
|
|
241
|
-
threshold.vulnerability.low,
|
|
242
|
-
),
|
|
243
|
-
)
|
|
244
|
-
)
|
|
245
|
-
|
|
246
|
-
if devops_platform_gateway.get_variable("stage") == "build":
|
|
247
|
-
print(
|
|
248
|
-
devops_platform_gateway.result_pipeline("succeeded_with_issues")
|
|
249
|
-
)
|
|
250
|
-
else:
|
|
251
|
-
print(devops_platform_gateway.result_pipeline("succeeded"))
|
|
252
|
-
|
|
253
|
-
scan_result["vulnerabilities"] = {
|
|
254
|
-
"threshold": {
|
|
255
|
-
"critical": vulnerabilities_critical,
|
|
256
|
-
"high": vulnerabilities_high,
|
|
257
|
-
"medium": vulnerabilities_medium,
|
|
258
|
-
"low": vulnerabilities_low,
|
|
259
|
-
},
|
|
260
|
-
"status": "succeeded",
|
|
261
|
-
"found": list(
|
|
262
|
-
map(
|
|
263
|
-
lambda item: {
|
|
264
|
-
"id": item.id,
|
|
265
|
-
"severity": item.severity,
|
|
266
|
-
},
|
|
267
|
-
vulnerabilities_without_exclusions_list,
|
|
268
|
-
)
|
|
269
|
-
),
|
|
270
|
-
}
|
|
188
|
+
)
|
|
189
|
+
ids_match = [x for x in threshold.cve if x in ids_vulnerabilities]
|
|
190
|
+
if ids_match:
|
|
191
|
+
print(devops_platform_gateway.message(
|
|
192
|
+
"error",
|
|
193
|
+
"Scan Failed due to vulnerability policy violations: CVEs Vulnerabilities: {0}".format(",".join(ids_match))
|
|
194
|
+
))
|
|
195
|
+
print(devops_platform_gateway.result_pipeline("failed"))
|
|
196
|
+
|
|
197
|
+
def _handle_compliances(self, counts, compliances_list, threshold, warning_release, scan_result):
|
|
198
|
+
devops_platform_gateway = self.devops_platform_gateway
|
|
199
|
+
printer_table_gateway = self.printer_table_gateway
|
|
200
|
+
print()
|
|
271
201
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if len(ids_match) > 0:
|
|
282
|
-
print(
|
|
283
|
-
devops_platform_gateway.message(
|
|
284
|
-
"error",
|
|
285
|
-
"Scan Failed due to vulnerability policy violations: CVEs Vulnerabilities: {0}".format(
|
|
286
|
-
",".join(ids_match)
|
|
287
|
-
),
|
|
202
|
+
if compliances_list:
|
|
203
|
+
print("Below are all compliances issues detected.")
|
|
204
|
+
printer_table_gateway.print_table_findings(compliances_list)
|
|
205
|
+
status = "succeeded"
|
|
206
|
+
if counts["critical"] >= threshold.compliance.critical:
|
|
207
|
+
print(devops_platform_gateway.message(
|
|
208
|
+
"error",
|
|
209
|
+
"Compliance issues count (critical: {0}) is greater than or equal to failure criteria (critical: {1})".format(
|
|
210
|
+
counts["critical"], threshold.compliance.critical
|
|
288
211
|
)
|
|
289
|
-
)
|
|
212
|
+
))
|
|
290
213
|
print(devops_platform_gateway.result_pipeline("failed"))
|
|
291
|
-
|
|
292
|
-
print()
|
|
293
|
-
if len(compliances_without_exclusions_list) > 0:
|
|
294
|
-
print("Below are all compliances issues detected.")
|
|
295
|
-
printer_table_gateway.print_table_findings(
|
|
296
|
-
compliances_without_exclusions_list
|
|
297
|
-
)
|
|
298
|
-
status = "succeeded"
|
|
299
|
-
if compliance_critical >= threshold.compliance.critical:
|
|
300
|
-
print(
|
|
301
|
-
devops_platform_gateway.message(
|
|
302
|
-
"error",
|
|
303
|
-
"Compliance issues count (critical: {0}) is greater than or equal to failure criteria (critical: {1})".format(
|
|
304
|
-
compliance_critical, threshold.compliance.critical
|
|
305
|
-
),
|
|
306
|
-
)
|
|
307
|
-
)
|
|
308
|
-
print(devops_platform_gateway.result_pipeline("failed"))
|
|
309
|
-
status = "failed"
|
|
310
|
-
else:
|
|
311
|
-
if devops_platform_gateway.get_variable("stage") == "build":
|
|
312
|
-
print(
|
|
313
|
-
devops_platform_gateway.result_pipeline(
|
|
314
|
-
"succeeded_with_issues"
|
|
315
|
-
)
|
|
316
|
-
)
|
|
317
|
-
scan_result["compliances"] = {
|
|
318
|
-
"threshold": {"critical": compliance_critical},
|
|
319
|
-
"status": status,
|
|
320
|
-
"found": list(
|
|
321
|
-
map(
|
|
322
|
-
lambda item: {
|
|
323
|
-
"id": item.id,
|
|
324
|
-
"severity": item.severity,
|
|
325
|
-
},
|
|
326
|
-
compliances_without_exclusions_list,
|
|
327
|
-
)
|
|
328
|
-
),
|
|
329
|
-
}
|
|
214
|
+
status = "failed"
|
|
330
215
|
else:
|
|
331
|
-
|
|
332
|
-
devops_platform_gateway.
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
exclusions_list = list(
|
|
340
|
-
map(
|
|
341
|
-
lambda item: {
|
|
342
|
-
"severity": item.severity,
|
|
343
|
-
"id": item.id,
|
|
344
|
-
"where": item.where,
|
|
345
|
-
"create_date": next(
|
|
346
|
-
(
|
|
347
|
-
elem.create_date
|
|
348
|
-
for elem in exclusions
|
|
349
|
-
if elem.id == item.id
|
|
350
|
-
and (
|
|
351
|
-
elem.where in item.where or "all" in elem.where
|
|
352
|
-
)
|
|
353
|
-
and elem.severity == item.severity
|
|
354
|
-
),
|
|
355
|
-
None,
|
|
356
|
-
),
|
|
357
|
-
"expired_date": next(
|
|
358
|
-
(
|
|
359
|
-
elem.expired_date
|
|
360
|
-
for elem in exclusions
|
|
361
|
-
if elem.id == item.id
|
|
362
|
-
and (
|
|
363
|
-
elem.where in item.where or "all" in elem.where
|
|
364
|
-
)
|
|
365
|
-
and elem.severity == item.severity
|
|
366
|
-
),
|
|
367
|
-
None,
|
|
368
|
-
),
|
|
369
|
-
"reason": next(
|
|
370
|
-
(
|
|
371
|
-
elem.reason
|
|
372
|
-
for elem in exclusions
|
|
373
|
-
if elem.id == item.id
|
|
374
|
-
and (
|
|
375
|
-
elem.where in item.where or "all" in elem.where
|
|
376
|
-
)
|
|
377
|
-
and elem.severity == item.severity
|
|
378
|
-
),
|
|
379
|
-
None,
|
|
380
|
-
),
|
|
381
|
-
},
|
|
382
|
-
findings_excluded_list,
|
|
383
|
-
)
|
|
384
|
-
)
|
|
385
|
-
print(
|
|
386
|
-
devops_platform_gateway.message(
|
|
387
|
-
"warning", "Bellow are all findings that were excepted."
|
|
388
|
-
)
|
|
389
|
-
)
|
|
390
|
-
printer_table_gateway.print_table_exclusions(exclusions_list)
|
|
391
|
-
for reason, total in Counter(
|
|
392
|
-
map(lambda x: x["reason"], exclusions_list)
|
|
393
|
-
).items():
|
|
394
|
-
print("{0} findings count: {1}".format(reason, total))
|
|
216
|
+
if warning_release or devops_platform_gateway.get_variable("stage") == "build":
|
|
217
|
+
print(devops_platform_gateway.result_pipeline("succeeded_with_issues"))
|
|
218
|
+
|
|
219
|
+
scan_result["compliances"] = {
|
|
220
|
+
"threshold": {"critical": counts["critical"]},
|
|
221
|
+
"status": status,
|
|
222
|
+
"found": [{"id": item.id, "severity": item.severity} for item in compliances_list],
|
|
223
|
+
}
|
|
395
224
|
else:
|
|
396
|
-
print(devops_platform_gateway.message("succeeded", "There are no
|
|
225
|
+
print(devops_platform_gateway.message("succeeded", "There are no compliances issues"))
|
|
397
226
|
print(devops_platform_gateway.result_pipeline("succeeded"))
|
|
227
|
+
|
|
228
|
+
def _handle_exclusions(self, findings_excluded_list, exclusions):
|
|
229
|
+
devops_platform_gateway = self.devops_platform_gateway
|
|
230
|
+
printer_table_gateway = self.printer_table_gateway
|
|
398
231
|
print()
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
232
|
+
|
|
233
|
+
if findings_excluded_list:
|
|
234
|
+
exclusions_list = []
|
|
235
|
+
for item in findings_excluded_list:
|
|
236
|
+
matching = next(
|
|
237
|
+
(e for e in exclusions if e.id == item.id and (e.where in item.where or "all" in e.where) and e.severity == item.severity),
|
|
238
|
+
None
|
|
239
|
+
)
|
|
240
|
+
if matching:
|
|
241
|
+
exclusions_list.append({
|
|
242
|
+
"severity": item.severity,
|
|
243
|
+
"id": item.id,
|
|
244
|
+
"where": item.where,
|
|
245
|
+
"create_date": matching.create_date,
|
|
246
|
+
"expired_date": matching.expired_date,
|
|
247
|
+
"reason": matching.reason,
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
print(devops_platform_gateway.message("warning", "Below are all findings that were excepted."))
|
|
251
|
+
printer_table_gateway.print_table_exclusions(exclusions_list)
|
|
252
|
+
|
|
253
|
+
for reason, total in Counter(x["reason"] for x in exclusions_list).items():
|
|
254
|
+
print("{0} findings count: {1}".format(reason, total))
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/runtime_local.py
CHANGED
|
@@ -39,6 +39,8 @@ class RuntimeLocal(DevopsPlatformGateway):
|
|
|
39
39
|
return f"{self.FAIL}{self.ICON_FAIL}Failed{self.ENDC}"
|
|
40
40
|
elif type == "succeeded":
|
|
41
41
|
return f"{self.OKGREEN}{self.ICON_SUCCESS}Succeeded{self.ENDC}"
|
|
42
|
+
elif type == "succeeded_with_issues":
|
|
43
|
+
return f"{self.WARNING}{self.ICON_SUCCESS}Succeeded with issues{self.ENDC}"
|
|
42
44
|
|
|
43
45
|
def get_source_code_management_uri(self):
|
|
44
46
|
return os.environ.get("DET_SOURCE_CODE_MANAGEMENT_URI")
|
|
@@ -49,10 +49,13 @@ def init_engine_core(
|
|
|
49
49
|
sbom_tool_gateway
|
|
50
50
|
).process(args, config_tool)
|
|
51
51
|
|
|
52
|
+
warning_release = config_tool["WARNING_RELEASE"]
|
|
53
|
+
|
|
52
54
|
results = BreakBuild(devops_platform_gateway, print_table_gateway).process(
|
|
53
55
|
findings_list,
|
|
54
56
|
input_core,
|
|
55
|
-
args
|
|
57
|
+
args,
|
|
58
|
+
warning_release
|
|
56
59
|
)
|
|
57
60
|
if args["send_metrics"] == "true":
|
|
58
61
|
MetricsManager(devops_platform_gateway, metrics_manager_gateway).process(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
version = '1.56.
|
|
1
|
+
version = '1.56.2'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
devsecops_engine_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
devsecops_engine_tools/version.py,sha256=
|
|
2
|
+
devsecops_engine_tools/version.py,sha256=XMpqgbPzLWgS1yqslDBTbetgB22e7rLQZTsPRC5fG-4,19
|
|
3
3
|
devsecops_engine_tools/engine_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
devsecops_engine_tools/engine_core/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
devsecops_engine_tools/engine_core/src/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -26,7 +26,7 @@ devsecops_engine_tools/engine_core/src/domain/model/gateway/sbom_manager.py,sha2
|
|
|
26
26
|
devsecops_engine_tools/engine_core/src/domain/model/gateway/secrets_manager_gateway.py,sha256=CTwUIvUWF0NSSzdCqASUFst6KUysW53NV9eatjLGdl8,170
|
|
27
27
|
devsecops_engine_tools/engine_core/src/domain/model/gateway/vulnerability_management_gateway.py,sha256=CB6KMjSNNgOEGdmzsxMLMMhs1MRf_C3GFsrEP77gOIo,1432
|
|
28
28
|
devsecops_engine_tools/engine_core/src/domain/usecases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
-
devsecops_engine_tools/engine_core/src/domain/usecases/break_build.py,sha256=
|
|
29
|
+
devsecops_engine_tools/engine_core/src/domain/usecases/break_build.py,sha256=irBUimRwOlRLXDpiymoWGL8RBLDr6co-lgk9BF6EqBQ,11837
|
|
30
30
|
devsecops_engine_tools/engine_core/src/domain/usecases/handle_risk.py,sha256=GrNdnA5qZ3fpTP9-UhVau_cVK6tGsQBOQDDLDQgZ4VA,9430
|
|
31
31
|
devsecops_engine_tools/engine_core/src/domain/usecases/handle_scan.py,sha256=abeULdsu_KzF3bx31qFlCWulq01aL34emKkYssR1b-w,10994
|
|
32
32
|
devsecops_engine_tools/engine_core/src/domain/usecases/metrics_manager.py,sha256=xfaGrDf9rnN32qG_zOD9NN-a62reqQ5KOd2bP6xoRnw,2417
|
|
@@ -46,11 +46,11 @@ devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/printer_pr
|
|
|
46
46
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/printer_rich_table/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
47
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/printer_rich_table/printer_rich_table.py,sha256=LPr3xSv0I7ENEdu1xj8ve5PXzpUohs7hbQvHjDSaUuE,3028
|
|
48
48
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
|
-
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/runtime_local.py,sha256=
|
|
49
|
+
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/runtime_local/runtime_local.py,sha256=KyWEzOqkT-Y8lrgnmndDxCVc6yvOqVVkogzn75TsWMw,3001
|
|
50
50
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/syft/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
devsecops_engine_tools/engine_core/src/infrastructure/driven_adapters/syft/syft.py,sha256=hP5MitHTeZf3Ia-xwi5bUdIU5hIwbUNuDSzcsqlxG5c,4457
|
|
52
52
|
devsecops_engine_tools/engine_core/src/infrastructure/entry_points/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py,sha256=
|
|
53
|
+
devsecops_engine_tools/engine_core/src/infrastructure/entry_points/entry_point_core.py,sha256=oWg5W-xyAjNac2kgRSKOcPhfEI9da_bJ7UTgqkPbKzI,2401
|
|
54
54
|
devsecops_engine_tools/engine_core/src/infrastructure/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
55
|
devsecops_engine_tools/engine_core/src/infrastructure/helpers/aws.py,sha256=wfy_PosHS0rrvkdiUYczxIcc8ZNwfqzWwqVxrmRTCBI,264
|
|
56
56
|
devsecops_engine_tools/engine_core/src/infrastructure/helpers/util.py,sha256=lDtaozInb5m2R8Y-oGQasroksCRw_N_Ltz7gLkSguX8,380
|
|
@@ -349,8 +349,8 @@ devsecops_engine_tools/engine_utilities/utils/name_conversion.py,sha256=ADJrRGax
|
|
|
349
349
|
devsecops_engine_tools/engine_utilities/utils/printers.py,sha256=amYAr9YQfYgR6jK9a2l26z3oovFPQ3FAKmhq6BKhEBA,623
|
|
350
350
|
devsecops_engine_tools/engine_utilities/utils/session_manager.py,sha256=Z0fdhB3r-dxU0nGSD9zW_B4r2Qol1rUnUCkhFR0U-HQ,487
|
|
351
351
|
devsecops_engine_tools/engine_utilities/utils/utils.py,sha256=HCjS900TBoNcHrC4LaiP-Kf9frVdtagF130qOUgnO2M,6757
|
|
352
|
-
devsecops_engine_tools-1.56.
|
|
353
|
-
devsecops_engine_tools-1.56.
|
|
354
|
-
devsecops_engine_tools-1.56.
|
|
355
|
-
devsecops_engine_tools-1.56.
|
|
356
|
-
devsecops_engine_tools-1.56.
|
|
352
|
+
devsecops_engine_tools-1.56.2.dist-info/METADATA,sha256=KEX-nzMB0aWgUCn6svcsPmRHbARkL3_Xb-RPsAG4QNo,11779
|
|
353
|
+
devsecops_engine_tools-1.56.2.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
354
|
+
devsecops_engine_tools-1.56.2.dist-info/entry_points.txt,sha256=MHCTFFs9bdNKo6YcWCcBW2_8X6yTisgLOlmVx-V8Rxc,276
|
|
355
|
+
devsecops_engine_tools-1.56.2.dist-info/top_level.txt,sha256=ge6y0X_xBAU1aG3EMWFtl9djbVyg5BxuSp2r2Lg6EQU,23
|
|
356
|
+
devsecops_engine_tools-1.56.2.dist-info/RECORD,,
|
|
File without changes
|
{devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{devsecops_engine_tools-1.56.1.dist-info → devsecops_engine_tools-1.56.2.dist-info}/top_level.txt
RENAMED
|
File without changes
|