From b8978d99f3a69712c287dd78d38a0e5b3268b2fc Mon Sep 17 00:00:00 2001 From: Simar Date: Sat, 13 Jan 2024 14:27:54 -0700 Subject: [PATCH] fix(checks): Use correct input for AVD-KSV-01010 ```shell 2024-01-13T14:25:34.160-0700 DEBUG [misconf] 25:34.160914000 terraform.scanner.rego Error occurred while parsing: Users/s/Library/Caches/trivy/policy/content/policies/kubernetes/policies/aquacommercial/configmap_with_sensitive.rego, Users/s/Library/Caches/trivy/policy/content/policies/kubernetes/policies/aquacommercial/configmap_with_sensitive.rego:96: rego_type_error: undefined ref: input.data[d] input.data[d] ^ have: "data" want (one of): ["apiVersion" "kind" "metadata" "rules" "spec"] ``` --- Makefile | 16 +++++++++++----- .../aquacommercial/configmap_with_sensitive.rego | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3202bc17..4d351621 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,7 @@ fmt-rego: opa fmt -w rules/ .PHONY: bundle -bundle: - ./scripts/bundle.sh - cp bundle.tar.gz scripts/bundle.tar.gz - go run ./scripts/verify-bundle.go - rm scripts/bundle.tar.gz +bundle: create-bundle verify-bundle .PHONY: id id: @@ -33,3 +29,13 @@ docs: .PHONY: docs-test docs-test: go test -v ./cmd/avd_generator/... + +.PHONY: create-bundle +create-bundle: + ./scripts/bundle.sh + +.PHONY: verify-bundle +verify-bundle: + cp bundle.tar.gz scripts/bundle.tar.gz + go run ./scripts/verify-bundle.go + rm scripts/bundle.tar.gz diff --git a/checks/kubernetes/aquacommercial/configmap_with_sensitive.rego b/checks/kubernetes/aquacommercial/configmap_with_sensitive.rego index 5d4a6cec..5c734c23 100644 --- a/checks/kubernetes/aquacommercial/configmap_with_sensitive.rego +++ b/checks/kubernetes/aquacommercial/configmap_with_sensitive.rego @@ -93,7 +93,7 @@ ConfigMapWithSensitive[sensitiveData] { ConfigMapWithSensitive[sensitiveData] { input.kind == "ConfigMap" - values = split(input.data[d], "\n") + values = split(kubernetes.object.data[d], "\n") val = split(values[v], ":") regex.match(patternForIbanAndPassport[p], val[v]) sensitiveData = d