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

VAULT-19237 Add mount_type to secret response #23047

Merged
merged 8 commits into from
Sep 20, 2023
Merged

Conversation

VioletHynes
Copy link
Contributor

@VioletHynes VioletHynes commented Sep 13, 2023

This is the first step towards the Vault proxy static secret caching initiative. We return kv for KVV1/KVV2 responses.

Surprisingly, I couldn't find any KV tests that were explicitly testing the Get method, so I made my own.

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Sep 13, 2023
@github-actions
Copy link

github-actions bot commented Sep 13, 2023

CI Results:
All Go tests succeeded! ✅

@VioletHynes VioletHynes added this to the 1.16 milestone Sep 13, 2023
@VioletHynes VioletHynes marked this pull request as ready for review September 13, 2023 14:07
@github-actions
Copy link

github-actions bot commented Sep 13, 2023

Build Results:
All builds succeeded! ✅

@ncabatoff
Copy link
Collaborator

Can we make this more generic? I see that Router.routeCommon is already setting MountType on the request, so Core.handleRequest could use that to populate the response field.

@VioletHynes
Copy link
Contributor Author

Can we make this more generic? I see that Router.routeCommon is already setting MountType on the request, so Core.handleRequest could use that to populate the response field.

I've been looking into this, and I'm not sure how to access the api.Secret object from a logical.Response object (they have a separate, distinct, logical.Secret that doesn't appear in the json). We need to add this to the api.Secret object. I might be missing something obvious, but I can't see a way to do this in a 'generic' way

I agree, in principle, for what it's worth, and this would be a great option, I'm just missing how to do this in Core.handleRequest.

Copy link
Contributor

@kubawi kubawi left a comment

Choose a reason for hiding this comment

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

LGTM! Left one suggestion, but it's a nitpick, really. Thanks, Violet!

Comment on lines 22 to 34
coreConfig := &vault.CoreConfig{
LogicalBackends: map[string]logical.Factory{
"kv": logicalKv.Factory,
},
}

cluster := vault.NewTestCluster(t, coreConfig, &vault.TestClusterOptions{
HandlerFunc: vaulthttp.Handler,
})

cluster.Start()
defer cluster.Cleanup()

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 Hey, do we care about having multiple cores in this test? If not, you could probably save some lines by using minimal.NewTestSoloCluster.

@@ -3769,7 +3779,7 @@ var file_sdk_plugin_pb_backend_proto_rawDesc = []byte{
0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x65,
0x61, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x65,
0x61, 0x73, 0x65, 0x49, 0x64, 0x22, 0xc8, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x61, 0x73, 0x65, 0x49, 0x64, 0x22, 0xe7, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
Copy link
Contributor Author

@VioletHynes VioletHynes Sep 18, 2023

Choose a reason for hiding this comment

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

I don't know why there are a lot of changes in this area of the file, I didn't touch this area and I followed the instructions on "protobuf & gRPC generation". If this is cause for concern, let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Flyby comment: this looks perfectly normal to me. The protobuf compiler generates lots of diff here anytime the service or message definitions change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome! Thanks for confirming, it puts my mind at ease, haha


cluster := minimal.NewTestSoloCluster(t, nil)

cluster.Start()
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI this is a no-op for any use of TestCluster (including NewTestCluster), the Start method exists only because we haven't got around to removing all uses of it.

cluster := minimal.NewTestSoloCluster(t, nil)

cluster.Start()
defer cluster.Cleanup()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also unnecessary with NewTestSoloCluster.

@VioletHynes VioletHynes merged commit f943c37 into main Sep 20, 2023
@VioletHynes VioletHynes deleted the violethynes/VAULT-19237 branch September 20, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants