mlcommons / mlcommons/inference

Codebase Refactor: Remove shell=True from subprocess calls

Open
#2,555 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
650
Avg merge
1d 22h
Merged PRs (30d)
6

Description

In general, using shell=True can lead to security issues. It's best to remove these calls when possible.

Using Ruff rule S602:

compliance/TEST01/run_verification.py:124:17: S602 subprocess call with shell=True identified, security issue
compliance/TEST01/run_verification.py:165:17: S602 subprocess call with shell=True identified, security issue
compliance/TEST04/run_verification.py:77:17: S602 subprocess call with shell=True identified, security issue
compliance/TEST07/run_verification.py:194:17: S602 subprocess call with shell=True identified, security issue
language/bert/accuracy-squad.py:524:32: S602 subprocess call with shell=True identified, security issue
language/bert/run.py:210:40: S602 subprocess call with shell=True identified, security issue
loadgen/version_generator.py:57:91: S602 subprocess call with shell=True identified, security issue
retired_benchmarks/speech_recognition/rnnt/run.py:120:36: S602 subprocess call with shell=True identified, security issue
retired_benchmarks/translation/gnmt/tensorflow/nmt/utils/evaluation_utils.py:165:45: S602 subprocess call with shell=True identified, security issue
retired_benchmarks/translation/gnmt/tensorflow/nmt/utils/evaluation_utils.py:166:67: S602 subprocess call with shell=True identified, security issue
retired_benchmarks/translation/gnmt/tensorflow/nmt/utils/evaluation_utils.py:180:48: S602 subprocess call with shell=True identified, security issue
retired_benchmarks/translation/gnmt/tensorflow/run_task.py:131:36: S602 subprocess call with shell=True identified, security issue
retired_benchmarks/vision/medical_imaging/3d-unet-brats19/run.py:138:36: S602 subprocess call with shell=True identified, security issue
vision/medical_imaging/3d-unet-kits19/run.py:185:36: S602 subprocess call with shell=True identified, security issue
Found 14 errors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the 14 Python files and the Ruff S602 findings listed in the issue, beginning with the subprocess calls in compliance/TEST01/run_verification.py. Check each call's command construction and surrounding benchmark behavior before making changes. Done means the listed S602 findings are resolved without changing the verification or benchmark commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.