B603 false positive?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 835
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
I don't understand how I should "check for untrusted input.
To Reproduce
Steps to reproduce the behavior:
With the code:
import shlex
import subprocess
def foo():
args = shlex.split("git rev-parse HEAD")
return str(subprocess.check_output(args, shell=False), "utf-8").strip()
Gives Issue: [B603:subprocess_without_shell_equals_true] subprocess call - check for execution of untrusted input. I don't understand how this is shell equals true given that "shell=False" is passed, nor how this is untrusted input.
Expected behavior
This line shouldn't be flagged as a warning
Bandit version
bandit --version
bandit 1.4.0
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the B603 warning with the Python snippet using shlex.split and subprocess.check_output(..., shell=False) under Bandit 1.4.0. Start by tracing the B603 check and its handling of shell=False and input trust. Done means the reported example no longer produces a warning, with regression coverage for the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100