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

AWS_SESSION_TOKEN not resolved from environment #723

Closed
oprigan-cgi opened this issue Aug 18, 2021 · 2 comments · Fixed by #772
Closed

AWS_SESSION_TOKEN not resolved from environment #723

oprigan-cgi opened this issue Aug 18, 2021 · 2 comments · Fixed by #772
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@oprigan-cgi
Copy link

AWS Lambda and other AWS services are using an assumed IAM Role with temporary security credentials and therefore It is not possible to create a valid subject token to be exchanged with sts.googleapis.com.

In AWSCredentials the following code exists:

  @VisibleForTesting
  AwsSecurityCredentials getAwsSecurityCredentials() throws IOException {
    // Check environment variables for credentials first.
    String accessKeyId = getEnvironmentProvider().getEnv("AWS_ACCESS_KEY_ID");
    String secretAccessKey = getEnvironmentProvider().getEnv("AWS_SECRET_ACCESS_KEY");
    String token = getEnvironmentProvider().getEnv("Token");
    if (accessKeyId != null && secretAccessKey != null) {
      return new AwsSecurityCredentials(accessKeyId, secretAccessKey, token);
    }
    ...

The environment variable for the session token in an AWS environment is named "AWS_SESSION_TOKEN" and not "Token".

    String token = getEnvironmentProvider().getEnv("AWS_SESSION_TOKEN");

Refer to Python library google-auth-library-python where the processing of temporary security credentials is correctly implemented.

Kind regards,
Oliver

Originally posted by @oprigan-cgi in #714 (comment)

@Neenu1995 Neenu1995 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 24, 2021
@TimurSadykov
Copy link
Member

@oprigan-cgi this should be fixed in 1.2.2 See related PR

@oprigan-cgi
Copy link
Author

@oprigan-cgi this should be fixed in 1.2.2 See related PR

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants