Skip to content

Commit

Permalink
🧹 remove share report flag (#1043)
Browse files Browse the repository at this point in the history
* 🧹 remove share report flag

* 🧹 remove unused proto files
  • Loading branch information
chris-rock authored Jan 15, 2024
1 parent 7e1965c commit f345d22
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 698 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ prep/tools:

# 🌙 cnspec #

cnspec/generate: clean/proto cli/generate policy/generate upstream/generate
cnspec/generate: clean/proto cli/generate policy/generate

.PHONY: cli
cli/generate:
Expand All @@ -76,12 +76,8 @@ cli/generate:
policy/generate:
go generate ./policy
go generate ./policy/scan
go generate ./policy/upstream
go generate ./internal/bundle/yacit

upstream/generate:
go generate ./upstream

# 🏗 Binary #

.PHONY: cnspec/build
Expand Down
3 changes: 0 additions & 3 deletions apps/cnspec/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
23 changes: 0 additions & 23 deletions apps/cnspec/cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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")
}

Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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 {
Expand Down
169 changes: 0 additions & 169 deletions policy/upstream/reporting_upstream.pb.go

This file was deleted.

18 changes: 0 additions & 18 deletions policy/upstream/reporting_upstream.proto

This file was deleted.

114 changes: 0 additions & 114 deletions policy/upstream/reporting_upstream.ranger.go

This file was deleted.

Loading

0 comments on commit f345d22

Please sign in to comment.