Commit 18add2c
committed
fix: replace shell=True with secure subprocess in TranscodePerturbation
Security: Convert amr-nb, ogg, and g711 codecs in TranscodePerturbation
from shell=True to secure subprocess patterns using list arguments.
Changes:
- Replace subprocess.check_output with shell=True to subprocess.Popen
and subprocess.run with explicit argument lists for amr-nb and ogg codecs
- Replace subprocess.check_output with shell=True to subprocess.run
with list arguments for g711 codec
- Use subprocess.DEVNULL for stderr to suppress unnecessary output
- Properly close stdout pipes and wait for encoder process completion
to prevent potential resource leaks
- Remove unused 'Any' import from typing module
This follows the precedent set in PR #15165 which fixed similar
security vulnerabilities in data_utils.py.
Signed-off-by: Rudra-Tiwari-codes <rudratiwari2006@gmail.com>
Signed-off-by: Rudra Tiwari <tiwarirudra2006@gmail.com>1 parent 5d46d4a commit 18add2c
1 file changed
+46
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1039 | 1048 | | |
1040 | 1049 | | |
1041 | 1050 | | |
1042 | 1051 | | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1047 | 1065 | | |
1048 | 1066 | | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1052 | 1086 | | |
1053 | 1087 | | |
1054 | 1088 | | |
| |||
0 commit comments