[device/centec] Replace os.system and remove subprocess with shell=True#12024
Merged
maipbui merged 3 commits intosonic-net:masterfrom Oct 7, 2022
Merged
[device/centec] Replace os.system and remove subprocess with shell=True#12024maipbui merged 3 commits intosonic-net:masterfrom
maipbui merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: maipbui <maibui@microsoft.com>
qiluo-msft
reviewed
Sep 9, 2022
| os.system('echo out > /sys/class/gpio/gpio502/direction') | ||
| os.system('echo 1 > /sys/class/gpio/gpio502/value') | ||
| with open('/sys/class/gpio/export', 'w') as file: | ||
| file.write('502') |
Collaborator
Contributor
Author
There was a problem hiding this comment.
I added \n, thank you.
Signed-off-by: maipbui <maibui@microsoft.com>
qiluo-msft
approved these changes
Sep 12, 2022
Contributor
Author
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
@LuiSzee @guxianghong @taochengyi @yangbashuang |
Contributor
Ok, we will review and verify it on centec platform. |
Contributor
|
subprocess.run not work on older version SONiC image, such as 201911 |
Signed-off-by: maipbui <maibui@microsoft.com>
Contributor
Author
@LuiSzee I changed it to |
Contributor
Author
|
@LuiSzee @guxianghong @taochengyi @yangbashuang Do you have any further comments? |
Contributor
|
@maipbui I have verified it on centec platform. |
richardyu-ms
pushed a commit
to richardyu-ms/sonic-buildimage
that referenced
this pull request
Nov 16, 2022
Related work items: sonic-net#2151, sonic-net#2194, sonic-net#2224, sonic-net#2237, sonic-net#2264, sonic-net#2281, sonic-net#2286, sonic-net#2297, sonic-net#2299, sonic-net#2305, sonic-net#2325, sonic-net#2335, sonic-net#2338, sonic-net#2341, sonic-net#2343, sonic-net#2347, sonic-net#2350, sonic-net#2355, sonic-net#2356, sonic-net#2358, sonic-net#2360, sonic-net#2363, sonic-net#2367, sonic-net#2368, sonic-net#2370, sonic-net#2374, sonic-net#2392, sonic-net#2398, sonic-net#2408, sonic-net#2414, sonic-net#2415, sonic-net#2419, sonic-net#2421, sonic-net#2422, sonic-net#2423, sonic-net#2426, sonic-net#2427, sonic-net#2430, sonic-net#2431, sonic-net#2433, sonic-net#2434, sonic-net#2436, sonic-net#2437, sonic-net#2441, sonic-net#2444, sonic-net#2445, sonic-net#2446, sonic-net#2456, sonic-net#2458, sonic-net#2460, sonic-net#2461, sonic-net#2463, sonic-net#2472, sonic-net#2475, sonic-net#11877, sonic-net#12024, sonic-net#12065, sonic-net#12097, sonic-net#12130, sonic-net#12209, sonic-net#12217, sonic-net#12244, sonic-net#12251, sonic-net#12255, sonic-net#12276, sonic-net#12284
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: maipbui maibui@microsoft.com
Why I did it
subprocess.Popen()andsubprocess.run()is used withshell=True, which is very dangerous for shell injection.os- not secure against maliciously constructed input and dangerous if used to evaluate dynamic contentHow I did it
Replace
osbysubprocess, removeshell=TrueRemove unused functions
How to verify it
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)