Skip to content

Commit

Permalink
Add -enable-audit cli flag
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Jul 11, 2024
1 parent a23e670 commit 6eddd9a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/gosec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6eddd9a

Please sign in to comment.