Skip to content

Commit

Permalink
Bugfix: solve "Invalid signature" error on AWS IAM Roles Anywhere (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
amitlicht authored Nov 27, 2024
1 parent d801124 commit 95f6fa0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func getCredentials(keyPath string, certPath string, roleARN string, account ope

leaf := certs[0]
intermediates := certs[1:]
if len(intermediates) == 0 {
// awssh.CreateSignFunction compares the intermediates slice to nil to check if the 'X-Amz-X509-Chain' header should be added to the request,
// and starting at some point, the AWS API started rejecting requests with an existing-yet-empty 'X-Amz-X509-Chain' header.
// To avoid this, we set the intermediates slice to nil if it's empty.
intermediates = nil
}

privKey, err := os.ReadFile(keyPath)
if err != nil {
Expand Down

0 comments on commit 95f6fa0

Please sign in to comment.