Repository navigation
fix(s3): cache the identity remote signing signs with - #2170
Conversation
With an assumed role or the system identity, every sign request called STS (and the base credential provider) again, because signing asks the credential provider directly. The identity is now cached per storage profile and credential for half its lifetime, at most one hour, in the short-term credentials cache. Static keys stay uncached.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Generalized cache foundation crates/lakekeeper/src/service/storage/cache.rs |
The shared cache utilities support generic keys and cache types. The storage-context key supports the S3 signing identity cache. Metrics report sizes for the short-term credential caches and the signing identity cache. |
S3 signing identity integration and tests crates/lakekeeper/src/service/storage/s3.rs |
S3 signing identity lookup bypasses caching for credentials that do not assume a role and are not AWS system identities. Other identities use the cache. Tests cover reuse, expiration, static identity validity, and separate loads for different external IDs. |
Provider cache labeling and documentation crates/lakekeeper/src/service/storage/az/mod.rs, crates/lakekeeper/src/service/storage/gcs/mod.rs, crates/lakekeeper/src/service/storage/s3.rs, docs/docs/configuration.md, docs/docs/monitoring.md, crates/lakekeeper/src/service/cache_metrics.rs |
Azure, GCS, and S3 short-term credential lookups pass the ShortTermCredentials cache type. The documentation describes the S3 signing cache, per-cache capacity, and cache metric types. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant S3Profile
participant SigningIdentityCache
participant STS
S3Profile->>SigningIdentityCache: Look up identity by storage context and credential
SigningIdentityCache->>STS: Load identity on cache miss
STS-->>SigningIdentityCache: Return identity
SigningIdentityCache-->>S3Profile: Return signing identity
Possibly related PRs
- lakekeeper/lakekeeper#2174: Centralizes S3 system-identity validation in SDK configuration and signing paths, which is relevant to cached identities.
- lakekeeper/lakekeeper#2165: Adds lazy identity caching for assume-role credentials used by S3 SDK storage clients; this PR caches identities used by S3 remote signing.
Suggested reviewers: brgr-s
Merge Risk: 
Minimal · up to dbbc3
-
No actionable merge-blocking issue is established from the supplied evidence; normal validation remains appropriate.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- 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.
A rabbit checks the cache at night,
A signing identity stays in sight.
With role or system keys in play,
The cache recalls them on the way.
Expiry marks when they depart,
And fresh requests can make a start.
Comment @coderabbitai help to get the list of available commands.
The cache of signing identities reports hits, misses and size as `s3_signing_identity`, so signing traffic does not hide the hit rate of the vended-credentials cache. Comments and docs describe the cache as it is.
System-identity keys without an expiry (from the environment or a credentials file) are cached for five minutes, so concurrent sign requests do not wait for each other to load them. Docs name the signing cache as a separate cache and list its metric type.
81759d2 to
4fbff11
Compare
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
(cherry picked from commit 6eb29c5)
Summary
With an assumed role or the system identity, every S3 sign request called STS (and the base credential provider) again: signing asks the credential provider directly, and the SDK's
AssumeRoleProviderdoes not cache. One sign request per engine S3 request meant one or two STS calls per S3 request.LAKEKEEPER__CACHE__STC__ENABLEDand__CAPACITYapply to this cache too.Evidence
AssumeRolecalls (local STS mock).After: 1 call. A different external ID → its own call; the test fails if the credential is left out of the key.
Merge Danger
Door: two-way. No stored data changes.
Blast Radius: S3 remote signing.
Release notes
Bug Fixes
Summary by CodeRabbit
s3_signing_identityas a cache type for monitoring.