Skip to content

fix(signer): exclude unsigned headers regardless of name case - #2104

Merged
brgr-s merged 4 commits into
lakekeeper:mainfrom
Mohil-Ahuja:fix/signer-unsigned-headers-case
Oct 12, 2026
Merged

brgr-s merged 4 commits into
lakekeeper:mainfrom
Mohil-Ahuja:fix/signer-unsigned-headers-case

Conversation

@Mohil-Ahuja

@Mohil-Ahuja Mohil-Ahuja commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2099.

The S3 remote signer leaves some request headers out of the signature (range, x-amz-date, amz-sdk-invocation-id, amz-sdk-retry). It compared the client's header names against that list with exact case. The AWS SDK v2 that Iceberg's S3FileIO uses sends Range, so Range was signed. GET/HEAD sign responses carry Cache-Control: private, and Iceberg's S3V4RestSignerClient caches the signature per method, region and URI. The next ranged read of the same object (a Parquet footer, then the body) reused a signature computed over a different Range and got 403 SignatureDoesNotMatch.

Changes:

  • is_unsigned_header() compares names with eq_ignore_ascii_case. HTTP field names are case-insensitive (RFC 9110, section 5.1). The host, copy-source and ACL checks in the same file already lowercase the name; this was the one lookup that didn't.
  • amz-sdk-request is added to the unsigned list, as the issue suggests. It's the AWS SDK v2 successor of amz-sdk-retry (already on the list) and carries the attempt number, so a retry that reuses a cached signature would fail the same way.

Testing

  • New unit test test_unsigned_headers_ignore_case: the listed headers in several cases stay unsigned; host, content-type, x-amz-content-sha256 and ranges are still signed.
  • With the old exact-case comparison the test fails (Range must stay unsigned); with this change it passes.
  • cargo test -p lakekeeper --lib -- s3_signer::sign::test: 42 passed. rustfmt --check is clean on the file.
  • I haven't reproduced the Spark/SeaweedFS setup from the issue end to end; the test covers the header lookup that decides SignedHeaders.

Release notes

S3 remote signing now excludes Range (and the other unsigned headers) from the signature regardless of how the client capitalises the header name, so Iceberg clients that cache signed GET requests no longer fail ranged reads with 403 SignatureDoesNotMatch.

Summary by CodeRabbit

  • Bug Fixes
    • Headers such as Range and amz-sdk-request are now excluded from request signing regardless of capitalization, ensuring consistent handling when header names use different casing.
    • The amz-sdk-request header is now treated as unsigned, while other headers continue to be signed as before. This supports reusing a signature for ranged requests when these headers change.

The S3 remote signer compared request header names against UNSIGNED_HEADERS
case-sensitively. The AWS SDK v2 sends `Range`, so it was signed, and Iceberg's
signer client, which caches GET/HEAD signatures per URI, then failed the next
ranged read of the same object with 403 SignatureDoesNotMatch.

Compare names case-insensitively (RFC 9110, section 5.1), and keep
`amz-sdk-request`, the SDK v2 retry header, out of the signature too.

Fixes lakekeeper#2099
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa26b981-8616-4a53-9258-3661040e39fb

📥 Commits

Reviewing files that changed from the base of the PR and between d5194fe and cd48d4b.


⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 12aa11a3-b3fe-4d6a-9e02-956fefebdfc4

📥 Commits

Reviewing files that changed from the base of the PR and between 8b3be08 and 6dca4de.


⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

📒 Files selected for processing (2)
  • crates/lakekeeper-integration-tests/Cargo.toml
  • crates/lakekeeper-integration-tests/tests/server_generic_table_signing.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



Walkthrough

The S3 signer now filters unsigned headers without regard to case and includes amz-sdk-request in the unsigned-header list. Unit and opt-in S3-compatible integration tests cover header filtering and reuse of a signature for ranged reads.

Changes

S3 signer header filtering

Layer / File(s) Summary
Unsigned-header filtering
crates/lakekeeper/src/server/s3_signer/sign.rs
The unsigned-header list now includes amz-sdk-request. Header filtering uses case-insensitive matching. A unit test checks unsigned names in different cases and confirms that host, content headers, and ranges remain signable.
S3-compatible signed request reuse
crates/lakekeeper-integration-tests/Cargo.toml, crates/lakekeeper-integration-tests/tests/server_generic_table_signing.rs
Opt-in integration tests configure an S3-compatible endpoint, sign requests, and send them with optional header overrides and bodies. The test uploads an object, then reuses a signature for two different ranges and checks the partial responses and returned bytes.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: c-thiel

Merge Risk: ⚪ Minimal · up to 6dca4

No actionable merge-blocking issue is established; merge after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: excluding unsigned headers without regard to header-name case.
Linked Issues check Passed Issue #2099 requires range to stay unsigned regardless of header-name case. The signer now uses eq_ignore_ascii_case for unsigned-header filtering and adds amz-sdk-request to the unsigned list. …
Out of Scope Changes check Passed The changes remain within issue #2099. The signer update, unit test, integration test, and reqwest development dependency all support verification of cached S3 signature reuse. No unrelated change i…

Full details: Docstring Coverage

Explanation

Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. (1 skipped: 1 unsupported.)


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the headers twice
The range names fall in lowercase
One signed request hops back again
Four bytes arrive, then four more
The bunny stamps the test as green

Comment @coderabbitai help to get the list of available commands.

@cla-assistant

cla-assistant Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 9, 2026
@brgr-s

brgr-s commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@Mohil-Ahuja thanks for the PR. I will take a closer look this week.

@brgr-s

brgr-s commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@Mohil-Ahuja would you be willing to add a targeted integration test with minio for this?

@Mohil-Ahuja

Copy link
Copy Markdown
Contributor Author

Sure, added in 6dca4de. s3_compat_integration_tests::test_cached_signature_serves_another_range uploads an object through the signer, signs a ranged GET with title-case Range, Amz-Sdk-Invocation-Id and Amz-Sdk-Request headers, and then sends that signature again for a different range and attempt, the way a client with a cached signature does. MinIO returns 206 with the right bytes both times. With the signer change reverted, the second request gets SignatureDoesNotMatch.

@brgr-s

brgr-s commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@Mohil-Ahuja Thanks a lot, LGTM

@brgr-s
brgr-s enabled auto-merge (squash) October 12, 2026 20:13
@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@brgr-s
brgr-s merged commit c1308f0 into lakekeeper:main Oct 12, 2026
71 checks passed
brgr-s added a commit that referenced this pull request Oct 15, 2026
brgr-s added a commit that referenced this pull request Oct 15, 2026
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.

Remote signing: range excluded from signing case-sensitively, breaks Iceberg signer cache (403 SignatureDoesNotMatch on second ranged GET)

2 participants