sonic-buildimage/platform/broadcom/sonic-platform-modules-cel/silverstone
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
..
cfg [devices]: support Silverstone platform (#3474) 2019-10-09 17:47:46 -07:00
modules Update SAI module for Celestica for Bullseye and 5.10 kernel 2021-11-10 15:27:22 -08:00
scripts [device/celestica] Mitigation for command injection vulnerability (#11740) 2022-12-09 10:30:20 -05:00
systemd [devices]: support Silverstone platform (#3474) 2019-10-09 17:47:46 -07:00
setup.py [platform/device] - Implement Silverstone platform API [Chassis/Fan] (#3706) 2019-11-06 18:56:17 -08:00