Compare commits
3 Commits
stable_dep
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0871a319f5 | |||
| 7d723eeb0d | |||
| 9e67d1bd6f |
@@ -2,7 +2,7 @@ import tomllib
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from typing import Any
|
from typing import Any
|
||||||
import os
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""
|
"""
|
||||||
@@ -38,14 +38,10 @@ class Config:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_password(password_field: str) -> str:
|
def read_password(password_field: str) -> str:
|
||||||
file: Path = Path(password_field)
|
if Path(password_field).is_file():
|
||||||
if file.is_file() and any([file.stat().st_mode & 0o400 and file.stat().st_uid == os.getuid(), file.stat().st_mode & 0o040 and file.stat().st_gid == os.getgid(), file.stat().st_mode & 0o004]):
|
|
||||||
with Path(password_field).open() as f:
|
with Path(password_field).open() as f:
|
||||||
return f.read().strip()
|
return f.read().strip()
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(
|
|
||||||
f"Testing, should only use file. {password_field}",
|
|
||||||
)
|
|
||||||
return password_field
|
return password_field
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user