Skip to content

Can't use temp credentials returned from assume role if they have special characters #599

@AvivPeledTalon

Description

@AvivPeledTalon

Describe the bug

My team moved our to using assume-role instead of const access keys recently, and since then we've been seeing a lot of SignatureDoesNotMatch errors.

Digging deeper into this issue, we discovered that the AWS_SECRET_ACCESS_KEY in all of the runs that failed contained a special character ('/'), and that it might cause this kind of issues (see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-troubleshooting.html, aws/aws-cli#2665, aws/aws-cli#602)

Our temporary solution is to try and generate another set of credentials in case we get this kind of error (run configure-aws-credentials with assume role again) and hope for the best.

This reduces the chances for our workflows to fail because of this issue, but it still might happen.

Since this issue appears in the awscli troubleshooting guide, I'm guessing they're not going to change the client to support that, and won't stop issuing credentials with special characters.
My hope is that at least this action itself could identify special characters in the temporary credentials it gets and regenerate them if necessary

Expected Behavior

I expect to be able to use AWS after running configure-aws-credentials successfully.

Current Behavior

Statistically, running configure-aws-credentials with assume role succeeds, but the temp credentials have special characters in them which is known to cause issues.

Reproduction Steps

If you run this on 200 Windows instances (using matrix for example) you will see some of them failing due to Signature Mismatch.

If you check the credentials you got on the failed runs they will have special characters in them.

steps:
  - name: Configure AWS credentials
    uses: aws-actions/configure-aws-credentials@v1-node16
    with:
      role-to-assume: <YOUR_ROLE>
      aws-region: <YOUR_REGION>

  - name: identity check
    run: |
      aws sts get-caller-identity

Possible Solution

  1. Retry assumerole until you get credentials without special characters. You can control this behavior using an action input 'allow-special-characters'
  2. Even easier to implement: Fail the action if you get temp credentials with special characters so we could retry it ourselves until it works. This behavior can be controlled using an action input 'fail-special-characters'
  3. awscli could deal with the special characters issue?
  4. AWS backend could stop issuing credentials with special characters on AssumeRole

Additional Information/Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeffort/mediumThis issue will take a few days of effort to fixp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions