Skip to content

Commit ae70a44

Browse files
committed
Only patch chown if chown exists
1 parent c7d3912 commit ae70a44

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

aikido_zen/sinks/os.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Sink module for python's `os`
33
"""
4-
4+
import os
55
from pathlib import PurePath
66
import aikido_zen.vulnerabilities as vulns
77
from aikido_zen.helpers.register_call import register_call
@@ -37,7 +37,6 @@ def patch(m):
3737
# os.*(...) patches
3838
patch_function(m, "access", _os_patch)
3939
patch_function(m, "chmod", _os_patch)
40-
patch_function(m, "chown", _os_patch)
4140
patch_function(m, "mkdir", _os_patch)
4241
patch_function(m, "listdir", _os_patch)
4342
patch_function(m, "readlink", _os_patch)
@@ -50,6 +49,10 @@ def patch(m):
5049
patch_function(m, "walk", _os_patch)
5150
patch_function(m, "open", _os_patch)
5251

52+
# `chown` patch is platform-specific, so don't patch on windows
53+
if hasattr(os, "chown"):
54+
patch_function(m, "chown", _os_patch)
55+
5356
# os.path.*(...) patches
5457
patch_function(m, "path.getsize", _os_patch)
5558
patch_function(m, "path.join", _os_patch)

0 commit comments

Comments
 (0)