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

Avoid writing empty strings to Vault when creating managed keys #1803

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

vinay-gopalan
Copy link
Contributor

This PR adds a fix where empty strings were being written to Vault. We should make it so that only fields provided by the user are written along with the data to Vault; if a field is not provided, empty string values should not be written. This was causing PKCS key creation to fail, since two mutually exclusive fields slot and token_label were both being sent to Vault. The PR also adds a test that is meant to be run locally since it requires a lot of prior setup (including its own Vault server config)

Fixes #1772

Output from acceptance testing:

=== RUN   TestManagedKeysPKCS
--- PASS: TestManagedKeysPKCS (1.69s)
PASS

@vinay-gopalan vinay-gopalan requested review from a team and benashz March 21, 2023 00:12
@@ -158,6 +158,53 @@ func TestManagedKeys(t *testing.T) {
})
}

// The following test requires a Vault server to be set up with a specific server configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these steps documented somewhere? I am not confident I could get this test running by following this comment alone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I can document the steps to create a PKCS#11 key and share it to our Google Drive folder or Confluence

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I made a note to discuss in our dev sync. But I think we should make sure any local only test setups are well documented. I think creating a Confluence page to document these is a good idea!

@vinay-gopalan vinay-gopalan merged commit 194f2c1 into main Mar 21, 2023
@vinay-gopalan vinay-gopalan added this to the 3.15.0 milestone Mar 21, 2023
@vinay-gopalan vinay-gopalan deleted the VAULT-13730/fix-pkcs-keys branch March 21, 2023 16:19
@vinay-gopalan vinay-gopalan modified the milestones: 3.15.0, 3.14.1 Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create a PKCS#11 vault_managed_key
3 participants