Skip to content

Commit 3396e7b

Browse files
🎉 add Dawnscanner fix_available field. (#13660)
* 🎉 Advance Dawnscanner with fix_available * update
1 parent c7432c1 commit 3396e7b

File tree

3 files changed

+14
-25
lines changed

3 files changed

+14
-25
lines changed

dojo/tools/dawnscanner/parser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def get_findings(self, filename, test):
3030
if item["message"][0:2] != "b,"
3131
else item["message"][0:-1]
3232
)
33-
3433
finding = Finding(
3534
title=item["name"],
3635
test=test,
@@ -42,6 +41,10 @@ def get_findings(self, filename, test):
4241
static_finding=True,
4342
dynamic_finding=False,
4443
)
44+
if item.get("remediation"):
45+
finding.fix_available = True
46+
else:
47+
finding.fix_available = False
4548

4649
if self.CVE_REGEX.match(item["name"]):
4750
finding.unsaved_vulnerability_ids = [

unittests/scans/dawnscanner/dawnscanner_v1.6.9.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"severity": "info",
3232
"cvss_score": " ",
3333
"message": "Ruby on Rails has specific, built in support for CSRF tokens. To enable it, or ensure that it is enabled, find the base ApplicationController and look for the protect_from_forgery directive. Note that by default Rails does not provide CSRF protection for any HTTP GET request.",
34-
"remediation": "Make sure you are using Rails protect_from_forgery facilities in application_controller.rMake sure you are using Rails protect_from_forgery facilities in application_controller.rb"
34+
"remediation": ""
3535
}, {
3636
"name": "Owasp Ror CheatSheet: Security Related Headers",
3737
"cve_link": "http://cve.mitre.org/cgi-bin/cvename.cgi?name=Owasp Ror CheatSheet: Security Related Headers",

unittests/tools/test_dawnscanner_parser.py

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,24 @@ def test_burp_with_one_vuln_has_one_finding(self):
1313
for finding in findings:
1414
for endpoint in finding.unsaved_endpoints:
1515
endpoint.clean()
16-
1716
self.assertEqual(4, len(findings))
18-
1917
with self.subTest(i=0):
2018
finding = findings[0]
2119
self.assertEqual("CVE-2016-6316", finding.title)
2220
self.assertEqual("Medium", finding.severity)
2321
self.assertEqual(1, len(finding.unsaved_vulnerability_ids))
2422
self.assertEqual("CVE-2016-6316", finding.unsaved_vulnerability_ids[0])
25-
self.assertEqual(
26-
'Text declared as "HTML safe" when passed as an attribute value to a tag helper will not have quotes escaped which can lead to an XSS attack.',
27-
finding.description,
28-
)
29-
self.assertEqual(
30-
datetime.datetime(2019, 4, 1, 21, 14, 32, tzinfo=datetime.timezone(datetime.timedelta(seconds=0))),
31-
finding.date,
32-
) # 2019-04-01 21:14:32 +0000
33-
23+
self.assertEqual(finding.description, 'Text declared as "HTML safe" when passed as an attribute value to a tag helper will not have quotes escaped which can lead to an XSS attack.')
24+
self.assertEqual(datetime.datetime(2019, 4, 1, 21, 14, 32, tzinfo=datetime.timezone(datetime.timedelta(seconds=0))), finding.date) # 2019-04-01 21:14:32 +0000
25+
with self.subTest(i=2):
26+
finding = findings[2]
27+
self.assertEqual(False, finding.fix_available)
3428
with self.subTest(i=3):
3529
finding = findings[3]
3630
self.assertEqual("Owasp Ror CheatSheet: Security Related Headers", finding.title)
3731
self.assertEqual("Info", finding.severity)
3832
self.assertIsNone(finding.unsaved_vulnerability_ids)
39-
self.assertEqual(
40-
'To set a header value, simply access the response.headers object as a hash inside your controller (often in a before/after_filter). Rails 4 provides the "default_headers" functionality that will automatically apply the values supplied. This works for most headers in almost all cases.',
41-
finding.description,
42-
)
43-
self.assertEqual(
44-
"Use response headers like X-Frame-Options, X-Content-Type-Options, X-XSS-Protection in your project.",
45-
finding.mitigation,
46-
)
47-
self.assertEqual(
48-
datetime.datetime(2019, 4, 1, 21, 14, 32, tzinfo=datetime.timezone(datetime.timedelta(seconds=0))),
49-
finding.date,
50-
) # 2019-04-01 21:14:32 +0000
33+
self.assertEqual(finding.description, 'To set a header value, simply access the response.headers object as a hash inside your controller (often in a before/after_filter). Rails 4 provides the "default_headers" functionality that will automatically apply the values supplied. This works for most headers in almost all cases.')
34+
self.assertEqual("Use response headers like X-Frame-Options, X-Content-Type-Options, X-XSS-Protection in your project.", finding.mitigation)
35+
self.assertEqual(datetime.datetime(2019, 4, 1, 21, 14, 32, tzinfo=datetime.timezone(datetime.timedelta(seconds=0))), finding.date) # 2019-04-01 21:14:32 +0000
36+
self.assertEqual(True, finding.fix_available)

0 commit comments

Comments
 (0)