Skip to content

Commit

Permalink
adding apiVersion to external obj
Browse files Browse the repository at this point in the history
  • Loading branch information
dwertent committed Jan 5, 2022
1 parent 09b627c commit 769b92d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions objectsenvelopes/regoresponsevectorobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import (
// relatedObjects []IMetadata - includes related objects that need to be shown together with failed object
// e.g subjects will have in relatedObjects - role + rolebinding

const RegoAttackVectorGroup string = "regoAttackVector"
const RegoAttackVectorVersion string = "v1"

const RelatedObjectsKey string = "relatedObjects"
const TypeRegoResponseVectorObject workloadinterface.ObjectType = "regoResponse"

Expand Down
2 changes: 2 additions & 0 deletions reporthandling/regoresourcesaggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package reporthandling
import (
"bytes"
"encoding/gob"
"fmt"
"strings"

"github.com/armosec/k8s-interface/k8sinterface"
Expand Down Expand Up @@ -47,6 +48,7 @@ func AggregateResourcesBySubjects(k8sObjects []workloadinterface.IMetadata) ([]w
if err != nil {
return aggregatedK8sObjects, err
}
subjectCopy["apiVersion"] = fmt.Sprintf("%s/%s", objectsenvelopes.RegoAttackVectorGroup, objectsenvelopes.RegoAttackVectorVersion)
subjectCopy[objectsenvelopes.RelatedObjectsKey] = []map[string]interface{}{bindingWorkload.GetObject(), roleWorkload.GetObject()}
newObj := objectsenvelopes.NewRegoResponseVectorObject(subjectCopy)
aggregatedK8sObjects = append(aggregatedK8sObjects, newObj)
Expand Down
2 changes: 1 addition & 1 deletion reporthandling/results/v1/reportsummary/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func calculateStatus(counters *ResourceCounters) apis.ScanningStatus {
if counters.Excluded() != 0 {
return apis.StatusExcluded
}
if counters.All() == 0 {
if counters.All() == counters.Skipped() {
return apis.StatusSkipped
}
return apis.StatusPassed
Expand Down

0 comments on commit 769b92d

Please sign in to comment.