Repository navigation
fix(signer): exclude unsigned headers regardless of name case - #2104
Conversation
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
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⛔ Files ignored due to path filters (1)
⚙️ Run configuration
⛔ Files ignored due to path filters (1)
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe S3 signer now filters unsigned headers without regard to case and includes ChangesS3 signer header filtering
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established; merge after normal checks. Pre-merge checks |
|
|
@Mohil-Ahuja thanks for the PR. I will take a closer look this week. |
|
@Mohil-Ahuja would you be willing to add a targeted integration test with minio for this? |
|
Sure, added in 6dca4de. |
|
@Mohil-Ahuja Thanks a lot, LGTM |
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
Co-authored-by: brgr-s <[email protected]> (cherry picked from commit c1308f0)
Co-authored-by: brgr-s <[email protected]>
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'sS3FileIOuses sendsRange, soRangewas signed. GET/HEAD sign responses carryCache-Control: private, and Iceberg'sS3V4RestSignerClientcaches 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 differentRangeand got403 SignatureDoesNotMatch.Changes:
is_unsigned_header()compares names witheq_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-requestis added to the unsigned list, as the issue suggests. It's the AWS SDK v2 successor ofamz-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
test_unsigned_headers_ignore_case: the listed headers in several cases stay unsigned;host,content-type,x-amz-content-sha256andrangesare still signed.Range must stay unsigned); with this change it passes.cargo test -p lakekeeper --lib -- s3_signer::sign::test: 42 passed.rustfmt --checkis clean on the file.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 with403 SignatureDoesNotMatch.Summary by CodeRabbit
Rangeandamz-sdk-requestare now excluded from request signing regardless of capitalization, ensuring consistent handling when header names use different casing.amz-sdk-requestheader 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.