-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Use keyring for password storage #135
base: master
Are you sure you want to change the base?
Conversation
) | ||
|
||
del ctx.config['password'] | ||
save_config(ctx.config_file, ctx.config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'save_config' may be undefined, or defined from star imports: panoptes_cli.commands.configure, panoptes_cli.commands.info, panoptes_cli.commands.project, panoptes_cli.commands.subject, panoptes_cli.commands.subject_set, panoptes_cli.commands.user, panoptes_cli.commands.workflow
password, | ||
) | ||
retrieved_password = keyring.get_password( | ||
'panoptes', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
ctx.config['username'], | ||
password, | ||
) | ||
retrieved_password = keyring.get_password( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variable 'retrieved_password' is assigned to but never used
yaml.dump(ctx.parent.config, conf_f, default_flow_style=False) | ||
def save_config(config_file, config): | ||
with open(config_file, 'w') as conf_f: | ||
yaml.dump(config, conf_f, default_flow_style=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
) | ||
|
||
if not ctx.parent.config['endpoint'].startswith('https://'): | ||
click.echo( | ||
'Error: Invalid endpoint supplied. Endpoint must be an HTTPS URL.' | ||
) | ||
return -1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
retrieved_password = keyring.get_password( | ||
'panoptes', | ||
ctx.config['username'], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do: Compare password
and retrieved_password
here to verify keyring is working.
I initially (in #56) ruled out using this because on Linux it can require packages to be installed separately, but I think that will be fine as long as it falls back to something sensible if keyring isn't available.
The implementation here is pretty much done and just needs to be tested, however it looks like the keyring module is parsing command-line arguments when it shouldn't be, so it may not behave correctly. I think this is a side effect of keyring bundling its own command line tool, so the next task is to work around that (or possibly raise an issue upstream).
Closes #56