Skip to content

Commit 43ba034

Browse files
namloc2001mtcolman
andauthored
Add Clair and DepTrack scanner (#41)
Co-authored-by: Matt Colman <MTCOLMAN@uk.ibm.com>
1 parent f7404a1 commit 43ba034

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

examples/dojo_ci_cd.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python
2+
13
"""
24
Example written by Aaron Weaver <aaron.weaver@owasp.org>
35
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):
6668
dojoTime = start_date.strftime("%H:%M:%S")
6769
engagementText = "CI/CD Integration (" + dojoTime + ")"
6870
if build_id is not None:
69-
engagementText = engagementText + " - Build #" + build_id
71+
engagementText = engagementText + " - Build #" + build_id + "(" + start_date.strftime("%H:%M:%S") + ")"
7072

7173
engagement_id = dd.create_engagement(engagementText, product_id, str(user_id),
7274
"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):
8385
return ','.join(test_ids)
8486

8587
def processFiles(dd, engagement_id, file, scanner=None, build=None):
86-
upload_scan = None
88+
print("Processing file" + file)
89+
upload_scan = None
8790
scannerName = None
8891
path=os.path.dirname(file)
8992
name = os.path.basename(file)
@@ -126,6 +129,8 @@ def processFiles(dd, engagement_id, file, scanner=None, build=None):
126129
scannerName = "VCG Scan"
127130
elif tool == "dependency":
128131
scannerName = "Dependency Check Scan"
132+
elif tool == "deptrack":
133+
scannerName = "Dependency Track Finding Packaging Format (FPF) Export"
129134
elif tool == "retirejs":
130135
scannerName = "Retire.js Scan"
131136
elif tool == "nodesecurity":
@@ -138,12 +143,16 @@ def processFiles(dd, engagement_id, file, scanner=None, build=None):
138143
scannerName = "OpenVAS CSV"
139144
elif tool == "snyk":
140145
scannerName = "Snyk Scan"
146+
elif tool == "clair":
147+
scannerName = "Clair Scan"
141148

142149
if scannerName is not None:
143150
print "Uploading " + scannerName + " scan: " + file
144151
test_id = dd.upload_scan(engagement_id, scannerName, file, "true", dojoDate, build)
145152

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:
147156
print "Upload failed: Detailed error message: " + test_id.data
148157

149158
return test_id

0 commit comments

Comments
 (0)