Skip to content

Commit 97c2473

Browse files
committed
Update _auditwall.py
1 parent f2f1284 commit 97c2473

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

codeflash/verification/_auditwall.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def check_open(event: str, args: tuple) -> None:
4343

4444

4545
def 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+
7171
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)
7785

7886

7987
def check_sqlite_connect(event: str, args: tuple) -> None:

0 commit comments

Comments
 (0)