forked from p15670423/monkey
Rename "required" permissions to "expected" permissions
This commit is contained in:
parent
53a126482f
commit
4ad49d19c7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue