Skip to content

Commit 09a2941

Browse files
committed
Use the CWE name as a name in the SARIF report
1 parent 9399e7b commit 09a2941

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

report/sarif/formatter.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,14 @@ func GenerateReport(rootPaths []string, data *gosec.ReportInfo) (*Report, error)
7171

7272
// parseSarifRule return SARIF rule field struct
7373
func parseSarifRule(issue *gosec.Issue) *ReportingDescriptor {
74+
cwe := gosec.GetCweByRule(issue.RuleID)
75+
name := issue.RuleID
76+
if cwe != nil {
77+
name = cwe.Name
78+
}
7479
return &ReportingDescriptor{
7580
ID: issue.RuleID,
76-
Name: issue.What,
81+
Name: name,
7782
ShortDescription: NewMultiformatMessageString(issue.What),
7883
FullDescription: NewMultiformatMessageString(issue.What),
7984
Help: NewMultiformatMessageString(fmt.Sprintf("%s\nSeverity: %s\nConfidence: %s\n",

0 commit comments

Comments
 (0)