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

Depending on how the .gpg-ids file was written, we may not match against the string itself. #2147

Merged
merged 2 commits into from
Mar 4, 2022

Conversation

BenPhegan
Copy link
Contributor

We may need to do a query to crypto.FindRecipients to get their details to match against when removing. Fix for #1964

RELEASE_NOTES=[BUGFIX] Fixes an issue where recipients remove may fail
with "recipient not in store"

Signed-off-by: Ben Phegan benphegan@gmail.com

…nst the string itself.

We may need to do a query to crypto.FindRecipients to get their details to match against when removing. Fix for gopasspw#1964

RELEASE_NOTES=[BUGFIX] Fixes an issue where recipients remove may fail
with "recipient not in store"

Signed-off-by: Ben Phegan <benphegan@gmail.com>
Copy link
Member

@dominikschulz dominikschulz left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Thanks a lot. A few minor nits. But once they are fixed we can merge this.

// To do this though, we need to ensure that we also do a FindRecipients on the id name from the stored ids.
recipient_ids, err := s.crypto.FindRecipients(ctx, k)
if err != nil {
out.Printf(ctx, "Warning: Failed to get GPG Key Info for %s: %s", k, err)
Copy link
Member

Choose a reason for hiding this comment

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

There is out.Warnf. Consider using that for consistent formating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I have updated an additional call that was already present and using Printf for consistency.


// If we don't match immediately, we may need to loop through the recipient keys to try and match.
// To do this though, we need to ensure that we also do a FindRecipients on the id name from the stored ids.
recipient_ids, err := s.crypto.FindRecipients(ctx, k)
Copy link
Member

Choose a reason for hiding this comment

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

Underscores in Go variable names are uncommon. Please use camel case, e.g. recipientIDs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Too much Terraform! :) Done.

continue RECIPIENTS
}

for _, recipient_id := range recipient_ids {
Copy link
Member

Choose a reason for hiding this comment

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

recipientID, please. Or just recipient or maybe id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

    RELEASE_NOTES=[BUGFIX] Fixes an issue where recipients remove may fail
    with "recipient not in store"

    Signed-off-by: Ben Phegan <benphegan@gmail.com>
Copy link
Member

@dominikschulz dominikschulz left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks a lot 👍

@BenPhegan
Copy link
Contributor Author

Hey, thanks! Just one quick question, the PR seems to have failed the DCO check for the Signed-off-by: line, yet it appears in the commit. Any hints as to what I might have done incorrectly?

@dominikschulz dominikschulz merged commit 1f44d5d into gopasspw:master Mar 4, 2022
kpitt pushed a commit to kpitt/gopass that referenced this pull request Jul 21, 2022
…nst the string itself. (gopasspw#2147)

* Depending on how the .gpg-ids file was written, we may not match against the string itself.

We may need to do a query to crypto.FindRecipients to get their details to match against when removing. Fix for gopasspw#1964

RELEASE_NOTES=[BUGFIX] Fixes an issue where recipients remove may fail
with "recipient not in store"

Signed-off-by: Ben Phegan <benphegan@gmail.com>

* Fixed variable naming and Printf to Warningf as per PR.

    RELEASE_NOTES=[BUGFIX] Fixes an issue where recipients remove may fail
    with "recipient not in store"

    Signed-off-by: Ben Phegan <benphegan@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.

2 participants