feat: add structured exit codes for CI/CD scripting#66
Merged
Conversation
Replace blanket `process::exit(1)` with categorized codes so callers can distinguish findings from errors: 0 SUCCESS -- ran OK, nothing actionable 1 FINDINGS -- detections fired or lint findings above threshold 2 RULE_ERROR -- rule parse / compile failure 3 CONFIG_ERROR -- bad pipeline, invalid argument, misconfiguration New CLI flags: eval --fail-on-detection exit 1 when any detection fires lint --fail-level <level> exit 1 at error (default), warning, or info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eval --fail-on-detectionflag to exit 1 when any detection or correlation fires.lint --fail-level <error|warning|info>flag to control the severity threshold that triggers a non-zero exit.process::exit(1)calls across every subcommand (eval,lint,validate,convert,parse) and the daemon with the appropriate categorized code.Test results
All tests verified manually on
feat/structured-exit-codes@ 9453f86.Automated
cargo clippy --workspace --all-targets --all-features -- -D warnings-- cleancargo test --workspace-- all passingManual:
eval --fail-on-detectionrsigma eval --fail-on-detection -r rule.yml -e '{"CommandLine":"mimikatz.exe …"}'rsigma eval --fail-on-detection -r rule.yml -e '{"CommandLine":"whoami"}'rsigma eval -r rule.yml -e '{"CommandLine":"mimikatz.exe …"}'rsigma eval --fail-on-detection -r rule.yml -e @match.jsonManual:
lint --fail-levelrsigma lint rule.yml(has warnings + infos, no errors)--fail-level warningrsigma lint --fail-level warning rule.yml--fail-level inforsigma lint --fail-level info rule.ymlManual: categorized error codes
rsigma eval -r bad_syntax.yml -e '{…}'rsigma eval -r rule.yml -p nonexistent.yml -e '{…}'