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

Support KVv2 secrets engine #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlexTMjugador
Copy link

@AlexTMjugador AlexTMjugador commented Jan 9, 2024

Vault secret storage is powered by a variety of secret engines. As asserted in source code comments of this crate, the specifics of the secrets format are not very well documented, but the official Go client mentions that the format of the data field is "up to the secret backend".

As a consequence of this, trying to use the secret engine KVv2 with this crate does not work because the data field format was changed, leading to deserialization errors in the Secret struct: KVv1, KVv2.

To address this in a straightforward way, let's allow secret data to be deserialized from either of the KVv1 or KVv2 formats. These formats have been tested successfully with the KVv1, KVv2, and Cubbyhole backends. Other backends may be potentially supported too, as long as they share a similar data format.

While at it, I have instructed serde to default deserializing a lease_duration of 0 in case that field is absent in the Secret response. Although I haven't encountered instances where this field is missing in real-world scenarios, the lack of comprehensive documentation (edit: and the explicit warning on the API documentation about how there might be breaking changes even within the v1 API version) prompts a defensive approach, assuming the least possible about the response format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant