mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-07-26 08:23:15 +03:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cb841f2c86 | |||
| 0010502df7 |
@@ -2,6 +2,12 @@
|
||||
|
||||
* Add changes here
|
||||
|
||||
## 2.7.3 (July 13, 2023)
|
||||
|
||||
Bugs:
|
||||
|
||||
* Revert to the handling of secrets in JSON format since v2.1.2 [GH-478](https://github.com/hashicorp/vault-action/pull/478)
|
||||
|
||||
## 2.7.2 (July 6, 2023)
|
||||
|
||||
Bugs:
|
||||
|
||||
Vendored
-11
@@ -19019,18 +19019,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;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@ describe('e2e', () => {
|
||||
expect(process.env.SUBSEQUENT_TEST_SECRET).toBe("SUBSEQUENT_TEST_SECRET");
|
||||
expect(process.env.JSONSTRING).toBe('{"x":1,"y":"qux"}');
|
||||
expect(process.env.JSONSTRINGMULTILINE).toBe('{"x": 1, "y": "q\\nux"}');
|
||||
|
||||
let result = JSON.stringify('{"x":1,"y":"qux"}');
|
||||
result = result.substring(1, result.length - 1);
|
||||
expect(process.env.JSONDATA).toBe(result);
|
||||
expect(process.env.JSONDATA).toBe('{"x":1,"y":"qux"}');
|
||||
});
|
||||
});
|
||||
|
||||
+1
-4
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user