Use a sane permission for the encryption key file

The typical Linux umask of 0022, meaning the encrypted file is world-readable
(-rw-r--r--). Any OS-level user on the same system can read the key and decrypt
the encrypted credentials from app.db.
This commit is contained in:
jvoisin
2026-04-14 23:08:35 +02:00
parent 088778969d
commit 0959f84fd5

View File

@@ -583,6 +583,7 @@ def get_encryption_key(key_path):
try: try:
with open(key_file, "wb") as f: with open(key_file, "wb") as f:
f.write(key) f.write(key)
os.chmod(key_file, 0o600)
except PermissionError as e: except PermissionError as e:
error = e error = e
return key, error return key, error