From 81f71e6e5e5d4c8e500d4a82f637a6ffa9efe7cf Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 27 Sep 2023 13:56:26 -0400 Subject: [PATCH] Update secrets.js --- src/secrets.js | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/secrets.js b/src/secrets.js index efa881d53..b3158a9c8 100644 --- a/src/secrets.js +++ b/src/secrets.js @@ -81,22 +81,27 @@ async function exportDynamicSecrets(akeylessToken, dynamicSecrets, apiUrl, expor // This provides [object, Object] which is expected core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 1: Akeyless SDK output (raw value):`); core.info(`\u001b[38;2;255;255;0mRapi.getDynamicSecretValue = ${dynamicSecret}`); + core.info(`\u001b[38;2;255;255;0mRapi.getDynamicSecretValue = ${dynamicSecret.secret.appId}`); + core.info(`\u001b[38;2;255;255;0mRapi.getDynamicSecretValue = ${dynamicSecret.secret.displayName}`); + core.info(`\u001b[38;2;255;255;0mRapi.getDynamicSecretValue = ${dynamicSecret.secret.keyId}`); + core.info(`\u001b[38;2;255;255;0mRapi.getDynamicSecretValue = ${dynamicSecret.secret.secretText}`); + core.info(`\u001b[38;2;255;255;0mRapi.getDynamicSecretValue = ${dynamicSecret.secret.tenantId}`); core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); - // Problem demonstration 1. 'secret' is a string with a value of "[object, Object]", not a json object - core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 2: Akeyless SDK output (JSON.stringify):`); - core.info(`\u001b[38;2;255;255;0mapi.getDynamicSecretValue = ${JSON.stringify(dynamicSecret)}`); - core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); - - // Problem demonstration 2. Same as #1, but explicitly uses a replacer to ensure nested objects are parsed - core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 3: Akeyless SDK output (JSON.stringify with replacer):`); - core.info(`\u001b[38;2;255;255;0mapi.getDynamicSecretValue = ${JSON.stringify(dynamicSecret, function replacer(key, value) { return value})}`); - core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); - - // Problem demonstration 3. Same as #1, but explicitly stringifies all known keys - core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 3: Akeyless SDK output (JSON.stringify with keys):`); - core.info(`\u001b[38;2;255;255;0mapi.getDynamicSecretValue = ${JSON.stringify(dynamicSecret, ['id', 'secret_name', 'secret_key_id', 'msg', 'secret', 'appId', 'displayName', 'keyId', 'secretText', 'tenantId', 'ttl_in_minutes'])}`); - core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); + // // Problem demonstration 1. 'secret' is a string with a value of "[object, Object]", not a json object + // core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 2: Akeyless SDK output (JSON.stringify):`); + // core.info(`\u001b[38;2;255;255;0mapi.getDynamicSecretValue = ${JSON.stringify(dynamicSecret)}`); + // core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); + + // // Problem demonstration 2. Same as #1, but explicitly uses a replacer to ensure nested objects are parsed + // core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 3: Akeyless SDK output (JSON.stringify with replacer):`); + // core.info(`\u001b[38;2;255;255;0mapi.getDynamicSecretValue = ${JSON.stringify(dynamicSecret, function replacer(key, value) { return value})}`); + // core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); + + // // Problem demonstration 3. Same as #1, but explicitly stringifies all known keys + // core.info(`\u001b[38;2;225;173;1mPRE-PROCESSING CHECK 3: Akeyless SDK output (JSON.stringify with keys):`); + // core.info(`\u001b[38;2;255;255;0mapi.getDynamicSecretValue = ${JSON.stringify(dynamicSecret, ['id', 'secret_name', 'secret_key_id', 'msg', 'secret', 'appId', 'displayName', 'keyId', 'secretText', 'tenantId', 'ttl_in_minutes'])}`); + // core.info(`\u001b[38;2;225;173;1m-------------------------------------------------------------------------------------------------`); // END - AKEYLESS SDK TROUBLESHOOTING