Repository navigation
fix(pass): Replace previous registry credentials - #488
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The pass helper can return credentials for the previous account after logging in to the same registry with another username. Each username has a separate entry, while Get and List select the first entry alphabetically.
- What I did
Make storing credentials replace the previous account for that registry, matching the other credential helpers.
- How I did it
After successfully inserting the new credentials, remove the other usernames stored under the same server. Insertion failures leave the existing credentials untouched. Errors while listing or removing old entries are returned to the caller.
- How to verify it
The regression test stores alice/alice-token followed by zoe/zoe-token for one registry and checks that both Get and List select zoe. Run
go test ./pass -run TestPassHelperReplace -count=1with an initialized password store.The regression test fails on the unchanged implementation (List returns alice) and passes with the fix; the complete pass package also passes. These runs used a real pass + GnuPG store in a golang container.
- Description for the changelog
Fix pass returning an earlier account after storing credentials for a different username on the same registry.
AI assistance was used to prepare this code, regression test, and pull request description.