Skip to content

Commit

Permalink
Use CWE link in HTML formatter (#825)
Browse files Browse the repository at this point in the history
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 <browne@vmware.com>
  • Loading branch information
ericwb committed Feb 25, 2022
1 parent 7fbf9d5 commit 528c540
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bandit/formatters/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
<b>Test ID:</b> {test_id}<br>
<b>Severity: </b>{severity}<br>
<b>Confidence: </b>{confidence}<br>
<b>CWE: </b>{cwe}<br>
<b>File: </b><a href="{path}" target="_blank">{path}</a> <br>
<b>CWE: <a href="{cwe_link}" target="_blank">CWE-{cwe.id}</a><br>
<b>File: </b><a href="{path}" target="_blank">{path}</a><br>
<b>Line number: </b>{line_number}<br>
<b>More info: </b><a href="{url}" target="_blank">{url}</a><br>
{code}
Expand Down Expand Up @@ -367,6 +367,7 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
severity=issue.severity,
confidence=issue.confidence,
cwe=issue.cwe,
cwe_link=issue.cwe.link(),
path=issue.fname,
code=code,
candidates=candidates,
Expand Down

0 comments on commit 528c540

Please sign in to comment.