File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ def check_open(event: str, args: tuple) -> None:
43
43
44
44
45
45
def check_msvcrt_open (event : str , args : tuple ) -> None :
46
- print (args )
47
46
(handle , flags ) = args
48
47
if flags & _BLOCKED_OPEN_FLAGS :
49
48
msg = f"codeflash has detected: { event } ({ ', ' .join (map (repr , args ))} )."
@@ -68,12 +67,21 @@ def check_subprocess(event: str, args: tuple) -> None:
68
67
if not inside_module (modules_with_allowed_popen ()):
69
68
reject (event , args )
70
69
70
+
71
71
def handle_os_remove (event : str , args : tuple ) -> None :
72
- print ("os.remove" , args )
73
- if any (arg in args_allow_list for arg in args ):
74
- accept (event , args )
75
- else :
76
- reject (event , args )
72
+ filename = args [0 ] # first argument is the filename
73
+ print (f"DEBUG: handle_os_remove called with filename: { filename } " )
74
+ print (f"DEBUG: args_allow_list: { args_allow_list } " )
75
+ print ("DEBUG: checking if any pattern in allow list matches filename" )
76
+
77
+ for pattern in args_allow_list :
78
+ if pattern in str (filename ):
79
+ print (f"DEBUG: Found matching pattern '{ pattern } ' in filename" )
80
+ accept (event , args )
81
+ return
82
+
83
+ print ("DEBUG: No matching patterns found - rejecting removal" )
84
+ reject (event , args )
77
85
78
86
79
87
def check_sqlite_connect (event : str , args : tuple ) -> None :
You can’t perform that action at this time.
0 commit comments