VaultSharp icon indicating copy to clipboard operation
VaultSharp copied to clipboard

ReadSecretPathsAsync to also support GET Method

Open greg-signi opened this issue 2 years ago • 7 comments

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 avatar Sep 19 '23 08:09 greg-signi

@rajanadar do you have any thoughts on this ?

greg-signi avatar Sep 29 '23 11:09 greg-signi

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

konidev20 avatar Oct 01 '23 20:10 konidev20

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 avatar Oct 01 '23 21:10 konidev20

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).

konidev20 avatar Oct 01 '23 21:10 konidev20

@konidev20 thank you thank you 💯

greg-signi avatar Oct 02 '23 15:10 greg-signi

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

konidev20 avatar Oct 02 '23 15:10 konidev20

Hey @konidev20 Yep appears to be working fine 👍

greg-signi avatar Oct 05 '23 08:10 greg-signi