Skip to content

fix(pre-commit): drop missing bandit baseline from hook args - #299

Open
avneetbansal-aws wants to merge 1 commit into
awslabs:mainfrom
avneetbansal-aws:fix/bandit-baseline-219
Open

avneetbansal-aws wants to merge 1 commit into
awslabs:mainfrom
avneetbansal-aws:fix/bandit-baseline-219

Conversation

@avneetbansal-aws

@avneetbansal-aws avneetbansal-aws commented Nov 6, 2026 •

Copy link
Copy Markdown


This removes the --baseline .bandit-baseline.json argument from the bandit hook in .pre-commit-config.yaml. The baseline file was never committed, so the local hook exited with code 2 on every run, which is the failure reported in #219. CI already runs bandit through mise run security:bandit without a baseline and passes, so dropping the argument makes the local hook behave the same way as CI. A generated baseline was the other option in the issue, but it would freeze today's findings in a large JSON file and leave the hook and CI checking different things.

The change is a single deleted line. The CODEOWNERS and .semgrepignore entries for .bandit-baseline.json are harmless and were left alone to keep the diff small. It is one of the pre-commit failures tracked under #213, alongside the work in #280 and #281.

Running pre-commit run bandit --all-files on top of current upstream main (fbefb37) now reports Passed with bandit 1.9.3, so removing the baseline did not surface any new findings that would need handling separately. The full mise run build was not run, since the diff only touches the bandit hook arguments.

Fixes #219

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

The bandit hook passed --baseline .bandit-baseline.json, but no such
file exists in the repo, so bandit exited with code 2 on every run.
CI already runs bandit without a baseline (mise run security:bandit),
so the hook now matches CI.

Fixes awslabs#219

Verification (run in this worktree on upstream/main fbefb37 + this change):
pre-commit run bandit --all-files (pre-commit 4.3.0, bandit 1.9.3)
-> bandit...Passed. No new findings surfaced, so nothing else changed.
Eligibility gate for awslabs#219 re-checked before commit: open, unassigned,
no linked or open PR touching .pre-commit-config.yaml.

Signed-off-by: avneetbansal-aws <284363899+avneetbansal-aws@users.noreply.github.com>
@avneetbansal-aws
avneetbansal-aws requested a review from a team as a code owner November 6, 2026 16:41
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.

pre-commit: bandit hook fails (exit 2) — missing .bandit-baseline.json

1 participant