From ba78527c80431da8b63fb787f6f95a2853d7fa7f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 16:32:43 +0000 Subject: [PATCH] Enable ScanAll for prometheus metrics to include all frameworks including CIS Co-authored-by: matthyx <20683409+matthyx@users.noreply.github.com> --- httphandler/handlerequests/v1/prometheus.go | 5 ++--- httphandler/handlerequests/v1/prometheus_test.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/httphandler/handlerequests/v1/prometheus.go b/httphandler/handlerequests/v1/prometheus.go index a96ba253..c0fdef21 100644 --- a/httphandler/handlerequests/v1/prometheus.go +++ b/httphandler/handlerequests/v1/prometheus.go @@ -12,7 +12,6 @@ import ( "github.com/kubescape/go-logger/helpers" "github.com/kubescape/kubescape/v3/core/cautils" "github.com/kubescape/kubescape/v3/core/cautils/getter" - apisv1 "github.com/kubescape/opa-utils/httpserver/apis/v1" utilsapisv1 "github.com/kubescape/opa-utils/httpserver/apis/v1" utilsmetav1 "github.com/kubescape/opa-utils/httpserver/meta/v1" "go.opentelemetry.io/otel/trace" @@ -76,12 +75,12 @@ func getPrometheusDefaultScanCommand(scanID, resultsFile string) *cautils.ScanIn scanInfo.Local = true // do not submit results every scan scanInfo.FrameworkScan = true scanInfo.HostSensorEnabled.SetBool(false) // disable host scanner - scanInfo.ScanAll = false // do not scan all frameworks + scanInfo.ScanAll = true // scan all available frameworks (including CIS) scanInfo.ScanID = scanID // scan ID scanInfo.FailThreshold = 100 // Do not fail scanning scanInfo.ComplianceThreshold = 0 // Do not fail scanning scanInfo.Output = resultsFile // results output scanInfo.Format = envToString("KS_FORMAT", "prometheus") // default output should be json - scanInfo.SetPolicyIdentifiers(getter.NativeFrameworks, apisv1.KindFramework) + // Framework identifiers will be set dynamically by the scan process when ScanAll is true return scanInfo } diff --git a/httphandler/handlerequests/v1/prometheus_test.go b/httphandler/handlerequests/v1/prometheus_test.go index ca1953f5..a25b37c4 100644 --- a/httphandler/handlerequests/v1/prometheus_test.go +++ b/httphandler/handlerequests/v1/prometheus_test.go @@ -19,7 +19,7 @@ func TestGetPrometheusDefaultScanCommand(t *testing.T) { assert.False(t, scanInfo.Submit) assert.True(t, scanInfo.Local) assert.True(t, scanInfo.FrameworkScan) - assert.False(t, scanInfo.ScanAll) + assert.True(t, scanInfo.ScanAll) // Changed to true to scan all available frameworks assert.False(t, scanInfo.HostSensorEnabled.GetBool()) assert.Equal(t, getter.DefaultLocalStore, scanInfo.UseArtifactsFrom) }