Skip to content

[system-health] Remove subprocess with shell=True#12572

Merged
maipbui merged 2 commits intosonic-net:masterfrom
maipbui:bui/system-health-pysec
Nov 2, 2022
Merged

[system-health] Remove subprocess with shell=True#12572
maipbui merged 2 commits intosonic-net:masterfrom
maipbui:bui/system-health-pysec

Conversation

@maipbui
Copy link
Copy Markdown
Contributor

@maipbui maipbui commented Nov 1, 2022

Signed-off-by: maipbui [email protected]

Why I did it

subprocess is used with shell=True, which is very dangerous for shell injection.

How I did it

remove shell=True, use shell=False

How to verify it

Pass UT
Manual test

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: maipbui <[email protected]>
@maipbui maipbui requested a review from qiluo-msft November 1, 2022 21:47
output = utils.run_command(['some', 'invalid', 'command'])
assert not output

output = utils.run_command('ls')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Library

qiluo-msft pushed a commit that referenced this pull request Jan 25, 2023
mlok-nokia pushed a commit to mlok-nokia/sonic-buildimage that referenced this pull request Jan 26, 2023
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Feb 6, 2023
mssonicbld pushed a commit that referenced this pull request Mar 6, 2023
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.

3 participants