diff --git a/src/action.test.js b/src/action.test.js index 498ab515..eb99bfa2 100644 --- a/src/action.test.js +++ b/src/action.test.js @@ -223,10 +223,7 @@ describe('exportSecrets', () => { it('JSON data secret retrieval', async () => { const jsonData = {"x":1,"y":2}; - // for secrets stored in Vault as pure JSON, we call stringify twice - // and remove the surrounding quotes - let result = JSON.stringify(JSON.stringify(jsonData)); - result = result.substring(1, result.length - 1); + let result = JSON.stringify(jsonData); mockInput('test key'); mockVaultData({ diff --git a/src/secrets.js b/src/secrets.js index 34d28679..ef967a82 100644 --- a/src/secrets.js +++ b/src/secrets.js @@ -82,18 +82,7 @@ async function selectData(data, selector) { } if (result.startsWith(`"`)) { - // Support multi-line secrets like JSON strings and ssh keys, see https://github.com/hashicorp/vault-action/pull/173 - // Deserialize the value so that newlines and special characters are - // not escaped in our return value. result = JSON.parse(result); - } else { - // Support secrets stored in Vault as pure JSON, see https://github.com/hashicorp/vault-action/issues/194 - // Serialize the value so that any special characters in the data are - // properly escaped. - result = JSON.stringify(result); - // strip the surrounding quotes added by stringify because the data did - // not have them in the first place - result = result.substring(1, result.length - 1); } return result; }