Skip to content

Commit

Permalink
Remove severties error
Browse files Browse the repository at this point in the history
  • Loading branch information
kooomix committed Sep 5, 2023
1 parent 242f8d4 commit 7a73855
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions attackchains/attackchainutils.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package attackchains

import (
"fmt"
"strings"
"time"

Expand Down Expand Up @@ -73,9 +72,10 @@ func isVulnerableRelevantToAttackChain(vul *cscanlib.CommonContainerScanSummaryR
return true, nil
}

if vul.SeveritiesStats == nil || len(vul.SeveritiesStats) == 0 {
return false, fmt.Errorf("Vulnerability '%s' has no severity stats", vul.WLID)
}
// TODO: figure out how to handle empty severity stats
// if vul.SeveritiesStats == nil || len(vul.SeveritiesStats) == 0 {
// return false, fmt.Errorf("Vulnerability '%s' has no severity stats", vul.WLID)
// }

for _, stat := range vul.SeveritiesStats {
if stat.Severity == "Critical" && stat.TotalCount > 0 {
Expand Down
20 changes: 10 additions & 10 deletions attackchains/attackchainutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ func TestIsVulnarableRelevantToAttackChange(t *testing.T) {
expected: true,
wantErr: false,
},
{
name: "relevant but no severity stats - should return error",
vul: &cscanlib.CommonContainerScanSummaryResult{
ImageID: "ss",
HasRelevancyData: true,
RelevantLabel: "yes",
},
expected: false,
wantErr: true,
},
// {
// name: "relevant but no severity stats - should return error",
// vul: &cscanlib.CommonContainerScanSummaryResult{
// ImageID: "ss",
// HasRelevancyData: true,
// RelevantLabel: "yes",
// },
// expected: false,
// wantErr: true,
// },
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/armosec/utils-go
go 1.19

require (
github.com/armosec/armoapi-go v0.0.234
github.com/armosec/armoapi-go v0.0.245
github.com/google/uuid v1.3.0
github.com/kubescape/opa-utils v0.0.255
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/armosec/armoapi-go v0.0.234 h1:OFbiKU/bZBWbg8tb3BCNjm1+7UwSIBrS1VUSJxvG3Nc=
github.com/armosec/armoapi-go v0.0.234/go.mod h1:Y1ZcqPUTQ+F8JiQzErrToK5ULrPvClxZoshHmV9PIlU=
github.com/armosec/armoapi-go v0.0.245 h1:MhJLNF1QLqYOl1+/TNLkkMNL1ppeShjtesFic0cHBvs=
github.com/armosec/armoapi-go v0.0.245/go.mod h1:LKoj8FCbTKifhpBzRg3AT+rXYR6kxWwv6w39QU01FKw=
github.com/armosec/gojay v1.2.15 h1:sSB2vnAvacUNkw9nzUYZKcPzhJOyk6/5LK2JCNdmoZY=
github.com/armosec/gojay v1.2.15/go.mod h1:vzVAaay2TWJAngOpxu8aqLbye9jMgoKleuAOK+xsOts=
github.com/armosec/utils-k8s-go v0.0.16 h1:h46PoxAb4OHA2p719PzcAS03lADw4lH4TyRMaZ3ix/g=
Expand Down

0 comments on commit 7a73855

Please sign in to comment.