fix(tokens): restrict chmod to user only

This commit is contained in:
2026-04-17 01:14:25 +02:00
parent 130deaf320
commit 0a7fec53ab
3 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -40,11 +40,14 @@ class DataDir:
return path_index.is_file()
return False
def set_file(self, path: str, file_name: str, value: str) -> None:
def set_file(
self, path: str, file_name: str, value: str, chmod: int = 0o644
) -> None:
if self.exists(path):
file_path = self.root_path / path / file_name
with file_path.open(mode="w") as file:
file.write(value)
file_path.chmod(chmod)
self.logger.debug("Wrote %s", file_path)
def get_file(self, path: str, file_name: str) -> str | None: