feat: Recommending using OIDC (#871)

* Recommending using OIDC

* Added tests

* fix test and package

* update readme

---------

Co-authored-by: peterwoodworth <woodwoop@amazon.com>
This commit is contained in:
Justin Plockandpeterwoodworth authored and GitHub committed 2023-09-29 21:05:32 +00:00
1 parent 164817a8f8
commit f31c158843
5 files changed
+244

No files matched your search

+6
View File
@@ -56,6 +56,12 @@ async function assumeRoleWithWebIdentityTokenFile(
async function assumeRoleWithCredentials(params: AssumeRoleCommandInput, client: STSClient) {
core.info('Assuming role with user credentials');
if (!process.env['AWS_SESSION_TOKEN']) {
core.warning(
'To avoid using long-term AWS credentials, please update your workflows to authenticate using OpenID Connect.' +
' See https://s12d.com/gha-oidc-aws for more information.'
);
}
try {
const creds = await client.send(new AssumeRoleCommand({ ...params }));
return creds;