cisagov / ScubaGear

Automation to assess the state of your M365 tenant against CISA's baselines
https://www.cisa.gov/resources-tools/services/secure-cloud-business-applications-scuba-project
Creative Commons Zero v1.0 Universal
1.68k stars 222 forks source link

Exit with non-zero code on any error or add error handling to the Provider JSON #337

Open jacdavi opened 1 year ago

jacdavi commented 1 year ago

💡 Summary

Currently it seems ScubaGear exits with a 0 code regardless of any errors that occur during runtime.

Motivation and context

This would help with identifying issues during automated runs. e.g., a non-zero exit code triggers some type of notification for a user to check the report (which I believe will contain errors after #65 ). Otherwise, our only way to detect errors automatically would be to parse the stderr output or potentially parse the output files.

Acceptance criteria

How do we know when this work is done?

buidav commented 1 year ago

Some additional context. When running concurrently against multiple tenants our Write-Warning/Write-Error log messages become intermixed with other event messages. It's also hard to distinguish which tenant ScubaGear is running against that is causing the error messages to pop up. The above enhancement would rectify this.


Update. Throwing a non-zero exit code on all scenarios without stubbing ScubaGear's error handling toes is quite difficult. Will start looking into adding error handling flags within the JSON itself for a programmatic CRC like check.