Skip to content

Commit

Permalink
rename disallowedSeverity to disallowedSeverities
Browse files Browse the repository at this point in the history
  • Loading branch information
akashsinghal committed Nov 30, 2023
1 parent d88e13e commit 497c82e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
artifactTypes: application/sarif+json
parameters:
maximumAge: 24h
disallowedSeverity:
disallowedSeverities:
- high
- critical
denylistCVEs:
Expand Down
10 changes: 5 additions & 5 deletions plugins/verifier/vulnerabilityreport/vulnerability_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type PluginConfig struct {
SchemaURL string `json:"schemaURL,omitempty"`
CreatedAnnotationName string `json:"createdAnnotationName,omitempty"`
MaximumAge string `json:"maximumAge,omitempty"`
DisallowedSeverity []string `json:"disallowedSeverity,omitempty"`
DisallowedSeverities []string `json:"disallowedSeverities,omitempty"`
Passthrough bool `json:"passthrough,omitempty"`
DenylistCVEs []string `json:"denylistCVEs,omitempty"`
}
Expand Down Expand Up @@ -250,8 +250,8 @@ func processSarifReport(input *PluginConfig, verifierName string, blob []byte, c
return verifierReport, nil
}
}
if len(input.DisallowedSeverity) > 0 {
verifierReport, err := verifyDisallowedSeverities(input.Name, scannerName, sarifReport, input.DisallowedSeverity, createdTime)
if len(input.DisallowedSeverities) > 0 {
verifierReport, err := verifyDisallowedSeverities(input.Name, scannerName, sarifReport, input.DisallowedSeverities, createdTime)
if err != nil {
return nil, err
}

Check warning on line 257 in plugins/verifier/vulnerabilityreport/vulnerability_report.go

View check run for this annotation

Codecov / codecov/patch

plugins/verifier/vulnerabilityreport/vulnerability_report.go#L256-L257

Added lines #L256 - L257 were not covered by tests
Expand Down Expand Up @@ -332,7 +332,7 @@ func verifyDenyListCVEs(verifierName string, scannerName string, sarifReport *sa
}

// verifyDisallowedSeverities verifies that the report does not contain any disallowed severity levels
func verifyDisallowedSeverities(verifierName string, scannerName string, sarifReport *sarif.Report, disallowedSeverity []string, createdTime time.Time) (*verifier.VerifierResult, error) {
func verifyDisallowedSeverities(verifierName string, scannerName string, sarifReport *sarif.Report, disallowedSeverities []string, createdTime time.Time) (*verifier.VerifierResult, error) {
ruleMap := make(map[string]*sarif.ReportingDescriptor)
violatingRules := make([]sarif.ReportingDescriptor, 0)
// create a map of rule id to rule for easy lookup
Expand Down Expand Up @@ -377,7 +377,7 @@ func verifyDisallowedSeverities(verifierName string, scannerName string, sarifRe
}, nil
}
// check if the severity is disallowed and add it to the list of violating rules
for _, disallowed := range disallowedSeverity {
for _, disallowed := range disallowedSeverities {
if strings.EqualFold(severity, disallowed) {
violatingRules = append(violatingRules, *rule)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func TestProcessSarifReport(t *testing.T) {
input: PluginConfig{
Name: "test_verifier",
DenylistCVEs: []string{"CVE-2022-48174"},
DisallowedSeverity: []string{
DisallowedSeverities: []string{
"critical",
},
},
Expand All @@ -384,7 +384,7 @@ func TestProcessSarifReport(t *testing.T) {
input: PluginConfig{
Name: "test_verifier",
DenylistCVEs: []string{"CVE-2022-48174"},
DisallowedSeverity: []string{
DisallowedSeverities: []string{
"high",
},
},
Expand Down

0 comments on commit 497c82e

Please sign in to comment.