Skip to content

Commit

Permalink
Fix for invalid date when parsing role credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
plumdog committed Jun 19, 2020
1 parent 22c28b7 commit ebc917c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/roleCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,17 @@ export const readCredentialsCacheFile = async (): Promise<Credentials | undefine
return undefined;
}

const expirationDate = new Date(Date.parse(expirationIsoString));

if (isNaN(expirationDate.getTime())) {
return undefined;
}

const creds = {
accessKeyId,
secretAccessKey,
sessionToken,
expiration: new Date(Date.parse(expirationIsoString)),
expiration: expirationDate,
};

if (creds.expiration.getTime() < new Date().getTime()) {
Expand Down

0 comments on commit ebc917c

Please sign in to comment.