Skip to content

Preserve Bandit execution errors before SARIF upload - #39

Open
noqt wants to merge 2 commits into
PyCQA:mainfrom
noqt:fix/preserve-bandit-errors
Open

Preserve Bandit execution errors before SARIF upload#39
noqt wants to merge 2 commits into
PyCQA:mainfrom
noqt:fix/preserve-bandit-errors

Conversation

@noqt

@noqt noqt commented Aug 27, 2026

Copy link
Copy Markdown

Fixes #16.

Bandit returns exit code 1 when it finds issues and has still written valid SARIF, so that result should be uploaded. Exit code 2 means Bandit could not run—for example, because of a bad config—and the current catch-all lets upload-sarif hide the useful error behind a second “Invalid SARIF” failure.

This captures the exit code, lets 0 and 1 continue, and stops on higher codes before the upload step.

We hit this path while testing Bandit SARIF as an input to NOQT's Lumi Trace. I verified the 0/1/2 behavior with a deterministic shell check; YAML parsing and the Git whitespace check also pass.

noqt added 2 commits August 27, 2026 16:46
Allow Bandit exit 0 and 1 to continue to SARIF upload, but stop on execution errors so the original failure stays visible.
Restore the upstream LF line endings so the pull request contains only the intended Bandit exit-code handling change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bandit errors are masked as problems uploading the SARIF file

1 participant