Skip to content

Commit

Permalink
fix: False positive on use of containerd cos image (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamg authored Jun 28, 2022
1 parent 8560a5c commit ad1a4c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/rules/google/gke/node_pool_uses_cos.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gke

import (
"github.com/aquasecurity/defsec/internal/rules"
"github.com/aquasecurity/defsec/internal/types"
"github.com/aquasecurity/defsec/pkg/providers"
"github.com/aquasecurity/defsec/pkg/scan"
"github.com/aquasecurity/defsec/pkg/severity"
Expand Down Expand Up @@ -30,7 +31,7 @@ var CheckNodePoolUsesCos = rules.Register(
func(s *state.State) (results scan.Results) {
for _, cluster := range s.Google.GKE.Clusters {
if cluster.IsManaged() {
if cluster.NodeConfig.ImageType.NotEqualTo("") && cluster.NodeConfig.ImageType.NotEqualTo("COS_CONTAINERD") && cluster.NodeConfig.ImageType.NotEqualTo("COS") {
if cluster.NodeConfig.ImageType.NotEqualTo("") && cluster.NodeConfig.ImageType.NotEqualTo("COS_CONTAINERD", types.IgnoreCase) && cluster.NodeConfig.ImageType.NotEqualTo("COS", types.IgnoreCase) {
results.Add(
"Cluster is not configuring node pools to use the COS containerd image type by default.",
cluster.NodeConfig.ImageType,
Expand All @@ -40,7 +41,7 @@ var CheckNodePoolUsesCos = rules.Register(
}
}
for _, pool := range cluster.NodePools {
if pool.NodeConfig.ImageType.NotEqualTo("COS_CONTAINERD") && pool.NodeConfig.ImageType.NotEqualTo("COS") {
if pool.NodeConfig.ImageType.NotEqualTo("COS_CONTAINERD", types.IgnoreCase) && pool.NodeConfig.ImageType.NotEqualTo("COS", types.IgnoreCase) {
results.Add(
"Node pool is not using the COS containerd image type.",
pool.NodeConfig.ImageType,
Expand Down

0 comments on commit ad1a4c9

Please sign in to comment.