Repository navigation
fix(simplestorage): sign headers passed through WithS3Options on presigned URLs - #29
Merged
Merged
Conversation
…igned URLs PresignURL accepted WithS3Options but never forwarded them to the presigner, so a header added that way, for example X-Tigris-Regions via WithStaticReplicationRegions, was missing from X-Amz-SignedHeaders. Tigris is starting to reject x-amz-* and x-tigris-* headers that are not covered by the signature, which turned the silently dropped option into a rejected upload. The GET, PUT and DELETE presign paths now pass the per-call S3 options into PresignOptions.ClientOptions, so the same header middleware that runs on a direct call runs inside the presigner and the header lands in the signature. Assisted-by: Claude Fable 5.1 via Claude Code Signed-off-by: Yevgeniy Firsov <firsov@tigrisdata.com>
|
…aders Assisted-by: Claude Fable 5.1 via Claude Code Signed-off-by: Yevgeniy Firsov <firsov@tigrisdata.com>
setupEnv returns the restore function, so "defer cleanup()" called the setup at the end of the case and dropped the restore. staticcheck SA9010 now flags it; "defer cleanup()()" runs the setup first and defers the restore. Assisted-by: Claude Fable 5.1 via Claude Code Signed-off-by: Yevgeniy Firsov <firsov@tigrisdata.com>
himank
approved these changes
Oct 1, 2026
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.
Summary
PresignURLacceptedWithS3Optionsbut never forwarded them to the presigner, so a header added that way (for exampleX-Tigris-RegionsviaWithStaticReplicationRegions) was missing fromX-Amz-SignedHeaders.PresignOptions.ClientOptions, so the same header middleware that runs on a direct call runs inside the presigner and the header is signed.Details
Tigris is starting to reject
x-amz-*andx-tigris-*request headers that are not covered by the SigV4 signature (tigrisdata/tigris-os#5587, docs in tigrisdata/tigris-os-docs#550). With the old behaviour a caller could passWithStaticReplicationRegionstoPresignURL, get back a URL that did not signX-Tigris-Regions, and have the upload rejected once the header was sent. Forwarding the options fixes that without any API change: whoever uses the URL must send the same headers with the same values, which is the SigV4 rule for every signed header.New unit tests presign offline with static credentials and check
X-Amz-SignedHeaderson all three methods, with and without options.Test plan
go build ./...npm run formatgo test ./...passes, including the newTestPresignURLSignsS3OptionHeadersAssisted-by: Claude Fable 5.1 via Claude Code
Note
Medium Risk
Changes SigV4 presign behavior for all HTTP methods when S3 options are used; callers relying on the old (broken) unsigned-header behavior could see different signed-header requirements, but the fix aligns with Tigris enforcement.
Overview
PresignURLnow forwards per-callWithS3Optionsinto the AWS presigner so Tigris/S3 middleware headers (e.g.X-Tigris-Regions) appear inX-Amz-SignedHeaders. A sharedpresignOptionshelper wires expiry plusClientOptions.S3OptionsintoPresignOptions.ClientOptionsfor GET, PUT, and DELETE—fixing uploads that were rejected when callers sent unsignedx-tigris-*/x-amz-*headers.Adds offline unit tests that assert signed headers with and without options, a docs example for presigned PUT with replication/metadata headers, and fixes bucket tests to
defer cleanup()()whensetupEnvreturns a factory function.Reviewed by Cursor Bugbot for commit dde5525. Bugbot is set up for automated code reviews on this repo. Configure here.