sonic-buildimage/platform/broadcom/sonic-platform-modules-ruijie/common/script
Mai Bui 5238bd78af [ruijie] Replace os.system and remove subprocess with shell=True (#12107)
Signed-off-by: maipbui <maibui@microsoft.com>
Dependency: [https://github.com/sonic-net/sonic-buildimage/pull/12065](https://github.com/sonic-net/sonic-buildimage/pull/12065)
#### Why I did it
1. `getstatusoutput` is used without a static string and it uses `shell=True`
2. `subprocess()` - when using with `shell=True` is dangerous. Using subprocess function without a static string can lead to command injection.
3. `os` - not secure against maliciously constructed input and dangerous if used to evaluate dynamic content.
#### How I did it
1. use `getstatusoutput` without shell=True
2. `subprocess()` - use `shell=False` instead. use an array string. Ref: [https://semgrep.dev/docs/cheat-sheets/python-command-injection/#mitigation](https://semgrep.dev/docs/cheat-sheets/python-command-injection/#mitigation)
3. `os` - use with `subprocess`
2022-12-10 10:33:21 +08:00
..
avscontrol.py [Ruijie] Add ruijie platform & device (#4954) 2021-02-24 16:45:27 -08:00
device_i2c.py [ruijie] Replace os.system and remove subprocess with shell=True (#12107) 2022-12-10 10:33:21 +08:00
fancontrol.py [ruijie] Replace os.system and remove subprocess with shell=True (#12107) 2022-12-10 10:33:21 +08:00
ruijiecommon.py [Ruijie] Add ruijie platform & device (#4954) 2021-02-24 16:45:27 -08:00
ruijieconfig.py [Ruijie] Add ruijie platform & device (#4954) 2021-02-24 16:45:27 -08:00
ruijieutil.py [ruijie] Replace os.system and remove subprocess with shell=True (#12107) 2022-12-10 10:33:21 +08:00