Add Ability to mask passwords in the UI and in saved Events#14
Merged
Conversation
Member
Author
|
This is how to get data from the local secret store on a mac so that passwords are not written in local_setup.py: def getpassword(service, account):
import re
import os
def decode_hex(s):
s = eval('"' + re.sub(r"(..)", r"\x\1", s) + '"')
if "" in s: s = s[:s.index("")]
return s
cmd = ' '.join([
"/usr/bin/security",
" find-generic-password",
"-g -s '%s' -a '%s'" % (service, account),
"2>&1 >/dev/null"
])
p = os.popen(cmd)
s = p.read()
p.close()
m = re.match(r"password: (?:0x([0-9A-F]+)\s*)?\"(.*)\"$", s)
if m:
hexform, stringform = m.groups()
if hexform:
return decode_hex(hexform)
else:
return stringform
def setpassword(service, account):
import os
import getpass
password = getpass.getpass()
cmd = 'security add-generic-password -U -a %s -s %s -p \'%s\'' % (account, service, password)
p = os.popen(cmd)
s = p.read()
p.close()
# set with setpassword("mara","whatever")
whatever_password = getpassword("mara", "whatever") |
e0c7c7b to
86b4199
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We don't want passwords saved to any disk/DB or shown in any UI so we need the ability to mask them. This masks passwords in the log (before it's actually shown/written) and in the node pages. I'm not sure if there are more places.