abedra / libvault

A C++ library for Hashicorp Vault
MIT License
34 stars 25 forks source link

Problem with KeyValue Secret #65

Closed leodlsrt closed 3 years ago

leodlsrt commented 3 years ago

Hi ! I have detected a bug when i want to Read, Create a key/value secret, Your library make a HTTP request in GET to /v1/mountPoint/data/mysecretname but the good request is /v1/mountPoint/mysecretname.

Can you remove the "data" attribute in the URL to resolve that problem please ?

Thanks, Léo

https://www.vaultproject.io/api-docs/secret/kv/kv-v1

image

abedra commented 3 years ago

Hi @leodlsrt. It sounds like you are using KV version 1 in your vault instance. Is that true? If so, you will need to specify version 1 when you construct your instance of Vault::KeyValue. An example can be found in the integration tests at https://github.com/abedra/libvault/blob/master/test/integration/engines/KeyValueTests.cpp#L9-L11.

If you are not using KV version 1 secrets, can you please provide more information?

leodlsrt commented 3 years ago

Thank you for your prompt response, Yes, it's KV1 secret, it works if I specify in parameter the version. If I don't set the version as a parameter, it takes kv2, my bad.

You can close this issue sorry and thanks for help!