Skip to content

Only patch chown if chown exists #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion aikido_zen/sinks/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Sink module for python's `os`
"""

import os
from pathlib import PurePath
import aikido_zen.vulnerabilities as vulns
from aikido_zen.helpers.register_call import register_call
Expand Down Expand Up @@ -37,7 +38,6 @@ def patch(m):
# os.*(...) patches
patch_function(m, "access", _os_patch)
patch_function(m, "chmod", _os_patch)
patch_function(m, "chown", _os_patch)
patch_function(m, "mkdir", _os_patch)
patch_function(m, "listdir", _os_patch)
patch_function(m, "readlink", _os_patch)
Expand All @@ -50,6 +50,10 @@ def patch(m):
patch_function(m, "walk", _os_patch)
patch_function(m, "open", _os_patch)

# `chown` patch is platform-specific, so don't patch on windows
if hasattr(os, "chown"):
patch_function(m, "chown", _os_patch)

# os.path.*(...) patches
patch_function(m, "path.getsize", _os_patch)
patch_function(m, "path.join", _os_patch)
Expand Down
Loading