mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-04-07 20:50:09 +00:00
fix wildcard handling when field contains dot (#542)
* fix wildcard handling when field contains dot * changelog
This commit is contained in:
parent
66531b2752
commit
47dbc643a8
4 changed files with 60 additions and 26 deletions
|
|
@ -59,7 +59,7 @@ async function getSecrets(secretRequests, client, ignoreNotFound) {
|
|||
|
||||
body = JSON.parse(body);
|
||||
|
||||
if (selector == WILDCARD) {
|
||||
if (selector == WILDCARD) {
|
||||
let keys = body.data;
|
||||
if (body.data["data"] != undefined) {
|
||||
keys = keys.data;
|
||||
|
|
@ -67,20 +67,26 @@ async function getSecrets(secretRequests, client, ignoreNotFound) {
|
|||
|
||||
for (let key in keys) {
|
||||
let newRequest = Object.assign({},secretRequest);
|
||||
newRequest.selector = key;
|
||||
|
||||
newRequest.selector = key;
|
||||
|
||||
if (secretRequest.selector === secretRequest.outputVarName) {
|
||||
newRequest.outputVarName = key;
|
||||
newRequest.envVarName = key;
|
||||
}
|
||||
else {
|
||||
newRequest.envVarName = key;
|
||||
} else {
|
||||
newRequest.outputVarName = secretRequest.outputVarName+key;
|
||||
newRequest.envVarName = secretRequest.envVarName+key;
|
||||
newRequest.envVarName = secretRequest.envVarName+key;
|
||||
}
|
||||
|
||||
newRequest.outputVarName = normalizeOutputKey(newRequest.outputVarName);
|
||||
newRequest.envVarName = normalizeOutputKey(newRequest.envVarName,true);
|
||||
newRequest.envVarName = normalizeOutputKey(newRequest.envVarName,true);
|
||||
|
||||
// JSONata field references containing reserved tokens should
|
||||
// be enclosed in backticks
|
||||
// https://docs.jsonata.org/simple#examples
|
||||
if (key.includes(".")) {
|
||||
const backtick = '`';
|
||||
key = backtick.concat(key, backtick);
|
||||
}
|
||||
selector = key;
|
||||
|
||||
results = await selectAndAppendResults(
|
||||
|
|
@ -94,13 +100,13 @@ async function getSecrets(secretRequests, client, ignoreNotFound) {
|
|||
}
|
||||
else {
|
||||
results = await selectAndAppendResults(
|
||||
selector,
|
||||
body,
|
||||
cachedResponse,
|
||||
secretRequest,
|
||||
selector,
|
||||
body,
|
||||
cachedResponse,
|
||||
secretRequest,
|
||||
results
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue