Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The following pull request corrects an issue where pulling secrets from Vault fails due to case-sensitive key referencing. At a high level, this issue means that an attempt by Drone to pull "username" when the key in Vault is "Username" will result in a "secret key not found" error.
Use Case
Lets assume we are attempting to pull a secret in vault which has the key "FOO" and value "BAR".
How To Fix This Issue
This issue can be fixed by performing a case-insensitive key lookup when querying the secret value from the "params" go map. The code changes proposed successfully mitigate this issue.
For testing purposes I have included a new unit test uppercase_secret.json which tests successfully pulling a secret when drone requests the value for key="USERNAME" and Vault includes a record where key="Username".
Additional Considerations
I could not think of any example/reason where a request for "USERNAME" when Vault is storing the key as "Username" would cause unintended consequences or impact. A secret in the form of a key/value pair should be represented with a unique key, therefor IMO "username" and "Username" should not be treated as separate values.