Skip to content

test(karma-credential-loader): set credential expiration as date #6353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Aug 2, 2024

Issue

Internal JS-5339

Description

This appears to write some code with

var credentials = `${JSON.stringify(credentials)}`

however this would not serialize a Date object correctly.

Testing

b s3 - browser (runs S3 client e2e browser tests)

@kuhe kuhe requested a review from a team as a code owner August 2, 2024 23:19
credentialsCode += `
credentials.expiration = new Date(${credentials.expiration!.getTime()});`;
}

Copy link
Contributor Author

@kuhe kuhe Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my test code at this location:

    Object.assign(credentials, {
      expiration: new Date("1999-12-25"),
    });
    let credentialsCode = `var credentials = ${JSON.stringify(credentials)};
delete credentials.expiration;`;

    if (Number.isInteger(credentials.expiration?.getTime?.())) {
      credentialsCode += `
credentials.expiration = new Date(${credentials.expiration!.getTime()});`;
    }

    (function () {
      eval(credentialsCode);
      eval(`console.log(credentials, 'EVAL')`);
    })();

@trivikr trivikr merged commit 80cb054 into aws:main Aug 2, 2024
3 of 5 checks passed
@kuhe kuhe deleted the fix/karma branch August 2, 2024 23:32
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants