Skip to content

[flake8-bandit] Also check keyword arguments (S602, S603, S607, S609) - #27687

Merged
ntBre merged 4 commits into
astral-sh:mainfrom
saberoueslati:flake8-bandit/subprocess-args-keyword
Aug 12, 2026
Merged

ntBre merged 4 commits into
astral-sh:mainfrom
saberoueslati:flake8-bandit/subprocess-args-keyword

Conversation

@saberoueslati

Copy link
Copy Markdown
Contributor

Summary

Fix false negatives for subprocess commands passed as args=, including S602, S603, S607, and S609. Preserve conservative diagnostics for starred command arguments and avoid treating os.execv(..., args=...) argument vectors as executable paths.

Closes #27631

Test Plan

  • cargo test -p ruff_linter flake8_bandit::tests::rules
  • uv run --only-group dev --locked prek run --files ...

@astral-sh-bot
astral-sh-bot Bot requested a review from ntBre August 12, 2026 01:27

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ntBre ntBre added the bug An issue describing something that isn't working, or a PR that fixes a bug label Aug 12, 2026
@ntBre ntBre changed the title [flake8-bandit] Handle keyword subprocess commands [flake8-bandit] Also check keyword arguments (S602, S603, S607, S609) Aug 12, 2026
@ntBre
ntBre enabled auto-merge (squash) August 12, 2026 14:12
@ntBre
ntBre merged commit ec02d6d into astral-sh:main Aug 12, 2026
46 checks passed
George-Ogden pushed a commit to George-Ogden/ruff that referenced this pull request Aug 16, 2026
…`, `S609`) (astral-sh#27687)

## Summary

Fix false negatives for subprocess commands passed as `args=`, including
`S602`, `S603`, `S607`, and `S609`. Preserve conservative diagnostics
for starred command arguments and avoid treating `os.execv(...,
args=...)` argument vectors as executable paths.

Closes astral-sh#27631

## Test Plan

- `cargo test -p ruff_linter flake8_bandit::tests::rules`
- `uv run --only-group dev --locked prek run --files ...`

---------

Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False negatives when passing subprocess command as keyword argument

2 participants