Skip to content

fix(cli): clamp severity/confidence counts to valid ranking range#1443

Open
itxsamad1 wants to merge 1 commit into
PyCQA:mainfrom
itxsamad1:fix/issue-1423-severity-confidence-index
Open

fix(cli): clamp severity/confidence counts to valid ranking range#1443
itxsamad1 wants to merge 1 commit into
PyCQA:mainfrom
itxsamad1:fix/issue-1423-severity-confidence-index

Conversation

@itxsamad1

Copy link
Copy Markdown

Summary

  • Clamp repeated severity and confidence CLI counts to the valid ranking index range
  • Add regression tests for excess counts and repeated flags

Fixes #1423

Test plan

  • Ran unit tests for the new regression cases
  • Manual repro: bandit -ii -ll -ii -ll empty.py exits 0

Made with Cursor

@itxsamad1 itxsamad1 force-pushed the fix/issue-1423-severity-confidence-index branch 3 times, most recently from bbc0f04 to 7652b3e Compare June 26, 2026 11:55
Repeated -l/-i flags can push severity or confidence past the RANKING index range and crash with IndexError. Clamp counts before mapping to ranking labels and add regression tests.

Fixes PyCQA#1423
@itxsamad1 itxsamad1 force-pushed the fix/issue-1423-severity-confidence-index branch from 7652b3e to 9f35cb6 Compare June 26, 2026 12:17
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 -ii -ll -ii -ll raises an IndexError

1 participant