From 72652d39527b1166877929ce420e8fabd23c5197 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Thu, 24 Feb 2022 19:50:06 -0800 Subject: [PATCH] Use CWE link in HTML formatter 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 --- bandit/formatters/html.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bandit/formatters/html.py b/bandit/formatters/html.py index 48b6ac37f..ff86d8fa4 100644 --- a/bandit/formatters/html.py +++ b/bandit/formatters/html.py @@ -266,8 +266,8 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1): Test ID: {test_id}
Severity: {severity}
Confidence: {confidence}
- CWE: {cwe}
- File: {path}
+ CWE: CWE-{cwe.id}
+ File: {path}
Line number: {line_number}
More info: {url}
{code} @@ -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,