From 4ad49d19c75bc7661fe41a8acf1fe36b3b1ecbdb Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 7 Jun 2021 13:21:51 +0530 Subject: [PATCH] Rename "required" permissions to "expected" permissions --- monkey/monkey_island/cc/services/utils/file_handling.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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