From 1236401adfa30e78e3e0eac9c050f66be6d04400 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Fri, 12 Jan 2024 17:22:34 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20remove=20share=20report=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cnspec/cmd/config/config.go | 3 --- apps/cnspec/cmd/scan.go | 23 ----------------------- test/cli/testdata/cnspec.ct | 4 +--- test/cli/testdata/cnspec_scan.ct | 1 - 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/apps/cnspec/cmd/config/config.go b/apps/cnspec/cmd/config/config.go index 18dca3d3..622b97b9 100644 --- a/apps/cnspec/cmd/config/config.go +++ b/apps/cnspec/cmd/config/config.go @@ -27,7 +27,4 @@ type CliConfig struct { // Asset Category Category string `json:"category,omitempty" mapstructure:"category"` AutoDetectCICDCategory bool `json:"detect-cicd,omitempty" mapstructure:"detect-cicd"` - - // Configure report sharing - ShareReport *bool `json:"share_report,omitempty" mapstructure:"share_report"` } diff --git a/apps/cnspec/cmd/scan.go b/apps/cnspec/cmd/scan.go index 087ad943..3bc78b3d 100644 --- a/apps/cnspec/cmd/scan.go +++ b/apps/cnspec/cmd/scan.go @@ -27,7 +27,6 @@ import ( "go.mondoo.com/cnspec/v10/cli/reporter" "go.mondoo.com/cnspec/v10/policy" "go.mondoo.com/cnspec/v10/policy/scan" - policy_upstream "go.mondoo.com/cnspec/v10/policy/upstream" ) const ( @@ -63,7 +62,6 @@ func init() { scanCmd.Flags().String("category", "inventory", "Set the category for the assets to 'inventory|cicd'.") scanCmd.Flags().MarkHidden("category") scanCmd.Flags().Int("score-threshold", 0, "If any score falls below the threshold, exit 1.") - scanCmd.Flags().Bool("share", false, "create a web-based private reports when cnspec is unauthenticated. Defaults to false.") scanCmd.Flags().String("output-target", "", "Set output target to which the asset report will be sent. Currently only supports AWS SQS topic URLs and local files") } @@ -101,7 +99,6 @@ To manually configure a policy, use this: viper.BindPFlag("asset-name", cmd.Flags().Lookup("asset-name")) viper.BindPFlag("category", cmd.Flags().Lookup("category")) viper.BindPFlag("score-threshold", cmd.Flags().Lookup("score-threshold")) - viper.BindPFlag("share", cmd.Flags().Lookup("share")) // for all assets viper.BindPFlag("incognito", cmd.Flags().Lookup("incognito")) @@ -157,26 +154,6 @@ var scanCmdRun = func(cmd *cobra.Command, runtime *providers.Runtime, cliRes *pl log.Fatal().Err(err).Msg("failed to write report to output target") } - var shareReport bool - if viper.IsSet("share") { - shareReportFlag := viper.GetBool("share") - shareReport = shareReportFlag - } - - // if report sharing was requested, share the report and print the URL - if conf.IsIncognito && shareReport { - proxy, err := config.GetAPIProxy() - if err != nil { - log.Error().Err(err).Msg("error getting proxy information") - } else { - reportId, err := policy_upstream.UploadSharedReport(report, os.Getenv(featureReportAlternateUrlEnv), proxy) - if err != nil { - log.Fatal().Err(err).Msg("could not upload report results") - } - fmt.Printf("View report at %s\n", reportId.Url) - } - } - // if we had asset errors, we return a non-zero exit code // asset errors are only connection issues if report != nil { diff --git a/test/cli/testdata/cnspec.ct b/test/cli/testdata/cnspec.ct index 2fbaee8e..ff0910c3 100644 --- a/test/cli/testdata/cnspec.ct +++ b/test/cli/testdata/cnspec.ct @@ -25,6 +25,7 @@ Available Commands: status Verify access to Mondoo Platform. vault Manage vault environments. version Display the cnspec version. + vuln Scans a target for Vulnerabilities. Flags: --api-proxy string Set proxy for communications with Mondoo API @@ -34,7 +35,4 @@ Flags: --log-level string Set log level: error, warn, info, debug, trace (default "info") -v, --verbose Enable verbose output -Additional help topics: - cnspec vuln Scans a target for Vulnerabilities. - Use "cnspec [command] --help" for more information about a command. diff --git a/test/cli/testdata/cnspec_scan.ct b/test/cli/testdata/cnspec_scan.ct index c9ab8b5c..d30304ac 100644 --- a/test/cli/testdata/cnspec_scan.ct +++ b/test/cli/testdata/cnspec_scan.ct @@ -32,7 +32,6 @@ Flags: -f, --policy-bundle strings Path to local policy file --props stringToString Custom values for properties (default []) --score-threshold int If any score falls below the threshold, exit 1. - --share create a web-based private reports when cnspec is unauthenticated. Defaults to false. Global Flags: --api-proxy string Set proxy for communications with Mondoo API