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

Set a better displaylabel for secretservice #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented May 13, 2024

Secretservice entries have a "label". This is intended to be a human-readable description. It's actually called "Description" in UIs like seahorse, and the listing of existing secrets shows this as a name for each one.

The entries stored by the credential helper set this to simply the repository URL. This is rather unfriendly, since entries like "gitlab.com" and "index.docker.io/v1" show up. Mixed in with entries from all other applications, it's hard to figure out what application owns each entry.

This commit changes the label used when saving entries to be something human-readable (this is the intent of the "label" field, btw). Because of the naming scheme, this also results in all entries being shown together by default (since UIs tend to sort lexicographically).

New entries will now be stores as:

Registry credentials for $REGISTRY_URL

Note that items stored by the secret service have multiple fields inside of them. One of those fields is called "label", and is used by the helper to filter items from the secret service. This "label" field is entirely unrelated to the items' label. The naming is most unfortunate.

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter
Copy link

codecov-commenter commented May 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 53.10%. Comparing base (7e7c557) to head (5d54c65).

Files with missing lines Patch % Lines
secretservice/secretservice.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
- Coverage   53.26%   53.10%   -0.16%     
==========================================
  Files           9        9              
  Lines         674      676       +2     
==========================================
  Hits          359      359              
- Misses        270      272       +2     
  Partials       45       45              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -33,8 +33,10 @@ func (h Secretservice) Add(creds *credentials.Credentials) error {
defer C.free(unsafe.Pointer(username))
secret := C.CString(creds.Secret)
defer C.free(unsafe.Pointer(secret))
displayLabel := C.CString("Docker credentials for " + creds.ServerURL)
Copy link
Member Author

Choose a reason for hiding this comment

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

looking now at it; should it be either configurable, or more generic? (registry credentials for)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or alternatively, we could use the name of the binary perhaps (docker-credentials-secretservice by default)

Just thinking out loud here 🤗

Copy link
Member

Choose a reason for hiding this comment

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

Hum yeah "Registry credentials" sounds better indeed

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated 👍

@thaJeztah thaJeztah force-pushed the carry_207_friendlier_labels branch from c805249 to 9c54706 Compare October 25, 2024 12:19
@thaJeztah thaJeztah marked this pull request as ready for review October 25, 2024 12:20
Secretservice entries have a "label". This is intended to be a
human-readable description. It's actually called "Description" in UIs
like seahorse, and the listing of existing secrets shows this as a name
for each one.

The entries stored by the credential helper set this to simply the
repository URL. This is rather unfriendly, since entries like
"gitlab.com" and "index.docker.io/v1" show up. Mixed in with
entries from all other applications, it's hard to figure out what
application owns each entry.

This commit changes the label used when saving entries to be something
human-readable (this is the intent of the "label" field, btw). Because
of the naming scheme, this also results in all entries being shown
together by default (since UIs tend to sort lexicographically).

New entries will now be stores as:

  Registry credentials for $REGISTRY_URL

Note that items stored by the secret service have multiple fields inside
of them. One of those fields is called "label", and is used by the
helper to filter items from the secret service. This "label" field is
entirely unrelated to the items' label. The naming is most unfortunate.

Signed-off-by: Hugo Osvaldo Barrera <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the carry_207_friendlier_labels branch from 9c54706 to 5d54c65 Compare October 28, 2024 09:53
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.

3 participants