51a1eb112b
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() |
||
---|---|---|
.. | ||
Celestica-DX010-C32 | ||
Celestica-DX010-D48C8 | ||
led-code | ||
plugins | ||
Seastone-DX010 | ||
Seastone-DX010-10-50 | ||
Seastone-DX010-25-50 | ||
Seastone-DX010-50 | ||
Seastone-DX010-50-40 | ||
Seastone-DX010-50-50-40 | ||
sonic_platform | ||
default_sku | ||
fancontrol-B2F | ||
fancontrol-F2B | ||
installer.conf | ||
led_proc_init.soc | ||
pcie.yaml | ||
platform_asic | ||
platform_components.json | ||
platform.json | ||
pmon_daemon_control.json | ||
sensors.conf | ||
system_health_monitoring_config.json | ||
th-seastone-dx010-config-flex-all.bcm | ||
thermal_overload_control.sh | ||
thermal_policy.json |