- 필수 기능
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- 디지털 경험
- 소프트웨어 제공
- 보안
- 로그 관리
- 관리
- 인프라스트럭처
- ci
- containers
- csm
- ndm
- otel_guides
- overview
- slos
- synthetics
- tests
- 워크플로
ID: python-security/subprocess-shell-true
Language: Python
Severity: Warning
Category: Security
Never invoke subprocess.Popen
with shell = True
leads to unnecessary privileges and access to the underlying execution runtime. Execution with shell = True
should clearly be verified and checked for code in production.
import subprocess
def find_dogweb_packages():
# setuptools.find_packages is too slow since it walks the entire codebase, including Javascript code.
# This is an equivalent but optimized function, specific to our codebase, listing all the available
# packages.
# Look for __init__.py files using fast UNIX tools
r = subprocess.Popen(
"find %s -name '__init__.py'" % " ".join(MODULE_PATHS), shell=True, stdout=subprocess.PIPE
).stdout.read()
from subprocess import Popen
Popen('/bin/ls %s' % ('something',), shell=True)
import subprocess
subprocess.Popen('/bin/ls %s' % ('something',), shell=True)
subprocess.Popen('/bin/ls %s' % ('something',), shell=False)
|
|
For more information, please read the Code Analysis documentation
Identify code vulnerabilities directly in yourVS Code editor
Identify code vulnerabilities directly inJetBrains products