Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove shell=True #313

Merged
merged 1 commit into from
Sep 28, 2022
Merged

Remove shell=True #313

merged 1 commit into from
Sep 28, 2022

Conversation

maipbui
Copy link
Contributor

@maipbui maipbui commented Sep 27, 2022

Signed-off-by: maipbui maibui@microsoft.com

Description

subprocess() - use shell=False, use list of strings Ref: https://semgrep.dev/docs/cheat-sheets/python-command-injection/#mitigation

Motivation and Context

subprocess() - when using with shell=True is dangerous. Using subprocess function without a static string can lead to command injection.

How Has This Been Tested?

Pass UT tests/pcie_common_test.py

Additional Information (Optional)

Signed-off-by: maipbui <maibui@microsoft.com>
@prgeor prgeor merged commit 31ca0ea into sonic-net:master Sep 28, 2022
@maipbui maipbui deleted the pysec branch September 28, 2022 16:57
yxieca pushed a commit that referenced this pull request Oct 3, 2022
Signed-off-by: maipbui <maibui@microsoft.com>

Signed-off-by: maipbui <maibui@microsoft.com>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants