fix sarif add default configuration set to correct level

This commit is contained in:
Mark Wolfe 2021-01-22 20:15:52 +11:00 committed by Cosmin Cojocar
parent 732f759e4f
commit 3ed39fe612

View file

@ -27,6 +27,11 @@ type sarifRule struct {
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 {
@ -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()),
},
}
}