Skip to content

fix(pass): Replace previous registry credentials - #488

Open
pcbeingused333 wants to merge 1 commit into
docker:mainfrom
pcbeingused333:fix/pass-replace-c3639
Open

pcbeingused333 wants to merge 1 commit into
docker:mainfrom
pcbeingused333:fix/pass-replace-c3639

Conversation

@pcbeingused333

Copy link
Copy Markdown

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=1 with 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.

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
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.

1 participant