mirror of https://github.com/gorhill/uBlock.git
restrict read/write of cached auth secrets to user
This commit is contained in:
parent
d6c1ab868c
commit
5c82bf6eba
|
@ -64,8 +64,11 @@ def input_secret(prompt, token):
|
||||||
value = ubo_secrets[token]
|
value = ubo_secrets[token]
|
||||||
elif token not in ubo_secrets or value != ubo_secrets[token]:
|
elif token not in ubo_secrets or value != ubo_secrets[token]:
|
||||||
ubo_secrets[token] = value
|
ubo_secrets[token] = value
|
||||||
|
exists = os.path.isfile(ubo_secrets_filename)
|
||||||
with open(ubo_secrets_filename, 'w') as f:
|
with open(ubo_secrets_filename, 'w') as f:
|
||||||
json.dump(ubo_secrets, f, indent=2)
|
json.dump(ubo_secrets, f, indent=2)
|
||||||
|
if not exists:
|
||||||
|
os.chmod(ubo_secrets_filename, 0o600)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,11 @@ def input_secret(prompt, token):
|
||||||
value = ubo_secrets[token]
|
value = ubo_secrets[token]
|
||||||
elif token not in ubo_secrets or value != ubo_secrets[token]:
|
elif token not in ubo_secrets or value != ubo_secrets[token]:
|
||||||
ubo_secrets[token] = value
|
ubo_secrets[token] = value
|
||||||
|
exists = os.path.isfile(ubo_secrets_filename)
|
||||||
with open(ubo_secrets_filename, 'w') as f:
|
with open(ubo_secrets_filename, 'w') as f:
|
||||||
json.dump(ubo_secrets, f, indent=2)
|
json.dump(ubo_secrets, f, indent=2)
|
||||||
|
if not exists:
|
||||||
|
os.chmod(ubo_secrets_filename, 0o600)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
# GitHub API token
|
# GitHub API token
|
||||||
|
|
Loading…
Reference in New Issue