1
+ #!/usr/bin/env python
2
+
1
3
"""
2
4
Example written by Aaron Weaver <aaron.weaver@owasp.org>
3
5
as part of the OWASP DefectDojo and OWASP AppSec Pipeline Security projects
@@ -66,7 +68,7 @@ def return_engagement(dd, product_id, user, build_id=None):
66
68
dojoTime = start_date .strftime ("%H:%M:%S" )
67
69
engagementText = "CI/CD Integration (" + dojoTime + ")"
68
70
if build_id is not None :
69
- engagementText = engagementText + " - Build #" + build_id
71
+ engagementText = engagementText + " - Build #" + build_id + "(" + start_date . strftime ( "%H:%M:%S" ) + ")"
70
72
71
73
engagement_id = dd .create_engagement (engagementText , product_id , str (user_id ),
72
74
"In Progress" , start_date .strftime ("%Y-%m-%d" ), end_date .strftime ("%Y-%m-%d" ))
@@ -83,7 +85,8 @@ def process_findings(dd, engagement_id, dir, build=None):
83
85
return ',' .join (test_ids )
84
86
85
87
def processFiles (dd , engagement_id , file , scanner = None , build = None ):
86
- upload_scan = None
88
+ print ("Processing file" + file )
89
+ upload_scan = None
87
90
scannerName = None
88
91
path = os .path .dirname (file )
89
92
name = os .path .basename (file )
@@ -126,6 +129,8 @@ def processFiles(dd, engagement_id, file, scanner=None, build=None):
126
129
scannerName = "VCG Scan"
127
130
elif tool == "dependency" :
128
131
scannerName = "Dependency Check Scan"
132
+ elif tool == "deptrack" :
133
+ scannerName = "Dependency Track Finding Packaging Format (FPF) Export"
129
134
elif tool == "retirejs" :
130
135
scannerName = "Retire.js Scan"
131
136
elif tool == "nodesecurity" :
@@ -138,12 +143,16 @@ def processFiles(dd, engagement_id, file, scanner=None, build=None):
138
143
scannerName = "OpenVAS CSV"
139
144
elif tool == "snyk" :
140
145
scannerName = "Snyk Scan"
146
+ elif tool == "clair" :
147
+ scannerName = "Clair Scan"
141
148
142
149
if scannerName is not None :
143
150
print "Uploading " + scannerName + " scan: " + file
144
151
test_id = dd .upload_scan (engagement_id , scannerName , file , "true" , dojoDate , build )
145
152
146
- if test_id .success == False :
153
+ if test_id == None :
154
+ print "Upload failed: no scanner for tool: " + tool
155
+ elif test_id .success == False :
147
156
print "Upload failed: Detailed error message: " + test_id .data
148
157
149
158
return test_id
0 commit comments