Skip to content

fix(auth): strip -fips suffix from AWS service name in SigV4 signing - #18920

Merged
macastelaz merged 1 commit into
mainfrom
fix/aws-sts-fips-service-name
Nov 2, 2026
Merged

macastelaz merged 1 commit into
mainfrom
fix/aws-sts-fips-service-name

Conversation

@macastelaz

@macastelaz macastelaz commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

When signing AWS STS GetCallerIdentity requests against regional FIPS endpoints (sts-fips.{region}.amazonaws.com), the Host header must remain sts-fips.{region}.amazonaws.com, whereas the AWS SigV4 credential scope and signing key derivation require the canonical service name (sts).

Previously, _generate_authentication_header_map derived service_name = host.split(".")[0], which produced sts-fips and caused AWS STS to reject the signed request with SignatureDoesNotMatch: Credential should be scoped to correct service: 'sts'.

This change strips any trailing -fips suffix from the extracted hostname label when computing service_name.

Manual Testing

End-to-end reproduction script and observed pre-fix / post-fix output against GCP STS (https://sts.googleapis.com/v1/token) and AWS STS (https://sts-fips.us-east-2.amazonaws.com):

@macastelaz
macastelaz requested review from a team as code owners October 29, 2026 19:35

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for AWS FIPS endpoints (such as sts-fips) by stripping the -fips suffix from the host name when determining the AWS service name in _generate_authentication_header_map. It also includes a corresponding unit test to verify authentication header generation with a FIPS STS endpoint. No review comments were provided, so there is no additional feedback.

@macastelaz macastelaz self-assigned this Oct 29, 2026
@macastelaz
macastelaz requested review from nbayati and viacheslav-rostovtsev and removed request for lsirac October 29, 2026 20:29

@viacheslav-rostovtsev viacheslav-rostovtsev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@macastelaz
macastelaz merged commit 2e1899e into main Nov 2, 2026
119 checks passed
@macastelaz
macastelaz deleted the fix/aws-sts-fips-service-name branch November 2, 2026 20:06
macastelaz pushed a commit that referenced this pull request Nov 3, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.62.1](google-auth-v2.62.0...google-auth-v2.62.1)
(2026-11-02)


### Bug Fixes

* **auth:** strip -fips suffix from AWS service name in SigV4 signing
([#18920](#18920))
([2e1899e](2e1899e))
* **auth:** use an unencrypted key for mTLS certificate rotation
([#18709](#18709))
([8166325](8166325))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

3 participants