Skip to content

AWS, REST: Remote signer client's cache causes 403 errors #15166

Closed as not planned

Description

@adutra

Apache Iceberg version

1.10.1 (latest release)

Query engine

None

Please describe the bug 🐞

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

Activity

  1. added
    bug
    on Jan 28, 2026
  2. added 4 commits that reference this issue on Jan 28, 2026
    29eb284
    ef4787e
    8d461ba
    c43cb8c
  3. added a commit that references this issue on Mar 5, 2026
    bfeb3af
  4. nastra commented on Mar 6, 2026

    @nastra
    Contributor

    @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?

  5. adutra commented on Mar 6, 2026

    @adutra
    ContributorAuthor

    @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.

  6. steveloughran commented on Mar 8, 2026

    @steveloughran
    Contributor

    ...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?

  7. adutra commented on Mar 8, 2026

    @adutra
    ContributorAuthor

    @adutra you'll be expanding the list of headers to ignore in Polaris to that larger set?

    Yes that's the plan.

  8. github-actions commented on Sep 5, 2026

    @github-actions

    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.

  9. github-actions commented on Sep 19, 2026

    @github-actions

    This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions