Shopify / kubeaudit

kubeaudit helps you audit your Kubernetes clusters against common security controls
MIT License
1.88k stars 185 forks source link

sarif report with errors with exit code 0 #575

Closed dani-santos-code closed 7 months ago

dani-santos-code commented 8 months ago
ISSUE TYPE

BUG REPORT

SUMMARY

When running kubeaudit on the cli, we generally yield an exit code other than 0 if the report contains errors. Following the pattern for json and logrus, we're not running os.Exit(rootConfig.exitCode) when we generate a sarif report.

this is causing issues, since now when a sarif report with results is generated, we get exit code 0.

ENVIRONMENT
STEPS TO REPRODUCE
  1. use one of the manifest files in the repo to test. Example: auditors/privileged/fixtures/privileged-nil.yml

  2. go run ./cmd/main.go all -f auditors/privileged/fixtures/privileged-nil.yml --format=sarif

  3. when you run echo $? you should see 0

EXPECTED RESULTS

2

ACTUAL RESULTS

0

ADDITIONAL INFORMATION

FEATURE IDEA

Proposal:

1 This is the quickest way to get a new feature! We reserve the right to close feature requests, even ones we like, if the proposer does not intend to contribute to the feature and it doesn't fit in our current roadmap.