sonic-buildimage/device/celestica/x86_64-cel_seastone-r0/sonic_platform
Mai Bui 51a1eb112b
[device/celestica] Mitigation for command injection vulnerability (#11740)
Signed-off-by: maipbui <maibui@microsoft.com>
Dependency: [PR (#12065)](https://github.com/sonic-net/sonic-buildimage/pull/12065) needs to merge first.
#### Why I did it
1. `eval()` - not secure against maliciously constructed input, can be dangerous if used to evaluate dynamic content. This may be a code injection vulnerability.
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.
4. `is` operator - string comparison should not be used with reference equality.
5. `globals()` - extremely dangerous because it may allow an attacker to execute arbitrary code on the system
#### How I did it
1. `eval()` - use `literal_eval()`
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`
4. `is` - replace by `==` operator for value equality
5. `globals()` - avoid the use of globals()
2022-12-09 10:30:20 -05:00
..
__init__.py [sonic-utilities] Update submodule; Build and install as a Python 3 wheel (#5926) 2020-11-25 10:28:36 -08:00
chassis.py [device/celestica] Mitigation for command injection vulnerability (#11740) 2022-12-09 10:30:20 -05:00
component.py [device/celestica] Mitigation for command injection vulnerability (#11740) 2022-12-09 10:30:20 -05:00
eeprom.py Fix issue of partially parsing syseeprom value (#10020) (#10276) 2022-03-21 09:25:36 -07:00
event.py [device/celestica]: Add xcvrd event support for Seastone-DX010 (#5896) 2020-12-14 10:22:56 -08:00
fan_drawer.py [device/celestica]: Fix failed test cases of DX010 platform APIs (#6564) 2021-04-02 10:08:31 -07:00
fan.py Seastone: fix platform fan psu and temperature issues (#12567) 2022-12-05 09:44:55 -08:00
helper.py [device/celestica] Mitigation for command injection vulnerability (#11740) 2022-12-09 10:30:20 -05:00
platform.py [sonic-utilities] Update submodule; Build and install as a Python 3 wheel (#5926) 2020-11-25 10:28:36 -08:00
psu.py Seastone: fix platform fan psu and temperature issues (#12567) 2022-12-05 09:44:55 -08:00
sfp.py [SFP-Refactor] Modify transceiver key name (#9447) 2021-12-09 12:38:45 +05:30
thermal_actions.py [device/celestica] Mitigation for command injection vulnerability (#11740) 2022-12-09 10:30:20 -05:00
thermal_conditions.py [device/celestica]: Add thermalctld support on DX010 platform APIs (#6089) 2021-01-15 10:20:47 -08:00
thermal_infos.py [device/celestica]: Add thermalctld support on DX010 platform APIs (#6089) 2021-01-15 10:20:47 -08:00
thermal_manager.py [device/celestica] Mitigation for command injection vulnerability (#11740) 2022-12-09 10:30:20 -05:00
thermal.py [device/celestica]:Fix failed test case of Seastone snmp (#11430) 2022-07-27 12:14:13 +08:00
watchdog.py [device/celestica]: Fix failed test cases of DX010 platform APIs (#6564) 2021-04-02 10:08:31 -07:00