Skip to content

Commit

Permalink
fix sarif add default configuration set to correct level
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfeidau authored and Cosmin Cojocar committed Jan 22, 2021
1 parent 732f759 commit 3ed39fe
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions output/sarif_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ type sarifProperties struct {
}

type sarifRule struct {
ID string `json:"id"`
Name string `json:"name"`
ShortDescription *sarifMessage `json:"shortDescription"`
FullDescription *sarifMessage `json:"fullDescription"`
Help *sarifMessage `json:"help"`
Properties *sarifProperties `json:"properties"`
ID string `json:"id"`
Name string `json:"name"`
ShortDescription *sarifMessage `json:"shortDescription"`
FullDescription *sarifMessage `json:"fullDescription"`
Help *sarifMessage `json:"help"`
Properties *sarifProperties `json:"properties"`
DefaultConfiguration *sarifConfiguration `json:"defaultConfiguration"`
}

type sarifConfiguration struct {
Level sarifLevel `json:"level"`
}

type sarifArtifactLocation struct {
Expand Down Expand Up @@ -108,6 +113,9 @@ func buildSarifRule(issue *gosec.Issue) *sarifRule {
Properties: &sarifProperties{
Tags: []string{fmt.Sprintf("CWE-%s", issue.Cwe.ID), issue.Severity.String()},
},
DefaultConfiguration: &sarifConfiguration{
Level: getSarifLevel(issue.Severity.String()),
},
}
}

Expand Down

0 comments on commit 3ed39fe

Please sign in to comment.