fix: Mask assume role response in debug output (#102)

This commit is contained in:
allisaurus
2020-07-29 10:43:15 -07:00
committed by GitHub
parent ad85e9c2d3
commit df7d846161
3 changed files with 30 additions and 8 deletions
+22
View File
@@ -594,4 +594,26 @@ describe('Configure AWS Credentials', () => {
})
});
test('masks variables before exporting', async () => {
let maskedValues = [];
const publicFields = ['AWS_REGION', 'AWS_DEFAULT_REGION'];
core.setSecret.mockReset();
core.setSecret.mockImplementation((secret) => {
maskedValues.push(secret);
});
core.exportVariable.mockReset();
core.exportVariable.mockImplementation((name, value) => {
if (!maskedValues.includes(value) && !publicFields.includes(name)) {
throw new Error(value + " for variable " + name + " is not masked yet!");
}
});
core.getInput = jest
.fn()
.mockImplementation(mockGetInput(ASSUME_ROLE_INPUTS));
await run();
});
});