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

Read deleted KV secret #343

Closed
Zetanova opened this issue Jan 20, 2024 · 1 comment
Closed

Read deleted KV secret #343

Zetanova opened this issue Jan 20, 2024 · 1 comment
Assignees
Milestone

Comments

@Zetanova
Copy link

Describe the bug
It is not possible to read the last KV secret if it is soft deleted or destroyed.
The returned json data is null and deserialization fails.

VaultSharp Version
1.13.01

Vault Version
1.12.7

Does this work with Vault CLI?
Yes

Sample Code Snippet

var secret = await vault.V1.Secrets.KeyValue.V2.ReadSecretAsync<MySecret>(secretPath, mountPoint: "mymount")

Exception Details/Stack Trace/Error Message

VaultSharp.Core.VaultApiException: {"request_id":"a17a2573-2ee5-a6c4-f9f4-b6e5277c3e46","lease_id":"","renewable":false,"lease_duration":0,"data":{"data":null,"metadata":{"created_time":"2024-01-20T18:22:51.137073758Z","custom_metadata":null,"deletion_time":"","destroyed":true,"version":2}},"wrap_info":null,"warnings":null,"auth":null}

Any additional info
secret.Data.Data should be marked and handled as Nullable

@rajanadar rajanadar self-assigned this Sep 8, 2024
@rajanadar rajanadar added this to the 1.17.5 milestone Sep 8, 2024
@rajanadar
Copy link
Owner

hi @Zetanova

This is currently not possible in C# across all .net versions.
Nullable constraints (where T : class?) is only available from language version 8.0.

For the moment, please try with a nullable type on your side (maybe MyObject?) or dictionary as a short term solution.
Once VaultSharp goes to 8.0 language version as the minimum, this can be added.

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

No branches or pull requests

2 participants