rajanadar / VaultSharp

A comprehensive cross-platform .NET Library for HashiCorp's Vault, a secret management tool
http://rajanadar.github.io/VaultSharp
Apache License 2.0
488 stars 130 forks source link

ReadSecretPathsAsync to also support GET Method #328

Closed greg-signi closed 1 week ago

greg-signi commented 1 year ago

Describe the feature requesInt or question Having problems with the LIST method using istio-proxy, which currently doesn't allow the custom http method LIST, more specifically in this request

        public async Task<Secret<ListInfo>> ReadSecretPathsAsync(string path, string mountPoint = null, string wrapTimeToLive = null)
        {
            Checker.NotNull(path, "path");

            return await _polymath.MakeVaultApiRequest<Secret<ListInfo>>(mountPoint ?? _polymath.VaultClientSettings.SecretsEngineMountPoints.KeyValueV2, "/metadata/" + path.Trim('/'), _polymath.ListHttpMethod, wrapTimeToLive: wrapTimeToLive).ConfigureAwait(_polymath.VaultClientSettings.ContinueAsyncTasksOnCapturedContext);
        }

Additional context

Vault supports both LIST & GET, can you add an option or something for us to be able to make the http request with the GET method ?

greg-signi commented 11 months ago

@rajanadar do you have any thoughts on this ?

konidev20 commented 11 months ago

@greg-signi , let me see what I can do

konidev20 commented 11 months ago

Found the documentation for reference:

The API documentation uses LIST as the HTTP verb, but you can still use GET with the ?list=true query string.

Ref: https://developer.hashicorp.com/vault/api-docs#api-operations

konidev20 commented 11 months ago

Hey @rajanadar,

Should we do this for other endpoints as well? I see that since LIST is not a standard HTTP method, it might cause issues for other folks as well.

I remember, @hoerup advising me not to use HTTP LIST in a previous PR that I had raised (https://github.com/rajanadar/VaultSharp/pull/246#issuecomment-1129025496).

greg-signi commented 11 months ago

@konidev20 thank you thank you 💯

konidev20 commented 11 months ago

Hey @greg-signi, You can take a build from the branch and test if it works.

greg-signi commented 11 months ago

Hey @konidev20 Yep appears to be working fine 👍