fix: set role credentials as secrets to mask them in logs (#19)

* Set role credentials as secrets to mask them in logs

* Always set aws credentuals as secrets

* Fix typo in comment
This commit is contained in:
Laurence Armstrong
2020-01-28 23:50:15 +09:00
committed by Clare Liguori
parent 7b221d2e08
commit e2fd53ab66
2 changed files with 19 additions and 2 deletions
+5 -1
View File
@@ -54,21 +54,25 @@ async function assumeRole(params) {
}
function exportCredentials(params){
// Configure the AWS CLI and AWS SDKs using environment variables
// Configure the AWS CLI and AWS SDKs using environment variables and set them as secrets.
// Setting the credentials as secrets masks them in Github Actions logs
const {accessKeyId, secretAccessKey, sessionToken} = params;
// AWS_ACCESS_KEY_ID:
// Specifies an AWS access key associated with an IAM user or role
core.exportVariable('AWS_ACCESS_KEY_ID', accessKeyId);
core.setSecret('AWS_ACCESS_KEY_ID', accessKeyId);
// AWS_SECRET_ACCESS_KEY:
// Specifies the secret key associated with the access key. This is essentially the "password" for the access key.
core.exportVariable('AWS_SECRET_ACCESS_KEY', secretAccessKey);
core.setSecret('AWS_SECRET_ACCESS_KEY', secretAccessKey);
// AWS_SESSION_TOKEN:
// Specifies the session token value that is required if you are using temporary security credentials.
if (sessionToken) {
core.exportVariable('AWS_SESSION_TOKEN', sessionToken);
core.setSecret('AWS_SESSION_TOKEN', sessionToken);
}
}