Skip to content

fix(s3): vended-credential validation write names the warehouse KMS key - #2036

Merged
c-thiel merged 2 commits into
lakekeeper:mainfrom
teamrunninglake:fix/vended-validation-honours-sse-kms
Oct 5, 2026
Merged

c-thiel merged 2 commits into
lakekeeper:mainfrom
teamrunninglake:fix/vended-validation-honours-sse-kms

Conversation

@teamrunninglake

@teamrunninglake teamrunninglake commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What

lakekeeper_io_from_vended_table_config — the client validate_vended_credentials_access writes its test object with — now reads s3.sse.type / s3.sse.key from the vended table config and sets aws_kms_key_arn on the S3Settings it builds, so that write carries SSE-KMS with the warehouse key, the way a client honouring the vended config does.

Why

generate_table_config advertises s3.sse.type = kms and s3.sse.key = <aws-kms-key-arn> whenever the warehouse profile names a KMS key, and the downscoped session policy it vends (get_sts_policy_string) grants kms:Decrypt and kms:GenerateDataKey on that one key only. The validation client read region, endpoint, path-style access and the three credential fields and nothing else, so its test write carried no SSE header, S3 encrypted it with the bucket's default key, and on any bucket whose default key is not the warehouse key the write was refused by the very session policy the server had just vended:

400 PermissionDenied: IO error at `s3://<bucket>/<prefix>/<uuid>/vended-test/metadata/test`: S3 write failed:
User: arn:aws:sts::<account>:assumed-role/<assume-role>/lakekeeper-sts is not authorized to perform: kms:GenerateDataKey
on resource: arn:aws:kms:<region>:<account>:key/<the bucket's default key> because no session policy allows the kms:GenerateDataKey action

That makes sts-enabled: true + aws-kms-key-arn unusable at create and at every storage-profile update on a bucket keyed by a different CMK (a per-warehouse or per-tenant CMK on a bucket with its own default encryption is the ordinary shape in AWS), while the same warehouse works when the profile's key equals the bucket default — which is why it does not show on MinIO or on a single-key bucket. Measured on Lakekeeper 0.13.4 with credential-type: aws-system-identity, assume-role-arn and an external id; the path is unchanged on main.

Change

  • crates/lakekeeper/src/service/storage/s3.rs: lakekeeper_io_from_vended_table_config maps s3.sse.type == "kms" + s3.sse.key to S3Settings::aws_kms_key_arn; other SSE types and an absent advertisement set no key (S3 applies the bucket default, as before for those cases). Doc comment says what the client does with it.
  • Unit test test_vended_io_names_the_advertised_sse_kms_key: KMS advertised → the client names that key; nothing advertised → none; another SSE type → none. No network: it inspects S3Storage::aws_kms_key_arn().

S3Storage already sets ServerSideEncryption::AwsKms and ssekms_key_id on put_object and create_multipart_upload from that field, so no change in lakekeeper-io.

Release notes

  • S3 warehouses with sts-enabled and aws-kms-key-arn can now be created and updated on buckets whose default encryption key differs from the warehouse key: the vended-credential validation write names the warehouse's KMS key, matching the downscoped session policy it is vended with.

Summary by CodeRabbit

  • Enhancements
    • S3-backed tables now apply the configured KMS key when server-side encryption is set to KMS.
    • For other encryption settings or when server-side encryption is not configured, no KMS key is passed to S3 storage. These configurations continue to work without a KMS key being set.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 015f2104-98a7-4aa9-8b85-73dc1abf7f82
📥 Commits

Reviewing files that changed from the base of the PR and between 4213046 and 9c78029.

📒 Files selected for processing (1)
  • crates/lakekeeper/src/service/storage/s3.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 vended S3 configuration extracts the SSE key when the SSE type is kms and passes it to S3Settings. Tests cover KMS, absent SSE configuration, and non-KMS configuration.

Changes

S3 SSE-KMS configuration

Layer / File(s) Summary
Parse and validate SSE-KMS settings
crates/lakekeeper/src/service/storage/s3.rs
The parser extracts s3.sse.key only when s3.sse.type is kms and passes the optional key to S3Settings. Tests cover KMS, absent SSE, and non-KMS configurations.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: c-thiel

Merge Risk: ⚪ Minimal · up to 9c780

The advertised warehouse KMS key reaches the validation writes, so no material merge risk is evident.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 9c780

The validation write now names the warehouse’s advertised encryption key without expanding storage permissions or key access. The reviewed path introduces no material security risk; live AWS behavior was not tested.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed behavior is bounded to validation clients consuming warehouse-generated SSE-KMS configuration. Naming the key changes encryption selection for the test write, but does not increase the session’s permitted prefixes, KMS resources or actions.

Trust Boundaries and Controls

  • inferred — The inspected caller provides server-generated configuration, not a newly accepted external key selector. Forwarding the advertised ARN aligns the write with existing key-scoped authorization; selecting a key does not itself grant permission to use it.

Resilience and Maintainability Implications

  • inferred — The change preserves validation’s write/read/delete sequence, independent parent no-write check and final direct-client cleanup after internal probe outcomes. Shared-location cleanup races and best-effort multipart abort limitations predate this change; they are not new guarantees or introduced concerns. Arbitrary cancellation of the entire request remains unverified.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: the vended-credential validation write uses the warehouse KMS key.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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 S3 key,
When KMS is set, it passes free.
No SSE? The key stays still,
Other types do not fill.
Tests hop through each case with care,
And leave the settings clear.

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

@cla-assistant

cla-assistant Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Sep 22, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


anbu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

lakekeeper_io_from_vended_table_config reads s3.sse.type / s3.sse.key from the
vended table config and sets aws_kms_key_arn on the S3Settings it builds, so the
credential validation write carries SSE-KMS with the warehouse key -- the one key
the downscoped session policy grants. On a bucket whose default encryption key
differs from the warehouse key, the write was encrypted with the bucket default
and refused by that session policy (kms:GenerateDataKey), so a warehouse with
sts-enabled and aws-kms-key-arn could not be created or updated there.

Unit test: KMS advertised -> the client names that key; nothing advertised or
another SSE type -> none.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@teamrunninglake
teamrunninglake force-pushed the fix/vended-validation-honours-sse-kms branch from 1d11fc2 to 4213046 Compare September 23, 2026 18:13
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

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

@c-thiel c-thiel added this to the Release 0.14.0 milestone Oct 5, 2026
@c-thiel
c-thiel merged commit 079bf2b into lakekeeper:main Oct 5, 2026
70 checks passed
brgr-s pushed a commit that referenced this pull request Oct 15, 2026
…ey (#2036)

Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: Christian <[email protected]>
(cherry picked from commit 079bf2b)
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.

2 participants