Create config file with 0600 permissions

It contains secrets and should not be readable by others.

fixes #109
pull/113/head
Ivan Habunek 2019-08-27 13:20:22 +02:00
rodzic d21cad892c
commit 73ba70eb83
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: CDBD63C43A30BB95
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -52,7 +52,9 @@ def make_config(path):
# Ensure dir exists
os.makedirs(dirname(path), exist_ok=True)
with open(path, 'w') as f:
# Create file with 600 permissions since it contains secrets
fd = os.open(path, os.O_CREAT | os.O_WRONLY, 0o600)
with os.fdopen(fd, 'w') as f:
json.dump(config, f, indent=True)