1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-22 18:32:45 +01:00

restrict read/write of cached auth secrets to user

This commit is contained in:
Raymond Hill 2018-05-01 08:25:20 -04:00
parent d6c1ab868c
commit 5c82bf6eba
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 6 additions and 0 deletions

View File

@ -64,8 +64,11 @@ def input_secret(prompt, token):
value = ubo_secrets[token]
elif token not in ubo_secrets or value != ubo_secrets[token]:
ubo_secrets[token] = value
exists = os.path.isfile(ubo_secrets_filename)
with open(ubo_secrets_filename, 'w') as f:
json.dump(ubo_secrets, f, indent=2)
if not exists:
os.chmod(ubo_secrets_filename, 0o600)
return value

View File

@ -82,8 +82,11 @@ def input_secret(prompt, token):
value = ubo_secrets[token]
elif token not in ubo_secrets or value != ubo_secrets[token]:
ubo_secrets[token] = value
exists = os.path.isfile(ubo_secrets_filename)
with open(ubo_secrets_filename, 'w') as f:
json.dump(ubo_secrets, f, indent=2)
if not exists:
os.chmod(ubo_secrets_filename, 0o600)
return value
# GitHub API token