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

Handle v2 storage engine paths properly. #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jwilner
Copy link

@jwilner jwilner commented Dec 29, 2020

Mimic vault CLI logic. Query vault API for mount version; if v2, rewrite
to include the internal data segment right after mount point.
Additionally, wrap type assertion on data field to only occur if v2.

Background

With the v2 storage engine, secret paths look different to Vault users (e.g. from the CLI) and the Vault API (e.g. the vault "logical client"). You might read a secret with vault kv get mount/v2/secret, but the actual API URL needs to be https://vault.example.com/v1/mount/v2/data/secret -- note the inserted 'data' segment.

This plugin currently has no notion of that rewrite logic; as a result, plugin users have to be aware of vault internals and know how to rewrite the secret -- specifically, they'd have to refer to the above secret as mount/v2/data/secret for it to work.

This PR fixes the logic by mimicking the CLI's logic and discovering the corresponding version of the mount, and deciding whether or not to rewrite it.

Why Vault did their V2 engine this way, I can't say.

Mimic vault CLI logic. Query vault API for mount version; if v2, rewrite
to include the internal data segment right after mount point.
Additionally, wrap type assertion on data field to only occur if v2.
@CLAassistant
Copy link

CLAassistant commented Dec 29, 2020

CLA assistant check
All committers have signed the CLA.

@mrsinham
Copy link

Hello, can we think about integrating this pr please?

lkubb added a commit to lkubb/drone-vault that referenced this pull request Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants