-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Automatically export creators key to the store #2159
Conversation
Fixes gopasspw#1919 RELEASE_NOTES=[ENHANCEMENT] Automatically export creators key to the store. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
@@ -120,7 +120,7 @@ func (s *Action) clone(ctx context.Context, repo, mount, path string) error { | |||
|
|||
// make sure the parent directory exists. | |||
if parentPath := filepath.Dir(path); !fsutil.IsDir(parentPath) { | |||
if err := os.MkdirAll(parentPath, 0700); err != nil { | |||
if err := os.MkdirAll(parentPath, 0o700); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that 0700
is already octal and the way we are used to see permission in the unix world.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a gofumpt change. I don't have a strong opinion on this, but since we don't have strong community of "style reviewers" here I'd prefer to rely on automation as much as possible, i.e. follow the conventions that the tools suggest.
var exported bool | ||
if sub, err := s.Store.GetSubStore(mount); err == nil { | ||
debug.Log("exporting public keys: %v", idSet.Elements()) | ||
exported, err = sub.ExportMissingPublicKeys(ctx, idSet.Elements()) | ||
if err != nil { | ||
debug.Log("failed to export missing public keys: %w", err) | ||
} | ||
} else { | ||
debug.Log("failed to get sub store: %s", err) | ||
} | ||
|
||
out.Noticef(ctx, "Please ask the owner of the password store to add one of your keys: %s", strings.Join(idSet.Elements(), ", ")) | ||
if exported { | ||
out.Noticef(ctx, "The missing keys were exported to the password store. Run `gopass sync` to push them.") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice addition, especially for usage with age.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I did never test this with age. It should work, but ... 🤔
* Automatically export creators key to the store Fixes gopasspw#1919 RELEASE_NOTES=[ENHANCEMENT] Automatically export creators key to the store. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix config tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Fixes #1919
This will also automatically try to import a public key from the store if none is found. This makes it very convenient to add new recipients, but on the other hand this is might open a small attack vector if someone manages to inject their public key into the git repo and getting an existing member to add it to the recipients. But then on the other hand I wonder how carefully people examine imported GPG keys anyway.
RELEASE_NOTES=[ENHANCEMENT] Automatically export creators key to the
store. Change default for AutoImport to false.
Signed-off-by: Dominik Schulz dominik.schulz@gauner.org