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

Add non-empty passphrase constraint to context keyring #406

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

tstirrat15
Copy link
Contributor

Fixes #192

Description

We've gotten reports of users unintentionally setting empty passphrases, either when setting contexts programmatically or unintentionally during setup on their local, and then not knowing what their password is. Forcing a user to set a non-empty passphrase should help with this.

Changes

  • Pull out a password prompt function
  • Add assertion around empty passphrases on creation

Testing

Add the following to the keyring.Config declaration in internal/storage/secrets.go:

AllowedBackends: []keyring.BackendType{"file"},

This will force it to use the file-based backend.

Build the binary and then run:

./zed context set foo foo:50051 sometoken --insecure

when it prompts you for a password, leave it empty and see that it errors.

Now repeat and set a non-empty password. Repeat and see that you can successfully decrypt the file.

Now repeat and attempt to use an empty password to decrypt. See that you receive a message about an incorrect password rather than "your password must be nonempty." This should cover the use case where a user currently intentionally has an empty passphrase set.

Copy link
Member

@josephschorr josephschorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tstirrat15 tstirrat15 merged commit 3739e3d into main Aug 9, 2024
15 checks passed
@tstirrat15 tstirrat15 deleted the 192-prevent-empty-passwords branch August 9, 2024 13:44
@github-actions github-actions bot locked and limited conversation to collaborators Aug 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent empty passwords
2 participants