Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adammcmaster
Copy link
Contributor

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

)

del ctx.config['password']
save_config(ctx.config_file, ctx.config)

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',

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(

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)

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

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'],
)
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Password stored in plaintext
2 participants