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

dependency: fix kv2 data path prefix checking #1341

Merged
merged 1 commit into from
Mar 2, 2020

Conversation

findkim
Copy link
Contributor

@findkim findkim commented Feb 21, 2020

The implicit /data/ path prefix for kv2 secrets were not properly prepended for secret paths matching /data*.

Fixes #1340

Copy link
Member

@lornasong lornasong left a comment

Choose a reason for hiding this comment

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

makes sense to me!

@@ -333,14 +333,15 @@ func isKVv2(client *api.Client, path string) (string, bool, error) {
return mountPath, false, nil
}

func addPrefixToVKVPath(p, mountPath, apiPrefix string) string {
func addPrefixToVKVPath(p, mountPath, apiPrefixRaw string) string {
apiPrefix := path.Clean(apiPrefixRaw)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why Clean() here? The KV prefixes have a path like structure, they don't follow all the rules. Seems like it might have some unintended side effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the context on the prefix structure and good point, updated changes to make it more explicit on the trailing / check

Copy link
Contributor

@eikenb eikenb left a comment

Choose a reason for hiding this comment

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

LGTM!

@findkim findkim merged commit 1c62401 into hashicorp:master Mar 2, 2020
@findkim findkim deleted the fix-kv2-secret-path branch March 2, 2020 20:22
@eikenb eikenb added this to the 0.25.0 milestone Apr 24, 2020
@eikenb eikenb added the bug label Apr 24, 2020
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.

fail when kv2 secret path starts with "data"
3 participants