Skip to content

Commit 1e5412f

Browse files
authored
Merge pull request #4001 from DefectDojo/release/1.13.2
Release: Merge release into master from: release/1.13.2
2 parents a771632 + 537b416 commit 1e5412f

File tree

17 files changed

+14095
-82
lines changed

17 files changed

+14095
-82
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767

6868
# phased startup so we can use the exit code from unit test container
6969
- name: Start MySQL
70-
run: docker-compose up -d
70+
run: docker-compose up --no-deps -d mysql
7171

7272
# no celery or initializer needed for unit tests
7373
- name: Unit tests

components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DefectDojo",
3-
"version": "1.13.1",
3+
"version": "1.13.2",
44
"dependencies": {
55
"JUMFlot": "jumjum123/JUMFlot#*",
66
"bootstrap": "^3.4.0",

dojo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
default_app_config = 'dojo.apps.DojoAppConfig'
88

9-
__version__ = '1.13.1'
9+
__version__ = '1.13.2'
1010
__url__ = 'https://github.com/DefectDojo/django-DefectDojo'
1111
__docs__ = 'http://defectdojo.readthedocs.io/'

dojo/settings/settings.dist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
863863
'Trivy Scan': DEDUPE_ALGO_HASH_CODE,
864864
'HackerOne Cases': DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR_HASH_CODE,
865865
'Snyk Scan': DEDUPE_ALGO_HASH_CODE,
866+
'Safety Scan': DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL,
866867
}
867868

868869
DUPE_DELETE_MAX_PER_RUN = env('DD_DUPE_DELETE_MAX_PER_RUN')

dojo/tools/nessus/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ def get_description_for_scan_types(self, scan_type):
253253
def get_findings(self, filename, test):
254254

255255
if filename.name.lower().endswith('.xml'):
256-
return list(NessusXMLParser().parse(filename, test).values())
256+
return NessusXMLParser().get_findings(filename, test)
257257
elif filename.name.lower().endswith('.csv'):
258-
return list(NessusCSVParser().parse(filename, test).values())
258+
return NessusCSVParser().get_findings(filename, test)
259259
else:
260260
raise ValueError('Unknown File Format')

dojo/tools/openvas_csv/parser.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def map_column_value(self, finding, column_value):
144144

145145
finding.unsaved_endpoints = endpoints
146146

147+
# FIXME manage port and protocole event if it's an IP address
147148
# URL is an IP so save as an IP endpoint
148149
elif self.is_valid_ipv4_address(url):
149150
try:
@@ -317,12 +318,10 @@ def get_findings(self, filename, test):
317318
dupes = dict()
318319
chain = self.create_chain()
319320

320-
if filename is None:
321-
return ()
322-
323-
content = open(filename.temporary_file_path(), 'rb')
324-
reportCSV = io.TextIOWrapper(content, encoding='utf-8 ', errors='replace')
325-
reader = csv.reader(reportCSV, delimiter=',', quotechar='"')
321+
content = filename.read()
322+
if type(content) is bytes:
323+
content = content.decode('utf-8')
324+
reader = csv.reader(io.StringIO(content), delimiter=',', quotechar='"')
326325

327326
row_number = 0
328327
for row in reader:
@@ -335,7 +334,7 @@ def get_findings(self, filename, test):
335334

336335
column_number = 0
337336
for column in row:
338-
self.chain.process_column(self.column_names[column_number], column, finding)
337+
chain.process_column(column_names[column_number], column, finding)
339338
column_number += 1
340339

341340
if finding is not None and row_number > 0:

dojo/tools/safety/parser.py

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,73 +18,63 @@ def get_label_for_scan_types(self, scan_type):
1818
def get_description_for_scan_types(self, scan_type):
1919
return "Safety scan (--json) output file can be imported in JSON format."
2020

21-
def get_findings(self, json_output, test):
22-
23-
# Grab Safety DB for CVE lookup
21+
def get_safetydb(self):
22+
"""Grab Safety DB for CVE lookup"""
2423
url = "https://raw.githubusercontent.com/pyupio/safety-db/master/data/insecure_full.json"
2524
try:
2625
response = urllib.request.urlopen(url)
27-
safety_db = json.loads(response.read().decode('utf-8'))
26+
return json.load(response)
2827
except urllib.error.URLError as e:
2928
logger.warn("Error Message: %s", e)
3029
logger.warn("Could not resolve %s. Fallback is using the offline version from dojo/tools/safety/insecure_full.json.", url)
31-
with open("dojo/tools/safety/insecure_full.json", "r") as f:
32-
safety_db = json.load(f)
33-
f.close()
30+
with open("dojo/tools/safety/insecure_full.json", "r") as insecure_full:
31+
return json.load(insecure_full)
3432

35-
tree = self.parse_json(json_output)
36-
return self.get_items(tree, test, safety_db)
33+
def get_findings(self, json_output, test):
34+
safety_db = self.get_safetydb()
3735

38-
def parse_json(self, json_output):
39-
data = json_output.read() or '[]'
40-
try:
41-
json_obj = json.loads(str(data, 'utf-8'))
42-
except:
43-
json_obj = json.loads(data)
44-
tree = {l[4]: {'package': str(l[0]),
45-
'affected': str(l[1]),
46-
'installed': str(l[2]),
47-
'description': str(l[3]),
48-
'id': str(l[4])}
49-
for l in json_obj} # noqa: E741
50-
return tree
36+
tree = json.load(json_output)
5137

52-
def get_items(self, tree, test, safety_db):
5338
items = {}
54-
55-
for key, node in tree.items():
56-
item = get_item(node, test, safety_db)
57-
items[key] = item
39+
for node in tree:
40+
item_node = {
41+
'package': str(node[0]),
42+
'affected': str(node[1]),
43+
'installed': str(node[2]),
44+
'description': str(node[3]),
45+
'id': str(node[4])
46+
}
47+
severity = 'Medium' # Because Safety doesn't include severity rating
48+
cve = None
49+
for a in safety_db[item_node['package']]:
50+
if a['id'] == 'pyup.io-' + item_node['id']:
51+
if a['cve']:
52+
cve = a['cve']
53+
title = item_node['package'] + " (" + item_node['affected'] + ")"
54+
55+
finding = Finding(title=title + " | " + cve if cve else title,
56+
test=test,
57+
severity=severity,
58+
description="**Description:** " + item_node['description'] +
59+
"\n**Vulnerable Package:** " + item_node['package'] +
60+
"\n**Installed Version:** " + item_node['installed'] +
61+
"\n**Vulnerable Versions:** " + item_node['affected'] +
62+
"\n**CVE:** " + (cve or "N/A") +
63+
"\n**ID:** " + item_node['id'],
64+
cve=cve,
65+
cwe=1035, # Vulnerable Third Party Component
66+
mitigation="No mitigation provided",
67+
references="No reference provided",
68+
active=False,
69+
verified=False,
70+
false_p=False,
71+
duplicate=False,
72+
out_of_scope=False,
73+
mitigated=None,
74+
impact="No impact provided",
75+
component_name=item_node['package'],
76+
component_version=item_node['installed'],
77+
unique_id_from_tool=item_node['id'])
78+
items[finding.unique_id_from_tool] = finding
5879

5980
return list(items.values())
60-
61-
62-
def get_item(item_node, test, safety_db):
63-
severity = 'Info' # Because Safety doesn't include severity rating
64-
cve = ''.join(a['cve'] or ''
65-
for a in safety_db[item_node['package']]
66-
if a['id'] == 'pyup.io-' + item_node['id']) or None
67-
title = item_node['package'] + " (" + item_node['affected'] + ")"
68-
69-
finding = Finding(title=title + " | " + cve if cve else title,
70-
test=test,
71-
severity=severity,
72-
description=item_node['description'] +
73-
"\n Vulnerable Package: " + item_node['package'] +
74-
"\n Installed Version: " + item_node['installed'] +
75-
"\n Vulnerable Versions: " + item_node['affected'] +
76-
"\n CVE: " + (cve or "N/A") +
77-
"\n ID: " + item_node['id'],
78-
cve=cve,
79-
cwe=1035, # Vulnerable Third Party Component
80-
mitigation="No mitigation provided",
81-
references="No reference provided",
82-
active=False,
83-
verified=False,
84-
false_p=False,
85-
duplicate=False,
86-
out_of_scope=False,
87-
mitigated=None,
88-
impact="No impact provided")
89-
90-
return finding

dojo/unittests/scans/nessus/nessus_v_unknown.xml

Lines changed: 13894 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
IP,Hostname,Port,Port Protocol,CVSS,Severity,Solution Type,NVT Name,Summary,Specific Result,NVT OID,CVEs,Task ID,Task Name,Timestamp,Result ID,Impact,Solution,Affected Software/OS,Vulnerability Insight,Vulnerability Detection Method,Product Detection Result,BIDs,CERTs,Other References
2+
10.0.0.8,,22,tcp,4.3,Medium,Mitigation,SSH Weak Encryption Algorithms Supported,The remote SSH server is configured to allow weak encryption algorithms.,"The following weak client-to-server encryption algorithms are supported by the remote service:
3+
4+
aes128-cbc
5+
aes256-cbc
6+
7+
8+
The following weak server-to-client encryption algorithms are supported by the remote service:
9+
10+
aes128-cbc
11+
aes256-cbc
12+
13+
14+
15+
",1.3.6.1.4.1.25623.1.0.105611,,c122f831-2481-46d3-97e7-9755e5eeca30,test,2021-02-25T20:01:27Z,ad08dbdb-0d0a-4216-9e09-f5d2f44c1cb9,,Disable the weak encryption algorithms.,,"The `arcfour` cipher is the Arcfour stream cipher with 128-bit keys.
16+
The Arcfour cipher is believed to be compatible with the RC4 cipher [SCHNEIER]. Arcfour (and RC4) has problems
17+
with weak keys, and should not be used anymore.
18+
19+
The `none` algorithm specifies that no encryption is to be done.
20+
Note that this method provides no confidentiality protection, and it
21+
is NOT RECOMMENDED to use it.
22+
23+
A vulnerability exists in SSH messages that employ CBC mode that may allow an attacker to recover plaintext from a block of ciphertext.","Check if remote ssh service supports Arcfour, none or CBC ciphers.
24+
Details:
25+
SSH Weak Encryption Algorithms Supported
26+
(OID: 1.3.6.1.4.1.25623.1.0.105611)
27+
Version used: 2020-08-24T08:40:10Z
28+
",,,,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

0 commit comments

Comments
 (0)