From 61eddc91bee3de637b24cd560393660a40c245cf Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Fri, 16 Feb 2024 16:25:38 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20set=20upstream=20config=20for=20?= =?UTF-8?q?scans=20(#1122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivan Milchev --- apps/cnspec/cmd/scan.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/cnspec/cmd/scan.go b/apps/cnspec/cmd/scan.go index b1321200..8ba6f591 100644 --- a/apps/cnspec/cmd/scan.go +++ b/apps/cnspec/cmd/scan.go @@ -273,9 +273,8 @@ func getCobraScanConfig(cmd *cobra.Command, runtime *providers.Runtime, cliRes * conf.Inventory.ApplyCategory(inventory.AssetCategory_CATEGORY_CICD) } - var serviceAccount *upstream.ServiceAccountCredentials + serviceAccount := opts.GetServiceCredential() - serviceAccount = opts.GetServiceCredential() // NOTE: even if we have incognito, we want to set the upstream config. Otherwise we would not be able to // use the policies that are defined in Mondoo Platform if serviceAccount != nil { @@ -287,6 +286,7 @@ func getCobraScanConfig(cmd *cobra.Command, runtime *providers.Runtime, cliRes * Incognito: conf.IsIncognito, Creds: serviceAccount, } + providers.DefaultRuntime().UpstreamConfig = conf.runtime.UpstreamConfig } else { log.Warn().Msg("No credentials provided. Switching to --incognito mode.") conf.IsIncognito = true