Subprocess input data warning on literal command
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 836
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 1
Description
Describe the bug
Bandit reports when user is trying to call subprocess, even when command is static.
To Reproduce
Create test.py:
import subprocess
def f():
print(subprocess.check_output(['/usr/bin/ls']))
Call:
$ bandit test.py
Expected behavior
Bandit shouldn't report B603 on line 4, because there is no way untrusted input appear there.
Bandit version
bandit 1.5.0
python version = 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609]
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
Start with the B603 check and reproduce the report using the mentioned test.py example and bandit test.py. Trace how the check distinguishes subprocess calls and determine the expected behavior: a literal command with no untrusted input should not produce a B603 warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100