Repository navigation
fix(external_account): strip -fips suffix from AWS service name in SigV4 signer - #608
Draft
macastelaz wants to merge 1 commit into
Draft
macastelaz wants to merge 1 commit into
macastelaz wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When Workload Identity Federation is configured with a regional AWS STS FIPS endpoint (e.g.,
https://sts-fips.us-east-2.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15),Google::Auth::ExternalAccount::AwsRequestSigner#request_metadatapreviously extracted the service name from the first hostname segment assts-fips.AWS STS requires the SigV4 credential scope and
X-Amz-Credentialsigning key to use the canonical service namestseven when requests are sent to asts-fips.<region>.amazonaws.comendpoint. Scoping the signature tosts-fipscauses AWS STS to reject the signedGetCallerIdentityrequest with:Fix
-fipssuffix from the extracted hostname label via.delete_suffix("-fips")inlib/googleauth/external_account/aws_credentials.rb.spec/googleauth/external_account/aws_credentials_spec.rbverifying that FIPS STS endpoints produce signatures and credential headers scoped tosts.Manual Testing
Verified end-to-end against live GCP STS (
https://sts.googleapis.com/v1/token) forwarding to live AWS STS (https://sts-fips.us-east-2.amazonaws.com):sts-fips): Rejected by AWS STS withSignatureDoesNotMatch: Credential should be scoped to correct service: 'sts'.sts): Passed AWS STS service-scope validation and proceeded to token validation (InvalidClientTokenId).