diff --git a/monkey/monkey_island/cc/services/utils/file_handling.py b/monkey/monkey_island/cc/services/utils/file_handling.py index 0715e6efe..a96e8baac 100644 --- a/monkey/monkey_island/cc/services/utils/file_handling.py +++ b/monkey/monkey_island/cc/services/utils/file_handling.py @@ -9,14 +9,14 @@ def ensure_file_existence(file: str) -> None: def ensure_file_permissions(file: str) -> None: - if not file_has_sufficient_permissions(path=file, required_permissions="0o400"): + if not file_has_expected_permissions(path=file, expected_permissions="0o400"): raise InsecurePermissionsError( f"{file} has insecure permissions. Required permissions: r--------. Exiting." ) -def file_has_sufficient_permissions(path: str, required_permissions: str) -> bool: +def file_has_expected_permissions(path: str, expected_permissions: str) -> bool: file_mode = os.stat(path).st_mode file_permissions = oct(file_mode & 0o777) - return file_permissions == required_permissions + return file_permissions == expected_permissions