diff --git a/cmd/gosec/main.go b/cmd/gosec/main.go index e108ba9948..a31658f0fb 100644 --- a/cmd/gosec/main.go +++ b/cmd/gosec/main.go @@ -84,6 +84,9 @@ var ( // #nosec alternative tag flagAlternativeNoSec = flag.String("nosec-tag", "", "Set an alternative string for #nosec. Some examples: #dontanalyze, #falsepositive") + // flagEnableAudit enables audit mode + flagEnableAudit = flag.Bool("enable-audit", false, "Enable audit mode") + // output file flagOutput = flag.String("out", "", "Set output file for results") @@ -196,6 +199,9 @@ func loadConfig(configFile string) (gosec.Config, error) { if *flagAlternativeNoSec != "" { config.SetGlobal(gosec.NoSecAlternative, *flagAlternativeNoSec) } + if *flagEnableAudit { + config.SetGlobal(gosec.Audit, "true") + } // set global option IncludeRules ,when flag set or global option IncludeRules is nil if v, _ := config.GetGlobal(gosec.IncludeRules); *flagRulesInclude != "" || v == "" { config.SetGlobal(gosec.IncludeRules, *flagRulesInclude)