Skip to content

Commit

Permalink
Use the CWE name as a name in the SARIF report
Browse files Browse the repository at this point in the history
  • Loading branch information
ccojocar committed Jan 27, 2022
1 parent 9399e7b commit 09a2941
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion report/sarif/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@ func GenerateReport(rootPaths []string, data *gosec.ReportInfo) (*Report, error)

// parseSarifRule return SARIF rule field struct
func parseSarifRule(issue *gosec.Issue) *ReportingDescriptor {
cwe := gosec.GetCweByRule(issue.RuleID)
name := issue.RuleID
if cwe != nil {
name = cwe.Name
}
return &ReportingDescriptor{
ID: issue.RuleID,
Name: issue.What,
Name: name,
ShortDescription: NewMultiformatMessageString(issue.What),
FullDescription: NewMultiformatMessageString(issue.What),
Help: NewMultiformatMessageString(fmt.Sprintf("%s\nSeverity: %s\nConfidence: %s\n",
Expand Down

0 comments on commit 09a2941

Please sign in to comment.