Repository navigation
aws: keep other URL options when assuming a role - #3849
Merged
Merged
Conversation
With role set, V2ConfigFromURLParams replaced the option list with only the assumed role's credentials and the region, so fips, dualstack, profile and the checksum settings only reached the STS client and not the returned config. Append the credentials provider instead.
iamabhilaksh
marked this pull request as ready for review
November 16, 2026 12:18
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3849 +/- ##
==========================================
+ Coverage 80.35% 80.66% +0.31%
==========================================
Files 104 104
Lines 12571 12617 +46
==========================================
+ Hits 10101 10178 +77
+ Misses 2469 2438 -31
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
URL openers take their AWS settings from the URL. For example:
s3://my-bucket?region=us-east-1&fips=true&role=arn:aws:iam::123456789012:role/my-roleThat URL holds two kinds of settings:
rolemeans "assume this role before calling AWS".fips,dualstack,profile,request_checksum_calculationandresponse_checksum_validation.When
roleis set,V2ConfigFromURLParamsworks in three steps (aws.go#L203-L211):Step 3 starts from scratch, so every connection option is dropped and no error is reported. STS gets the options, but the service client, which is the one that actually matters, doesn't. With the URL above:
fips=truewas set.The checksum options are dropped the same way, so S3 keeps sending checksums the user turned off.
endpointandrate_limiter_capacitystill work, because they're applied after this step.The list has been replaced like this since
rolewas added in #3716. #3732 moved this step so STS gets the options, but step 3 still starts from the new list.Change
aws/aws.go: in step 3, append the role's credentials to the existing options instead of starting a new list. The role's credentials still win, because they're added last.TestV2ConfigFromURLParamsAssumeRoleKeepsOptions: setsrolewithfips,dualstackand both checksum options, then checks that all of them reach the returned config.TestV2ConfigFromURLParamsAssumeRoleKeepsProfile: setsrolewith aprofilethat has its own keys andrequest_checksum_calculation = when_required. It checks that the profile's setting is kept and that the credentials still come from the role, not from the profile.Impact and risk
roletogether with these options silently loses them on the service client. Forfips, that means traffic is expected to go to FIPS endpoints but doesn't.Testing
fips=truewith a role, 2 runs each:sts-fips.us-east-1.amazonaws.com, and S3 went to<bucket>.s3.us-east-1.amazonaws.com(not FIPS).<bucket>.s3-fips.us-east-1.amazonaws.com.role, master already uses FIPS.when_requiredwith a role, 2 runs each:PutObjectstill sentx-amz-sdk-checksum-algorithm: CRC32plus a CRC32 trailer, andGetObjectsentx-amz-checksum-mode: ENABLED.role.TestV2ConfigFromURLParamsAssumeRolestill passes, so the role's credentials are still used.go testpasses foraws/...,blob/s3blob,docstore/awsdynamodb/v2,pubsub/awssnssqs,secrets/awskms,runtimevar/awsparamstoreandruntimevar/awssecretsmanager.Checks (go1.27.3 and go1.26.10):
go test -race ./aws/...,go vet,gofmt -sand golangci-lint v2.14.0 pass.go.modis unchanged.