@@ -113,8 +113,7 @@ def _finding(
113113# Commands that mutate filesystem content when aimed at a system directory.
114114_SYSTEM_DIR_MUTATORS = re .compile (
115115 r"(?i)(?:^|[\s;|&])(?:rm|cp|mv|install|ln|tee|sed|dd|chmod|chown|chgrp|truncate|"
116- r"install|rsync|tar|unzip|gzip|bzip2|xz)\b|>|>>" ,
117- )
116+ r"install|rsync|tar|unzip|gzip|bzip2|xz)\b|>|>>" , )
118117
119118_SYSTEM_DIRS = [
120119 "/etc" ,
@@ -938,6 +937,7 @@ def _is_process_call(lname: str) -> bool:
938937 return True
939938 return False
940939
940+
941941_PRIVILEGE_CMDS = {"sudo" , "su" , "doas" , "pkexec" , "runuser" }
942942_INJECTION_BUILTINS = {"eval" , "exec" , "compile" , "builtins.eval" , "builtins.exec" }
943943_DECODE_EXEC_BASH = re .compile (
@@ -998,15 +998,14 @@ def _check_python(self, scan_input: ScanInput, policy: PolicyConfig) -> list[Saf
998998 attr_raw = get_string_literal (node .args [1 ]) if len (node .args ) > 1 else None
999999 attr = attr_raw .lower () if isinstance (attr_raw , str ) else None
10001000 # Match any process API attr, including exec*/spawn* families.
1001- if obj in {"os" , "subprocess" , "pty" } and attr and (
1002- attr in {
1003- "system" ,
1004- "popen" ,
1005- "exec" ,
1006- "run" ,
1007- "call" ,
1008- "spawn" ,
1009- } or attr .startswith ("exec" ) or attr .startswith ("spawn" )):
1001+ if obj in {"os" , "subprocess" , "pty" } and attr and (attr in {
1002+ "system" ,
1003+ "popen" ,
1004+ "exec" ,
1005+ "run" ,
1006+ "call" ,
1007+ "spawn" ,
1008+ } or attr .startswith ("exec" ) or attr .startswith ("spawn" )):
10101009 findings .append (
10111010 self ._finding (
10121011 f"getattr({ obj } , { attr_raw !r} )" ,
0 commit comments