You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The S3V4RestSignerClient caches signed responses based on a key that only includes method, region, and uri, but not request headers.
When a cached signed response is reused for a different request with the same method/region/uri but different headers, the reconstructHeaders method overwrites the signed headers with the original request headers, invalidating the signature.
Example Scenario
Request A (PUT object with content hash abc123):
Method: PUT
URI: s3://bucket/path/to/file.avro
Headers: x-amz-content-sha256: abc123
Server signs this request and returns signed headers.
Client caches the response with key {PUT, us-east-1, s3://bucket/path/to/file.avro}.
Request B (PUT different content to the same URI with content hash def456):
Method: PUT
URI: s3://bucket/path/to/file.avro
Headers: x-amz-content-sha256: def456
Cache hit, same key {PUT, us-east-1, s3://bucket/path/to/file.avro}. reconstructHeaders takes the cached signed headers from Request A.
The signature was computed for x-amz-content-sha256: abc123, but the request now has x-amz-content-sha256: def456.
S3 rejects the request with 403 Forbidden because the signature doesn't match the request
Impact
This bug causes intermittent 403 Forbidden errors when:
Multiple requests target the same URI with different content
The requests occur within the 30-second cache TTL
The server returns Cache-Control: private (enabling caching)
Suggested Fix
The cache key should include headers that are part of the signature calculation, particularly x-amz-content-sha256.
Alternatively, the caching logic should verify that the cached signed headers are compatible with the current request headers before reusing them.
Willingness to contribute
I can contribute a fix for this bug independently
I would be willing to contribute a fix for this bug with guidance from the Iceberg community
I cannot contribute a fix for this bug at this time
@adutra isn't the issue here that the server sent back cache-control: private for a PUT request? By default, the server should really only be caching GET and HEAD requests as I don't think PUT requests are safe to be cached?
@adutra isn't the issue here that the server sent back cache-control: private for a PUT request? By default, the server should really only be caching GET and HEAD requests as I don't think PUT requests are safe to be cached?
Indeed, this example is contrived. But there is nothing in the specs that forbids a server from doing so. At least a spec clarification could be welcome (or some client-side defence mechanism).
And we uncovered another problematic use case: a GET request with the range header. The server could legitimately sign that header. But if it does so, it also breaks the client's cache.
...more problematic for me is that trace information can be attached by the sdk and s3a and those headers don't get stripped right now. Doing it server side is enough though.
@adutra you'll be expanding the list of headers to ignore in Polaris to that larger set?
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
Activity
AWS: Fix S3V4RestSignerClient cache key to include all request compon…
AWS: Fix S3V4RestSignerClient cache key to include all request compon…
AWS: Fix S3V4RestSignerClient cache key to include all request compon…
AWS: Fix S3V4RestSignerClient cache key to include all request compon…
AWS: Fix S3V4RestSignerClient cache key to include all request compon…
nastra commentedon Mar 6, 2026
@adutra isn't the issue here that the server sent back
cache-control: privatefor aPUTrequest? By default, the server should really only be cachingGETandHEADrequests as I don't thinkPUTrequests are safe to be cached?adutra commentedon Mar 6, 2026
Indeed, this example is contrived. But there is nothing in the specs that forbids a server from doing so. At least a spec clarification could be welcome (or some client-side defence mechanism).
And we uncovered another problematic use case: a
GETrequest with therangeheader. The server could legitimately sign that header. But if it does so, it also breaks the client's cache.steveloughran commentedon Mar 8, 2026
...more problematic for me is that trace information can be attached by the sdk and s3a and those headers don't get stripped right now. Doing it server side is enough though.
@adutra you'll be expanding the list of headers to ignore in Polaris to that larger set?
adutra commentedon Mar 8, 2026
Yes that's the plan.
github-actions commentedon Sep 5, 2026
This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.
github-actions commentedon Sep 19, 2026
This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'