Skip to content

Commit 528c540

Browse files
authored
Use CWE link in HTML formatter (#825)
The CWE link is currently output in plain text. Given this is an HTML outoput formatter, it's only natural to use reference link. Signed-off-by: Eric Brown <[email protected]>
1 parent 7fbf9d5 commit 528c540

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bandit/formatters/html.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
266266
<b>Test ID:</b> {test_id}<br>
267267
<b>Severity: </b>{severity}<br>
268268
<b>Confidence: </b>{confidence}<br>
269-
<b>CWE: </b>{cwe}<br>
270-
<b>File: </b><a href="{path}" target="_blank">{path}</a> <br>
269+
<b>CWE: <a href="{cwe_link}" target="_blank">CWE-{cwe.id}</a><br>
270+
<b>File: </b><a href="{path}" target="_blank">{path}</a><br>
271271
<b>Line number: </b>{line_number}<br>
272272
<b>More info: </b><a href="{url}" target="_blank">{url}</a><br>
273273
{code}
@@ -367,6 +367,7 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
367367
severity=issue.severity,
368368
confidence=issue.confidence,
369369
cwe=issue.cwe,
370+
cwe_link=issue.cwe.link(),
370371
path=issue.fname,
371372
code=code,
372373
candidates=candidates,

0 commit comments

Comments
 (0)