This repository was archived by the owner on Jun 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Fix for #519 #523
Merged
Merged
Fix for #519 #523
Conversation
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
shtripat
reviewed
May 23, 2025
keystore.go
Outdated
| "github.com/minio/kms-go/kes" | ||
| ) | ||
|
|
||
| // Key structure define a cryptographic key |
Contributor
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.
Suggested change
| // Key structure define a cryptographic key | |
| // Key defines a cryptographic key |
server.go
Outdated
Comment on lines
248
to
270
| if len(conf.PredefinedKeys) > 0 { | ||
| cipher := crypto.DetermineSecretKeyType() | ||
| for _, k := range conf.PredefinedKeys { | ||
| key, err := crypto.GenerateSecretKey(cipher, rand.Reader) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| hmac, err := crypto.GenerateHMACKey(crypto.SHA256, rand.Reader) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| if err = state.Keys.Create(ctx, k.Name, crypto.KeyVersion{ | ||
| Key: key, | ||
| HMACKey: hmac, | ||
| CreatedAt: time.Now().UTC(), | ||
| CreatedBy: conf.Admin, | ||
| }); err != nil { | ||
| if err != kes.ErrKeyExists { | ||
| return nil, err | ||
| } | ||
| } | ||
| } | ||
| } |
Contributor
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.
We can define a private function for this and reuse in both places
Contributor
Author
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.
You are right, we create it as a private function. Thank you @shtripat .
aead
suggested changes
May 23, 2025
server.go
Outdated
| // [Server.UpdatePolicies]. These more specific methods are usually | ||
| // simpler to use and more efficient. | ||
| func (s *Server) Update(conf *Config) (io.Closer, error) { | ||
| func (s *Server) Update(ctx context.Context, conf *Config) (io.Closer, error) { |
Member
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.
We cannot simply change the public API here
aead
approved these changes
May 26, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Implemented logic to define keys present in config file.