Skip to content
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

Support AWS_SESSION_TOKEN in ssm.js #85

Closed
jing-emma opened this issue Dec 19, 2023 · 3 comments
Closed

Support AWS_SESSION_TOKEN in ssm.js #85

jing-emma opened this issue Dec 19, 2023 · 3 comments

Comments

@jing-emma
Copy link
Contributor

jing-emma commented Dec 19, 2023

Per Issue #5 Support AWS_SESSION_TOKEN authentication, Support for AWS_SESSION_TOKEN has been added since 0.5.0.

I have tried to get a parameter from SSM by using ssm getParameter function. await systemsManager.getParameter(testParameterName). I got an error saying 'Uncaught (in promise) SystemsManagerServiceError: The security token included in the request is invalid'. We login AWS via SSO. I can do s3.listBuckets(). It is an issue only happened to ssm.

If I read the code correctly, I think the fix could be as simple as adding sessionToken: this.awsConfig.sessionToken when constructing SignatureV4 on line 39

 this.signature = new SignatureV4({
            service: this.serviceName,
            region: awsConfig.region,
            credentials: {
                accessKeyId: awsConfig.accessKeyId,
                secretAccessKey: awsConfig.secretAccessKey,
                sessionToken: this.awsConfig.sessionToken,
            },
            uriEscapePath: true,
            applyChecksum: false,
        })

I would appreciate it if you could take a look at this issue. Thanks

oh BTW kms.js does not have sessionToken passed in. I bet it had the same issue.

@oleiade
Copy link
Member

oleiade commented Dec 20, 2023

Good catch @jing-emma 👀 I'll look into it as soon as I have capacity.
If you have the time, we would also appreciate a PR 👍🏻

@joanlopez
Copy link
Contributor

Hey @jing-emma,
Could you confirm that now that we've merged your pull request, we can close this issue?
Thanks so much for both reporting the issue and contributing! 💟

@jing-emma
Copy link
Contributor Author

I have verified that this issue is fixed by using the locally built ssm.js in my project. A release with version 0.11.1 or later should have this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants