sonic-buildimage/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform
Mai Bui 92d25be08f
[inventec] Replace os.system and remove subprocess with shell=True (#12108)
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-10-14 10:21:44 -04:00
..
__init__.py [Inventec][D6356] Update driver and Add new platform API implementation (#3521) 2019-10-09 16:16:05 -07:00
chassis.py [platform] Remove references to deprecated get_serial_number() method in Chassis class (#5649) 2020-10-17 22:00:14 -07:00
eeprom.py [sonic-utilities] Update submodule; Build and install as a Python 3 wheel (#5926) 2020-11-25 10:28:36 -08:00
fan.py [Inventec][D6356] Update driver and Add new platform API implementation (#3521) 2019-10-09 16:16:05 -07:00
platform.py [Inventec][D6356] Update driver and Add new platform API implementation (#3521) 2019-10-09 16:16:05 -07:00
psu.py [Inventec][D6356] Update driver and Add new platform API implementation (#3521) 2019-10-09 16:16:05 -07:00
qsfp.py [inventec] Replace os.system and remove subprocess with shell=True (#12108) 2022-10-14 10:21:44 -04:00
sfp.py [inventec] Replace os.system and remove subprocess with shell=True (#12108) 2022-10-14 10:21:44 -04:00
thermal.py [Inventec][D6356] Update driver and Add new platform API implementation (#3521) 2019-10-09 16:16:05 -07:00
transceiver_event.py [Inventec][D6356] Update Inventec 6356 (#3839) 2020-02-10 12:26:48 -08:00