Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions cmd/datamaps/awssource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"google.golang.org/protobuf/types/known/durationpb"
)

var cfgFile string
var logLevel string

var minStatusInterval = durationpb.New(250 * time.Millisecond)
Expand Down Expand Up @@ -188,7 +187,6 @@ func init() {
cobra.OnInitialize(initConfig)

// General Config
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is redacted.yaml)")
rootCmd.PersistentFlags().StringVar(&logLevel, "log", "info", "Set the log level. Valid values: panic, fatal, error, warn, info, debug, trace")

// api endpoint
Expand Down Expand Up @@ -249,17 +247,8 @@ func init() {

// initConfig reads in config file and ENV variables if set.
func initConfig() {
viper.SetConfigFile(cfgFile)

replacer := strings.NewReplacer("-", "_")

viper.SetEnvKeyReplacer(replacer)
viper.AutomaticEnv() // read in environment variables that match

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
log.Infof("Using config file: %v", viper.ConfigFileUsed())
} else {
log.WithFields(log.Fields{"err": err}).Errorf("Error reading config file")
}
}
12 changes: 11 additions & 1 deletion cmd/submitplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func SubmitPlan(signals chan os.Signal, ready chan bool) int {
}

log.WithContext(ctx).WithFields(lf).WithField("item_count", len(queries)).Info("identifying items")
c, _, err := websocket.Dial(ctx, viper.GetString("url"), options)
c, _, err := websocket.Dial(ctx, viper.GetString("gateway-url"), options)
if err != nil {
log.WithContext(ctx).WithFields(lf).WithError(err).Error("Failed to connect to overmind API")
return 1
Expand All @@ -236,6 +236,16 @@ func SubmitPlan(signals chan os.Signal, ready chan bool) int {
},
}
err = wspb.Write(ctx, c, &req)

if err == nil {
log.WithContext(ctx).WithFields(log.Fields{

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

[Sensitive data returned by an access to apiKey](1) flows to a logging call.
"scope": q.Scope,
"type": q.Type,
"query": q.Query,
"method": q.Method.String(),
"uuid": q.ParseUuid().String(),
}).Trace("Started query")
}
if err != nil {
log.WithContext(ctx).WithFields(lf).WithError(err).WithField("req", &req).Error("Failed to send request")
continue
Expand Down
7 changes: 1 addition & 6 deletions extractmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@ func dataFromFiles(path string) map[string][]map[string]string {
data["query-field"] = qSplit[1]

data["scope"] = parsed["terraformScope"].(string)
switch parsed["terraformMethod"].(string) {
case "GET":
data["method"] = "GET"
case "SEARCH":
data["method"] = "LIST"
}
data["method"] = parsed["terraformMethod"].(string)

result[data["query-type"]] = append(result[data["query-type"]], data)
}
Expand Down