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

Convert Internal RootKey Representation to a Struct #1070

Merged
merged 4 commits into from
Jul 14, 2024
Merged

Conversation

v0lkan
Copy link
Contributor

@v0lkan v0lkan commented Jul 14, 2024

Convert Internal RootKey Representation to a Struct

Description

This PR converts the internally-stored root key from a String to a Struct that contains the three parts of the root key.

Changes

List the major changes you have made in bullet points:

  • rootKey converted from a string into data.RootKeyCollection.
  • Other minor refactorings.

Test Policy Compliance

  • I have added or updated unit tests for my changes.
  • I have included integration tests where applicable.
  • All new and existing tests pass successfully.

Code Quality

  • I have followed the coding standards for this project.
  • I have performed a self-review of my code.
  • My code is well-commented, particularly in areas that may be difficult
    to understand.

Documentation

  • I have made corresponding changes to the documentation (if applicable).
  • I have updated any relevant READMEs or wiki pages.

Checklist

Before you submit this PR, please make sure:

  • You have read the contributing guidelines and
    especially the test policy.
  • You have thoroughly tested your changes.
  • You have followed all the contributing guidelines for this project.
  • You understand and agree that your contributions will be publicly available
    under the project's license.

By submitting this pull request, you confirm that my contribution is made under
the terms of the project's license and that you have the authority to grant
these rights.


Thank you for your contribution to VMware Secrets Manager
🐢⚡️!

v0lkan added 4 commits July 13, 2024 19:26
fix logic error in RootKeySetInMemory()

Signed-off-by: Volkan Özçelik <[email protected]>
Signed-off-by: Volkan Özçelik <[email protected]>
Signed-off-by: Volkan Özçelik <[email protected]>
@v0lkan v0lkan self-assigned this Jul 14, 2024
@v0lkan v0lkan requested a review from BulldromeQ as a code owner July 14, 2024 05:18
@@ -28,6 +28,8 @@ func main() {
os.Exit(1)
}

_ = os.Setenv("ORIGIN", *origin)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The scripts were requesting this as an environment variable, but nobody was setting it.

Origin comes from a command line parameter, and it's not an environment variable.
So we explicitly convert it for the rest of the script to use it.

@@ -32,40 +34,34 @@ var RootKeyLock sync.RWMutex
// 2. When an operator sets a new root key through VSecM Sentinel or other
// similar means.
func SetRootKeyInMemory(k string) {
RootKeyLock.Lock()
defer RootKeyLock.Unlock()
rootKeyLock.Lock()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need to publicly expose neither rootKey, nor its lock.

@v0lkan v0lkan merged commit 501a304 into main Jul 14, 2024
@v0lkan v0lkan deleted the ovolkan/root-key branch July 14, 2024 05:21
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