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

Prevent the use of empty user, service, or target names #87

Merged
merged 6 commits into from Jul 3, 2022

Conversation

brotskydotcom
Copy link
Collaborator

This PR fixes #86.

Since we can't alter the API to prevent the creation of credentials that have empty strings for target, service, or user names, we instead create "always invalid" credentials that, while well-formed, do no support calling get_password or set_password successfully. (They always return a NoEntry error.)

The docs (both top-level and code-level) have been updated, and tests added to verify this handling.

Fixes hwchen#86.

The fix, since we can't fail to create entries without modifying the API, is to make sure the created entries with empty strings can't be used to set or get passwords.  We do this by introducing an "always invalid" platform credential that we create for these entries.

Updates docs to clarify that the service and user names must be non-empty.
@brotskydotcom brotskydotcom requested a review from hwchen July 1, 2022 06:05
@brotskydotcom brotskydotcom self-assigned this Jul 1, 2022
Based on review discussion, this change should really be considered a minor version change rather than a patch release.

The docs have been updated to note the change in behavior and the workaround available to anyone who was relying on the prior behavior.  In addition, a warning has been issued that the next major release may change the `Entry` creation API to be fallible.
@brotskydotcom
Copy link
Collaborator Author

Unless someone objects, I'm going to merge this weekend and release a new crate. @hwchen any objection?

@brotskydotcom brotskydotcom merged commit 5f4a0ae into hwchen:master Jul 3, 2022
@brotskydotcom brotskydotcom deleted the issue-86-empty-username branch July 3, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Surprising feature on MacOS: empty service/account strings are wildcards
1 participant