mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
fix sarif add default configuration set to correct level
This commit is contained in:
parent
732f759e4f
commit
3ed39fe612
1 changed files with 14 additions and 6 deletions
|
@ -21,12 +21,17 @@ type sarifProperties struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type sarifRule struct {
|
type sarifRule struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ShortDescription *sarifMessage `json:"shortDescription"`
|
ShortDescription *sarifMessage `json:"shortDescription"`
|
||||||
FullDescription *sarifMessage `json:"fullDescription"`
|
FullDescription *sarifMessage `json:"fullDescription"`
|
||||||
Help *sarifMessage `json:"help"`
|
Help *sarifMessage `json:"help"`
|
||||||
Properties *sarifProperties `json:"properties"`
|
Properties *sarifProperties `json:"properties"`
|
||||||
|
DefaultConfiguration *sarifConfiguration `json:"defaultConfiguration"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type sarifConfiguration struct {
|
||||||
|
Level sarifLevel `json:"level"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type sarifArtifactLocation struct {
|
type sarifArtifactLocation struct {
|
||||||
|
@ -108,6 +113,9 @@ func buildSarifRule(issue *gosec.Issue) *sarifRule {
|
||||||
Properties: &sarifProperties{
|
Properties: &sarifProperties{
|
||||||
Tags: []string{fmt.Sprintf("CWE-%s", issue.Cwe.ID), issue.Severity.String()},
|
Tags: []string{fmt.Sprintf("CWE-%s", issue.Cwe.ID), issue.Severity.String()},
|
||||||
},
|
},
|
||||||
|
DefaultConfiguration: &sarifConfiguration{
|
||||||
|
Level: getSarifLevel(issue.Severity.String()),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue