Feature request : Read secret keys (without content )
See original GitHub issueDue to security rights, we would need a method that can read the present secret keys without retrieving the actual secret content. We have currently implemented this functionality outside the library, but would prefer to have it in the library.
Hereby our code ` public const string VaultSubKeysPath = “/v1/secret/subkeys/”;
private async Task<IList<string>> ReadAllKeys(string path)
{
_logger.LogDebug("Reading all Vault keys under {VaultPath}", path);
var requestUri = new Uri(VaultConstants.VaultSubKeysPath + path, UriKind.Relative);
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri);
httpRequestMessage.Headers.Add(VaultConstants.VaultRequestHeaderKey, "true");
httpRequestMessage.Headers.Add(VaultConstants.VaultTokenHeaderKey, _options.Token);
var httpResponseMessage = await _httpClient.SendAsync(httpRequestMessage);
if (httpResponseMessage.IsSuccessStatusCode)
{
var responseText = await httpResponseMessage.Content.ReadAsStringAsync();
if (!string.IsNullOrWhiteSpace(responseText))
{
var vaultResponse = JsonConvert.DeserializeObject<VaultResponse>(responseText);
if (vaultResponse != null)
return vaultResponse.Data.Subkeys.Keys.ToList();
}
return new List<string>();
}
if (httpResponseMessage.StatusCode == HttpStatusCode.NotFound) // When the path in Vault is not present yet.
{
return new List<string>();
}
_logger.LogError("Error reading Vault keys under {VaultPath}, statusCode: {StatusCode}", path, httpResponseMessage.StatusCode);
throw new Exception($"Error reading Vault keys under {path}");
}
`
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Option to read a value from inside the secret for key/ ...
Without this feature, I can't figure out how to workaround if we want to put all key/value pairs under one single SSM parameter...
Read more >How to hide secret keys in Google Colaboratory from users ...
Try getpass . For example: from getpass import getpass secret = getpass('Enter the secret value: '). Then, you can share the notebook and ......
Read more >KV Version 2: Unable to list keys #11545 - hashicorp/vault
Secrets are key value pairs. I should be able to list the keys without revealing the values and without giving the ability to...
Read more >3 ways to manage feature requests
Feature requests are critical part of the customer feedback loop, check out the 3 ways that can help you to manage your feature...
Read more >Versioned Key/value secrets engine | Vault
Learn how versioned key-value (kv-v2) secrets engine work to protect your data from accidental deletion, or compare the current data to previously stored ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@stephdep I think I got what your requirement is after reading the Vault documentation.
This is the API you want in the library right? https://www.vaultproject.io/api-docs/secret/kv/kv-v2#read-secret-subkeys
Available here: https://www.nuget.org/packages/VaultSharp/1.7.2