Add non-empty passphrase constraint to context keyring #406
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.
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
Testing
Add the following to the
keyring.Config
declaration ininternal/storage/secrets.go
:This will force it to use the file-based backend.
Build the binary and then run:
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.