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:
4343
4444
4545def check_msvcrt_open (event : str , args : tuple ) -> None :
46- print (args )
4746 (handle , flags ) = args
4847 if flags & _BLOCKED_OPEN_FLAGS :
4948 msg = f"codeflash has detected: { event } ({ ', ' .join (map (repr , args ))} )."
@@ -68,12 +67,21 @@ def check_subprocess(event: str, args: tuple) -> None:
6867 if not inside_module (modules_with_allowed_popen ()):
6968 reject (event , args )
7069
70+
7171def 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 )
7785
7886
7987def check_sqlite_connect (event : str , args : tuple ) -> None :
You can’t perform that action at this time.
0 commit comments