Repository navigation
feat: Caching Short-Term-Credentials (STC) - #1459
Conversation
WalkthroughAdds Hash implementations to many types, introduces a moka-based Short-Term Credentials (STC) cache with custom expiry, refactors storage backends to use a unified ShortTermCredentialsRequest, wires caching into S3/GCS/Azure STS/SAS flows, adds STC config and a small router log. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant Backend as StorageBackend
participant Cache as STC_CACHE
participant Provider as STS/SAS Provider
Client->>Backend: generate_table_config(stc_request)
Backend->>Backend: build STCCacheKey(stc_request, profile_hash, cred_hash)
Backend->>Cache: get(key)
alt cache hit
Cache-->>Backend: STCCacheValue(token, valid_until)
else cache miss
Backend->>Provider: request STS/SAS (using stc_request)
Provider-->>Backend: token + expiry
Backend->>Cache: insert(key, STCCacheValue(token, valid_until)) (if enabled)
end
Backend->>Backend: assemble TableConfig using token
Backend-->>Client: TableConfig
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
crates/lakekeeper/src/service/storage/az.rs (1)
385-404: Fix directory depth for empty paths.For an empty rootless_path, split('/') yields 1; depth should be 0.
Apply:
- let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); - let depth = rootless_path.split('/').count(); + let rootless_path = path.trim_start_matches('/').trim_end_matches('/'); + let depth = if rootless_path.is_empty() { + 0 + } else { + rootless_path.split('/').count() + };crates/lakekeeper/src/service/storage/gcs/sts.rs (1)
29-46: Use form-encoded body for Google STS; JSON here is incorrect and risks rejection.The STS token endpoint expects application/x-www-form-urlencoded with snake_case fields. Sending JSON (and snake_case) can fail and is not per spec. Switch to .form(&gcs_sts_request).
Apply:
- .post(STS_URL.clone()) - .json(&gcs_sts_request) + .post(STS_URL.clone()) + .form(&gcs_sts_request)Refs: Google IAM STS token docs and downscoped credential guide. (cloud.google.com)
crates/lakekeeper/src/service/storage/s3.rs (1)
652-661: Avoid unwrap() when building AWS credentials from R2 response.unwrap() can panic; propagate a structured error instead.
Apply:
- Ok(aws_sdk_sts::types::Credentials::builder() + let creds = aws_sdk_sts::types::Credentials::builder() .access_key_id(tmp_credentials.result.access_key_id) .secret_access_key(tmp_credentials.result.secret_access_key) .session_token(tmp_credentials.result.session_token) .expiration( (std::time::SystemTime::now() + std::time::Duration::from_secs(ttl_seconds)).into(), ) - .build() - .unwrap()) + .build() + .map_err(|e| CredentialsError::ShortTermCredential { + source: Some(Box::new(e)), + reason: "Failed to build AWS credentials from Cloudflare R2 response".to_string(), + })?; + Ok(creds)
🧹 Nitpick comments (14)
crates/lakekeeper/src/config.rs (1)
435-449: Harden STC cache deserialization and add brief docs.Add
#[serde(default)]so missing fields default gracefully; add short field docs for clarity.-#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] -pub struct Cache { - pub stc: STCCache, -} +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Cache { + /// Short‑Term Credentials cache configuration. + pub stc: STCCache, +} -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -pub struct STCCache { - pub enabled: bool, -} +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[serde(default)] +pub struct STCCache { + /// Toggle STC caching (default: true). + pub enabled: bool, +} impl std::default::Default for STCCache { fn default() -> Self { Self { enabled: true } } }Optional nit: consider
StcCachefor Rust-style acronym casing to reduce inconsistent type names.crates/lakekeeper/src/api/iceberg/v1/tables.rs (2)
391-396: Derive Eq for DataAccess.The type is Copy + PartialEq with only bool fields; Eq is appropriate and useful for hashed collections.
Apply this minimal change:
-#[derive(Debug, Hash, Clone, PartialEq, Copy)] +#[derive(Debug, Hash, Clone, PartialEq, Eq, Copy)] pub struct DataAccess {Also, the comment “Modeled as a string...” is stale; consider updating it to reflect the bool fields.
398-404: Derive Eq for DataAccessMode.Enum is Copy + PartialEq; Eq is a natural addition.
-#[derive(Debug, Hash, Clone, Copy, PartialEq, derive_more::From)] +#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq, derive_more::From)] pub enum DataAccessMode {crates/io/src/s3.rs (1)
59-63: Add Eq derives for consistency and map/set ergonomics.These types are already PartialEq; Eq is appropriate and helps with collections.
-#[derive(Debug, Hash, Clone, PartialEq, derive_more::From)] +#[derive(Debug, Hash, Clone, PartialEq, Eq, derive_more::From)] pub enum S3Auth { ... } -#[derive(Redact, Hash, Clone, PartialEq)] +#[derive(Redact, Hash, Clone, PartialEq, Eq)] pub struct S3AwsSystemIdentityAuth { ... } -#[derive(Redact, Hash, Clone, PartialEq, typed_builder::TypedBuilder)] +#[derive(Redact, Hash, Clone, PartialEq, Eq, typed_builder::TypedBuilder)] pub struct S3AccessKeyAuth { ... }Also, since these structs include secrets, double-check we never log their hash/fingerprint values. Redaction on Debug is already in place.
Also applies to: 78-83, 84-92
crates/lakekeeper/src/service/storage/cache.rs (3)
23-33: Reduce collision risk in cache key fingerprints.Using two 64‑bit fxhash digests for storage_profile and credential is fast but non‑cryptographic; extremely rare collisions could misassociate STC entries across distinct profiles/creds. Prefer a wider or stronger digest.
Two lightweight options:
- Switch to a 128‑bit fingerprint (e.g., siphasher::sip128, blake3 128-bit output), or
- Avoid prehashing and include a compact, stable projection (e.g., base location + key_prefix + region for S3; credential type + last 8 chars of IDs) alongside the request.
Example (using siphasher 128-bit):
- pub(super) storage_profile_hash: u64, - pub(super) credential_hash: u64, + pub(super) storage_profile_fingerprint: u128, + pub(super) credential_fingerprint: u128, @@ - let storage_profile_hash = fxhash::hash64(&storage_profile); - let credential_hash = fxhash::hash64(&credential); + use siphasher::sip128::{SipHasher13, Hasher128}; + fn fp128<T: std::hash::Hash>(t: &T) -> u128 { + let mut h = SipHasher13::new(); + t.hash(&mut h); + let x = h.finish128(); + ((x.hi() as u128) << 64) | (x.lo() as u128) + } + let storage_profile_fingerprint = fp128(&storage_profile); + let credential_fingerprint = fp128(&credential); @@ - storage_profile_hash, - credential_hash, + storage_profile_fingerprint, + credential_fingerprint,Also applies to: 50-65
11-21: Make cache sizing/expiry tunable and observable.Hardcoded max_capacity (10k) and expire_after only may not fit all deployments.
- Read capacity and cap from config/env (e.g., LAKEKEEPER_STC_CACHE_MAX, LAKEKEEPER_STC_CACHE_TTL_CAP_SECS).
- Add metrics: hit/miss, evictions, insertions; consider an eviction_listener for debug logging.
79-101: Consider a small fallback TTL when valid_until is None.Returning 0s disables caching for tokens without explicit expiry (e.g., some remote-signing flows). A short default (e.g., 30–60s) reduces thundering herds without staleness risk.
- let Some(valid_until) = value.valid_until else { - return Some(Duration::from_secs(0)); - }; + let Some(valid_until) = value.valid_until else { + // Configurable or small default to smooth bursts + return Some(Duration::from_secs(30)); + };I can wire this behind a config flag if desired.
crates/lakekeeper/src/service/storage/mod.rs (3)
98-114: ShortTermCredentialsRequest: solid encapsulation; consider Serialize if you plan to log/trace.If this ever needs structured logging or over-the-wire transport, add serde derives; otherwise LGTM.
270-276: Unify backend signatures to borrow STC request consistently.Currently S3/Az take stc_request by value while GCS takes &stc_request. Prefer borrowing across the board to avoid unnecessary clones and keep APIs uniform.
Example:
- .generate_table_config( + .generate_table_config( data_access, secret .map(|s| s.try_to_s3()) .transpose() .map_err(CredentialsError::from)?, - stc_request, + &stc_request, request_metadata, )Apply similarly in az.rs and adjust signatures accordingly.
Also applies to: 286-286, 300-300, 315-315
877-877: Derive Eq for StorageCredential as well.It already derives Hash + PartialEq; Eq is appropriate and often required by maps/sets.
-#[derive(Debug, Hash, Clone, PartialEq, Serialize, Deserialize, derive_more::From)] +#[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize, derive_more::From)] pub enum StorageCredential {crates/lakekeeper/src/service/storage/az.rs (1)
288-296: Make cache TTL skew-safe (subtract a safety margin).Current TTL equals configured validity; near-expiry usage may fail. Subtract a small skew (e.g., 60s) when computing valid_until.
Apply:
- let sts_validity_duration = Duration::from_secs( - self.sas_token_validity_seconds - .unwrap_or(SAS_TOKEN_DEFAULT_VALIDITY_SECONDS), - ); - let valid_until = Instant::now().checked_add(sts_validity_duration); + // Subtract a small skew to avoid serving near-expiry tokens + let configured = self + .sas_token_validity_seconds + .unwrap_or(SAS_TOKEN_DEFAULT_VALIDITY_SECONDS); + let skew = 60; + let ttl = configured.saturating_sub(skew); + let valid_until = Instant::now().checked_add(Duration::from_secs(ttl));crates/lakekeeper/src/service/storage/gcs/mod.rs (2)
369-376: Add skew when caching STS tokens.Subtract a small safety margin from expires_in to avoid serving near-expiry tokens.
Apply:
- let cache_value = STCCacheValue::new( - ShortTermCredential::Gcs(token.clone()), - Instant::now().checked_add(sts_validity_duration), - ); + // Be conservative: subtract 60s skew from cache TTL + let ttl = sts_validity_duration.saturating_sub(Duration::from_secs(60)); + let cache_value = STCCacheValue::new( + ShortTermCredential::Gcs(token.clone()), + Instant::now().checked_add(ttl), + );
421-427: Nit: Log says “SAS token”; should be “STS token”.Update the debug log to avoid confusion.
Apply:
- "STC caching disabled, fetching new SAS token for request: {stc_request}" + "STC caching disabled, fetching new STS token for request: {stc_request}"crates/lakekeeper/src/service/storage/s3.rs (1)
519-524: Add skew to cached STS credentials TTL.Reduce TTL by ~60s to avoid near-expiry usage.
Apply:
- let sts_validity_duration = Duration::from_secs(self.sts_token_validity_seconds); - let valid_until = Instant::now().checked_add(sts_validity_duration); + let configured = self.sts_token_validity_seconds; + let ttl = configured.saturating_sub(60); + let valid_until = Instant::now().checked_add(Duration::from_secs(ttl));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
crates/io/src/location.rs(1 hunks)crates/io/src/s3.rs(2 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(1 hunks)crates/lakekeeper/src/api/router.rs(1 hunks)crates/lakekeeper/src/config.rs(4 hunks)crates/lakekeeper/src/service/storage/az.rs(9 hunks)crates/lakekeeper/src/service/storage/cache.rs(1 hunks)crates/lakekeeper/src/service/storage/gcs/mod.rs(10 hunks)crates/lakekeeper/src/service/storage/gcs/sts.rs(2 hunks)crates/lakekeeper/src/service/storage/mod.rs(9 hunks)crates/lakekeeper/src/service/storage/s3.rs(23 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
crates/lakekeeper/src/service/storage/cache.rs (1)
crates/lakekeeper/src/service/storage/s3.rs (1)
storage_profile(1405-1431)
crates/lakekeeper/src/config.rs (1)
crates/authz-openfga/src/config.rs (3)
default(101-103)config(43-43)get_config(29-51)
crates/lakekeeper/src/service/storage/mod.rs (3)
crates/io/src/location.rs (1)
fmt(266-268)crates/lakekeeper/src/service/identifier/tabular.rs (1)
fmt(45-47)crates/lakekeeper/src/service/storage/az.rs (1)
from(511-538)
crates/lakekeeper/src/service/storage/gcs/sts.rs (1)
crates/lakekeeper/src/service/storage/gcs/mod.rs (1)
token(162-172)
crates/lakekeeper/src/service/storage/gcs/mod.rs (2)
crates/lakekeeper/src/service/storage/cache.rs (2)
new(51-64)new(68-76)crates/lakekeeper/src/service/storage/gcs/sts.rs (1)
downscope(10-54)
crates/lakekeeper/src/service/storage/az.rs (1)
crates/lakekeeper/src/service/storage/cache.rs (2)
new(51-64)new(68-76)
crates/lakekeeper/src/service/storage/s3.rs (1)
crates/lakekeeper/src/service/storage/cache.rs (2)
new(51-64)new(68-76)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: docker / docker
- GitHub Check: sqlx-check
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: clippy
- GitHub Check: docker / docker
- GitHub Check: check-generated-openapi-matches
- GitHub Check: docker / docker
🔇 Additional comments (8)
crates/lakekeeper/src/api/router.rs (1)
233-233: LGTM! Enhanced observability during router initialization.The added logging provides early visibility into the CORS configuration being applied. This is helpful for debugging and confirming configuration at startup.
crates/lakekeeper/src/config.rs (2)
520-520: Default wiring looks correct.
cache: Cache::default()correctly enables STC caching by default and integrates with figment defaults.
1073-1095: Nice, targeted tests for env overrides.Covers default, false, and true; aligns with test prefix
LAKEKEEPER_TEST__.crates/io/src/location.rs (1)
11-15: Hashing only full_location looks good; please confirm invariant holds across all mutators.Hash uses full_location while Eq compares all fields. This is fine as long as full_location is always kept in sync with scheme and authority_and_path (setters seem to do this). A quick grep-based check for any mutations that don’t recompose full_location would be prudent.
crates/lakekeeper/src/service/storage/mod.rs (3)
42-62: Deriving Hash on StorageProfile is appropriate. Add Eq for completeness.Eq is natural here and aligns with usage in hashed collections.
-#[derive(Debug, Hash, Clone, Eq, PartialEq, Serialize, Deserialize, derive_more::From)] +#[derive(Debug, Hash, Clone, Eq, PartialEq, Serialize, Deserialize, derive_more::From)] // (Eq already present — good.) No change needed if Eq is indeed present in your tree.If Eq is already present (as it appears), ignore this.
64-72: Borrowed enums for hashing are a good call.This avoids cloning large profiles/creds when computing fingerprints.
Also applies to: 944-949
85-90: Display on StoragePermissions is a nice touch for logs and messages.LGTM.
crates/lakekeeper/src/service/storage/gcs/sts.rs (1)
56-62: Response model looks right; redaction is a nice touch.
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/lakekeeper/src/config.rs (1)
436-450: Add documentation for cache configuration structs.The
CacheandSTCCachestructs lack documentation explaining their purpose and how to configure them via environment variables.Apply this diff to add documentation:
+/// Caching configuration. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] pub(crate) struct Cache { + /// Short-Term Credentials (STC) cache configuration. pub stc: STCCache, } +/// Configuration for Short-Term Credentials (STC) caching. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub(crate) struct STCCache { + /// Enable STC caching. Defaults to true. + /// Env path: {ICEBERG_REST__, LAKEKEEPER__, LAKEKEEPER_TEST__}CACHE__STC__ENABLED pub enabled: bool, }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/lakekeeper/src/config.rs(4 hunks)
🧰 Additional context used
🪛 GitHub Actions: Unittests
crates/lakekeeper/src/config.rs
[error] 437-437: Clippy error: unreachable pub item.
[error] 1-1: Command failed: cargo clippy --no-default-features --all-targets --workspace -- -D warnings
🪛 GitHub Check: check-generated-openapi-matches
crates/lakekeeper/src/config.rs
[failure] 442-442:
unreachable pub item
[failure] 437-437:
unreachable pub item
🪛 GitHub Check: clippy
crates/lakekeeper/src/config.rs
[failure] 442-442:
unreachable pub item
[failure] 437-437:
unreachable pub item
🪛 GitHub Check: test
crates/lakekeeper/src/config.rs
[failure] 442-442:
unreachable pub item
[failure] 437-437:
unreachable pub item
🔇 Additional comments (3)
crates/lakekeeper/src/config.rs (3)
256-259: LGTM! Field visibility and serde defaulting are correctly applied.The
cachefield is properly scoped topub(crate)and includes#[serde(default)]for resilient deserialization, as recommended in the previous review.
521-521: LGTM! Cache initialization is correct.The
cachefield is properly initialized withCache::default(), consistent with the Default implementations.
1075-1096: LGTM! Comprehensive test coverage for STC cache configuration.The test properly validates all three scenarios:
- Default enabled state
- Explicit disable via environment variable
- Explicit enable via environment variable
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (5)
crates/io/src/adls.rs (1)
56-56: LGTM! Consider Hash implementation for caching use cases.The
Eqderive is valid and all enum variants properly support equality comparison. Given the PR context (caching Short-Term Credentials), these types might benefit from also derivingHashto enable use in hash-based collections (e.g.,HashMap,HashSet). However, if hashing is not needed or is implemented elsewhere, the current change is sufficient.crates/lakekeeper/src/service/storage/cache.rs (2)
103-123: Expiry: confirm zero-duration behavior; consider clamping to a minimal positive TTL.Returning Duration::from_secs(0) may be treated as “expire immediately,” but moka’s Expiry contract expects a positive duration. Please confirm behavior and, if needed, clamp to at least 1s to avoid undefined semantics.
Example:
- return Some(Duration::from_secs(0)); + return Some(Duration::from_secs(1)); ... - return Some(Duration::from_secs(0)); + return Some(Duration::from_secs(1));
125-132: Cache size gauge drifts on background evictions.Gauge is updated only on get/insert. Evictions (time-/capacity-based) won’t refresh it until the next op. Install an eviction listener to keep metrics accurate and optionally expose an evictions_total counter.
Example:
static STC_CACHE: LazyLock<moka::future::Cache<STCCacheKey, STCCacheValue>> = LazyLock::new(|| { moka::future::Cache::builder() .max_capacity(CONFIG.cache.stc.capacity) .initial_capacity(100) // Per-entry expiration based on cache_expires_at in the value .expire_after(STCCacheExpiration {}) + .eviction_listener(|_, _, _| { + update_cache_size_metric(); + metrics::counter!("lakekeeper_stc_cache_evictions_total", "cache_type" => "stc").increment(1); + }) .build() });Also applies to: 149-152, 33-42
crates/lakekeeper/src/service/storage/s3.rs (2)
455-462: Minor: don’t discard expiration field.If you keep destructuring, avoid ignoring expiration entirely. You can read it pre-destructure for logging or skew decisions.
- let aws_sdk_sts::types::Credentials { + let aws_sdk_sts::types::Credentials { access_key_id, secret_access_key, session_token, - expiration: _, + expiration, .. } = temporary_credential; + tracing::debug!("STS creds expire at {:?}", expiration);
846-919: Build STS policy via serde_json to avoid string fragility.Manual string assembly is error-prone (quoting, spacing). Build a JSON value and serialize.
Sketch:
- let mut statements = format!(r#"{{ ... }}"#).replace('\n', "").replace(' ', ""); + let mut statements = vec![ + serde_json::json!({ + "Sid": "TableAccess", + "Effect": "Allow", + "Action": [ /* from permission_to_actions split */ ], + "Resource": [format!("{bucket_arn}/{key}"), format!("{bucket_arn}/{key}*")] + }), + serde_json::json!({ + "Sid": "ListBucketForFolder", + "Effect": "Allow", + "Action": "s3:ListBucket", + "Resource": bucket_arn, + "Condition": { "StringLike": { "s3:prefix": format!("{key}*") } } + }) + ]; + if let Some(kms) = self.aws_kms_key_arn.as_ref() { + statements.push(serde_json::json!({ + "Sid": "KmsAccess", + "Effect": "Allow", + "Action": ["kms:Decrypt","kms:GenerateDataKey"], + "Resource": kms + })); + } + let policy = serde_json::json!({"Version":"2012-10-17","Statement": statements}).to_string();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
crates/io/src/adls.rs(1 hunks)crates/io/src/s3.rs(2 hunks)crates/lakekeeper/src/api/iceberg/v1/tables.rs(1 hunks)crates/lakekeeper/src/config.rs(4 hunks)crates/lakekeeper/src/service/storage/az.rs(9 hunks)crates/lakekeeper/src/service/storage/cache.rs(1 hunks)crates/lakekeeper/src/service/storage/gcs/mod.rs(10 hunks)crates/lakekeeper/src/service/storage/mod.rs(9 hunks)crates/lakekeeper/src/service/storage/s3.rs(23 hunks)docs/docs/configuration.md(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/lakekeeper/src/api/iceberg/v1/tables.rs
- crates/lakekeeper/src/config.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: check-generated-openapi-matches
- GitHub Check: clippy
- GitHub Check: sqlx-check
🔇 Additional comments (24)
crates/io/src/adls.rs (3)
63-63: LGTM!The
Eqderive is valid for this struct, as all fields (String) properly implementEq.
69-69: LGTM!The
Eqderive is valid for this struct, as all fields (String) properly implementEq.
70-75: Breaking change: New required field added to public struct.The
client_secretfield is a new public member ofAzureClientCredentialsAuth. Since this struct usesTypedBuilder, callers must now provide this field when constructing instances, making this a breaking API change.The addition is correct and necessary for proper OAuth2 client credentials flow (which requires client_id, tenant_id, and client_secret). The
#[redact(partial)]annotation appropriately protects this sensitive credential from being logged in full.crates/lakekeeper/src/service/storage/cache.rs (1)
71-86: Key design looks solid.Including request + storage profile hash + credential hash prevents cross-profile collisions and captures tag/role changes. LGTM.
docs/docs/configuration.md (1)
245-263: Docs match implementation; please verify defaults.Metrics and expiry description align with cache.rs (half of lifetime, max 1h). Double-check that CONFIG defaults are enabled=true and capacity=10000 to avoid drift.
crates/io/src/s3.rs (1)
59-63: Derives look good.Hash/Eq derivations enable use in cache keys; Redact ensures safe Debug output. LGTM.
Also applies to: 78-92, 84-92
crates/lakekeeper/src/service/storage/mod.rs (2)
98-115: Nice: single STC request object with Display.Good cohesion and debuggability; reduces param drift across backends.
255-276: Wiring of STC request across backends looks consistent.S3 by value, GCS/Az by ref; fine for ownership. LGTM.
Also applies to: 277-300, 301-317
crates/lakekeeper/src/service/storage/az.rs (7)
1-6: LGTM!The addition of
DurationandInstantfromstd::timeis appropriate for tracking cache expiry times in the STC caching implementation.
37-45: LGTM!The cache-related imports and
ShortTermCredentialsRequestare correctly imported to support the STC caching feature.
50-50: LGTM!Adding
HashtoAdlsProfileenables it to be used in cache keys for STC caching. The profile fields are all appropriate for hashing.
490-490: LGTM!Adding
HashtoAzCredentialenables it to be used in cache keys. TheHashimplementation will correctly hash the actual credential values (not redacted versions), which is necessary for proper cache key uniqueness based on the credential used.
80-80: LGTM!The default SAS token validity of 3600 seconds (1 hour) is a reasonable default for short-term credentials.
246-316: No issues found — overflow handling is correct.The
STCCacheValue::newmethod atcache.rs:89-92explicitly acceptsOption<Instant>for thevalid_untilparameter. WhenInstant::now().checked_add()returnsNonedue to overflow, theSTCCacheExpiration::expire_after_createimplementation (lines 112–113) handles it by returning an immediate expiration (Duration::from_secs(0)), causing the cache entry to expire immediately. This is safe and correct behavior.
318-339: Verify whetherShortTermCredentialsRequestshould have a custom Debug implementation that redacts sensitive fields.The logging is intentional (using Display trait), but
ShortTermCredentialsRequestcurrently uses derived Debug and lacks the redaction pattern used elsewhere in the codebase for sensitive types. The struct exposestable_locationandstorage_permissionsin both its Display and derived Debug implementations, which could reveal table structure and access permissions if logged with{:?}.Consider adding a custom Debug implementation similar to the pattern in
crates/lakekeeper/src/implementations/kv2.rs(which redacts sensitive fields like vault credentials).crates/lakekeeper/src/service/storage/gcs/mod.rs (9)
7-7: LGTM!The addition of
DurationandInstantis appropriate for cache expiry tracking.
20-20: LGTM!The
pub(super)re-export ofSTSResponsemakes it available to parent/sibling modules within the storage module, which is appropriate for the caching infrastructure.
30-38: LGTM!The cache-related imports and
ShortTermCredentialsRequestare correctly imported to support the STC caching feature for GCS.
54-54: LGTM!Adding
HashtoGcsProfileenables it to be used in cache keys for STC caching.
64-64: LGTM!Adding
HashtoGcsCredentialenables it to be used in cache keys for proper credential-based cache segregation.
101-101: LGTM!Adding
HashtoGcsServiceKeyenables it to be used in cache keys. TheHashimplementation will correctly hash the actual key values (not redacted versions), which is necessary for proper cache key uniqueness.
178-183: LGTM!The
CachedSTSResponsestruct appropriately wraps the STS token response with expiry metadata for caching. Thepub(super)visibility correctly limits its scope to the storage module.
331-408: Verify handling of cache expiry overflow.The caching logic is well-implemented with good error handling for
SystemTimecalculations (lines 388-401). However, at line 375,Instant::now().checked_add()returnsOption<Instant>, and if it overflows (returnsNone), the value is passed toSTCCacheValue::newwithout checking.While lines 360-364 show awareness of potential overflow for
SystemTime, the same check should be applied for theInstantused in cache expiry.Please verify that
STCCacheValue::newproperly handles aNoneexpiry time, or consider adding a check similar to lines 360-364 to log a warning when theInstantaddition overflows.
410-434: Verify thatShortTermCredentialsRequestdoesn't log sensitive information.The cache lookup logic is well-structured with appropriate debug logging. However, the debug logs include
stc_request(lines 421, 425, 429), which might contain sensitive information.Please verify that
ShortTermCredentialsRequestimplementsDebugwith proper redaction of any sensitive fields, or consider logging only non-sensitive fields.
* feat: Publish images to Dockerhub (lakekeeper#1274) * feat: Update UI to 0.9.0 with multi-project support (lakekeeper#1275) * chore: release 0.9.4 Release-As: 0.9.4 * chore: release main (lakekeeper#1262) * chore(ci): Fix Dockerhub login * chore(docs): Improve developer guide (lakekeeper#1265) * chore(docs): add info regarding `view_version`'s internal representation (lakekeeper#1261) * chore(docs): Architecture clarify Secret Store (lakekeeper#1284) * fix: Update Limes to 0.2.2 - Fixes compilation issue due to breaking `jwks_client_rs` change (lakekeeper#1282) * fix: Update Limes to 0.2.2 * increase min rust version * chore: release 0.9.5 Release-As: 0.9.5 * chore: release main (lakekeeper#1286) * chore: enable changelog sections for release-please (lakekeeper#1264) k * fix(deps): update rust crate rand to v0.9.2 (lakekeeper#1252) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-channel to v2.5.0 (lakekeeper#1225) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mkdocs-material to v9.6.17 (lakekeeper#1289) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate anyhow to v1.0.99 (lakekeeper#1290) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Remove bitnami images (lakekeeper#1288) * feat!: Move to Lakekeeper IO based on hyperscaler SDKs (lakekeeper#1285) * chore(deps): update rust crate reqwest to v0.12.23 (lakekeeper#1294) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): Improve Cloud storage test docs * fix: accept "disable" as PG sslmode as documented (lakekeeper#1303) * feat: Simplify task interface, re-exports, enable delete-after-commit (lakekeeper#1302) * feat: Introduce `RequestMetadata` for Internal Principals which bypass AuthZ (lakekeeper#1306) * chore(deps): update azure/setup-helm action to v4.3.1 (lakekeeper#1299) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(test): use nextest filterset instead of needs_env_var (lakekeeper#1304) * chore(deps): update rust crate openssl-src to v300.5.2 (lakekeeper#1292) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-compression to v0.4.28 (lakekeeper#1311) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate thiserror to v2.0.16 (lakekeeper#1296) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Provide `ApiContext` to externally registered tasks (lakekeeper#1307) * feat!: Simplify Task interface, extend SpecializedTask interface (lakekeeper#1310) * feat: Improve authorizer `are_allowed_*` batch check signature (lakekeeper#1315) * chore(authz): Enforce use of AuthZ decisions with #[must_use] (lakekeeper#1317) * feat: Task Management APIs (lakekeeper#1316) * chore(deps): update rust crate tracing-subscriber to v0.3.20 [security] (lakekeeper#1318) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Add `RunNow` and `RunAt` to Controls for Tasks (lakekeeper#1322) * chore(deps): update rust crate tokio-util to v0.7.16 (lakekeeper#1313) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): Improve Entra ID docs (lakekeeper#1325) * chore(docs): Improve Upgrades & Migration docs (lakekeeper#1326) * feat: Add tasks heartbeat with Catalog state (lakekeeper#1324) * ci: add configuration for CodeRabbit reviews (lakekeeper#1327) * feat: Add optional STS session-tags in S3 STS requests for ABAC authorization (lakekeeper#1230) * feat: Random Server IDs (lakekeeper#1328) * chore(deps): update rust crate percent-encoding to v2.3.2 (lakekeeper#1312) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(authz): Deprecate Permission Endpoints for Tables without WarehouseIDs (lakekeeper#1334) * fix: Tasks endpoints in router (lakekeeper#1335) * feat(ci): add nextest profile ci_no_secrets for external PRs (lakekeeper#1333) * chore(deps): update rust crate chrono to v0.4.42 (lakekeeper#1331) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Pin examples duckdb version to 1.3 (lakekeeper#1343) * feat!: Require warehouse_id when checking permissions on views or tables via ID (lakekeeper#1340) * fix: migrate away from bitnami in unittest.yml (lakekeeper#1344) * chore: Remove coderabitt config * fix(docs): Fix inconsistent URL format in README (lakekeeper#1345) Co-authored-by: Christian <[email protected]> * feat: Remove serde_yaml & serde_yml (lakekeeper#1341) * feat!: add `warehouse_id` to PKs of all `table_*` and `view_*` tables (lakekeeper#1254) * feat: Minor namespace join performance improvements * fix: Warehouse permissions are directly used for task retrieval & control (lakekeeper#1347) * fix: Potential Race Condition when undropping Tabulars (lakekeeper#1342) * fix: table rename authz and error handling (lakekeeper#1346) Co-authored-by: Andre Luis Anastacio <[email protected]> * chore(deps): update rust crate google-cloud-auth to v1.1.2 (lakekeeper#1337) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate time to v0.3.44 (lakekeeper#1349) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mkdocs-material to v9.6.20 (lakekeeper#1309) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * feat: Set ServerID during migration (lakekeeper#1348) * chore(deps): Remove utoipa fork (lakekeeper#1352) * chore(deps): update rust crate serde_with to v3.14.1 (lakekeeper#1351) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate url to v2.5.7 (lakekeeper#1354) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-compression to v0.4.30 (lakekeeper#1323) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate serde_json to v1.0.145 (lakekeeper#1250) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update strum monorepo to v0.27.2 (lakekeeper#1251) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update serde monorepo to v1.0.226 (lakekeeper#1355) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update rust crate clap to v4.5.48 (lakekeeper#1356) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Add Entity Names to Tasks (lakekeeper#1353) * fix: case insensitivity of catalog endpoints (lakekeeper#1338) * fix: Improve delete_warehouse error message for active tasks * chore(deps): update rust crate tempfile to v3.22.0 (lakekeeper#1359) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate axum-prometheus to 0.9.0 (lakekeeper#1358) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: PgSslMode not supported error string * feat(authz)!: add OpenFGA schema v4 and v3->v4 migration (lakekeeper#1314) Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> * chore(deps): update rust crate uuid to v1.18.1 (lakekeeper#1362) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency markdown-grid-tables to v0.6.0 (lakekeeper#1357) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate anyhow to v1.0.100 (lakekeeper#1350) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: clippy * chore(deps): update rust crate moka to v0.12.11 (lakekeeper#1365) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate tempfile to v3.23.0 (lakekeeper#1367) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-nats to 0.43.0 (lakekeeper#1366) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/setup-node action to v5 (lakekeeper#1371) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/checkout action to v5 (lakekeeper#1369) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/setup-python action to v6 (lakekeeper#1372) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: V3 support (lakekeeper#1364) * chore: Set Get Task Permission to "CanGetMetadata" (lakekeeper#1376) * chore(deps): update dependency node to v22 (lakekeeper#1373) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(authz)!: extend OpenFGA tabular entities with WarehouseId (lakekeeper#1329) --------- Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> * feat: Add support for tasks affecting views (lakekeeper#1378) * feat(authz): Add specific Task Actions (lakekeeper#1379) * chore(tests): Test with Iceberg 1.9.2 & 1.10.0 (lakekeeper#1267) * feat: Enrich task metadata with concrete tabular type (lakekeeper#1383) * feat: Add loadTable Snapshots filter (lakekeeper#1385) * feat: add endpoint for fuzzy search of tabulars (lakekeeper#1387) * feat: Update UI to 0.10.0 (lakekeeper#1390) * feat(ui): Update UI to 0.10.1 * chore: Use lakekeeper re-exports in bin (lakekeeper#1391) * fix(tabular-search): distance and docs for `searchterm is uuid` (lakekeeper#1393) * chore(examples): Idempotent bucket creation in minimal example (lakekeeper#1386) In the case where you already have a bucket created, like the "examples" bucket, I ran into an issue where the createbuckets service fails, and this prevents lakekeeper from starting back up. This fix adds a simple minio flag to ignore buckets that already exist, making things even more user friendly * feat: Make number of workers spawned for Expiration & Purge configurable (lakekeeper#1395) * chore: release main (lakekeeper#1295) * chore: added gif to readme (lakekeeper#1396) * chore: remove unneded `#[allow(dead_code)]` (lakekeeper#1399) * fix: Use FnOnce for queue & service registration * Revert "fix: Use FnOnce for queue & service registration" This reverts commit 47b03a0. * chore(docs): Add 0.10 docs * perf(db): remove `join namespace` from `active_tabulars` view (lakekeeper#1401) * doc(db): how to connect to db and inspect schema (lakekeeper#1402) * feat: implement `OpenFgaEntity` for `ServerId` (lakekeeper#1394) * impl OpenFgaEntity * Use the implementation * fix: Use FnOnce for queue & service registration (lakekeeper#1404) * chore(deps): update dependency mkdocs-material to v9.6.21 (lakekeeper#1406) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Expose client-managed X-Iceberg-Access-Delegation (lakekeeper#1407) * fix: Use higher consistency for some OpenFGA queries (lakekeeper#1408) * feat: Improve Kubernetes Auth docs (lakekeeper#1415) * chore: release 0.10.1 Release-As: 0.10.1 * fix: Endpoint stats for Project Endpoints (lakekeeper#1412) * feat: Add create table guard to cleanup location on Failure (lakekeeper#1418) * chore: Generate ID types with Macro (lakekeeper#1419) * chore: Re-Export Tokio from lakekeeper-io create (lakekeeper#1420) * fix: Add support for `write.metadata.metrics.` Table Properties (lakekeeper#1422) * fix: Update UI to 0.10.2 (lakekeeper#1423) * chore: release main (lakekeeper#1403) * fix: Parse empty ProjectID headers as None (lakekeeper#1424) * chore: release 0.10.2 Release-As: 0.10.2 * chore: release main (lakekeeper#1425) * feat: Add `debug_migrate_before_serve` env var (lakekeeper#1426) * feat: Move OpenFGA Authorizer to separate crate (lakekeeper#1421) * chore(renovate): Group dependencies * chore(renovate): ignore additional deps * chore: Rename src/service -> src/server, trait Catalog -> CatalogStore (lakekeeper#1428) * feat(examples): add k8s iceberg sink connector (avro) (lakekeeper#1336) --------- Co-authored-by: Christian <[email protected]> * chore(ci): Fix release please (lakekeeper#1433) * feat: Expose License Information via API (lakekeeper#1432) * fix(deps): update all non-major dependencies (lakekeeper#1429) * chore(ci): Remove mgmt API version update via release-please * chore: Restructure catalog_store into multiple modules (lakekeeper#1434) * feat: Validate Downscoping works on Warehouse creation (lakekeeper#1437) * chore(ci): Fix release please * docs: Add info about installing sqlx to developer-guide.md (lakekeeper#1438) * docs: Update developer-guide.md (lakekeeper#1439) * chore(deps): update all non-major dependencies (lakekeeper#1436) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: Better normalization for ARNs in S3 Profile (lakekeeper#1441) * chore(deps): update all non-major dependencies (lakekeeper#1442) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(main): release 0.10.3 (lakekeeper#1427) * fix: Release Please CI outputs * fix(ci): Revert 0.10.3 release * chore(main): release 0.10.3 (lakekeeper#1446) * feat: Introduce CatalogWarehouseOps & CatalogNamespaceOps abstractions (lakekeeper#1440) * feat: Allow x-user-agent header (lakekeeper#1453) * feat: Table & View Ops Abstractions, Improved Error Handling (lakekeeper#1454) * fix: CORS allow access delegation & etag headers (lakekeeper#1455) * fix: Headers should be lowercase (lakekeeper#1457) * chore(tests): Add trino information_schema.tables test (lakekeeper#1456) * chore: Introduce open-api feature to gate utoipa and swagger (lakekeeper#1458) * chore: Release As 0.11 * fix: Debug assertion table identifier mismatch for signer (lakekeeper#1460) * feat: Caching Short-Term-Credentials (STC) (lakekeeper#1459) * feat: Warehouse Cache (lakekeeper#1462) * chore(deps): update actions/setup-node action to v6 (lakekeeper#1443) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Version based Warehouse Cache (lakekeeper#1465) * feat: AuthZ Server and Project Ops (lakekeeper#1471) * chore(deps): update github artifact actions (lakekeeper#1461) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Rename release branch pattern to rel-* * feat: Catalog returns full Namespace Hierarchy for nested Namespaces (lakekeeper#1472) --------- Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> Co-authored-by: Dao Thanh Tung <[email protected]> Co-authored-by: Moritz Zielke <[email protected]> Co-authored-by: Baptiste Gouhoury <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Dolan Antenucci <[email protected]> Co-authored-by: Anatoly Popov <[email protected]> Co-authored-by: Andre Luis Anastacio <[email protected]> Co-authored-by: Scott Haines <[email protected]> Co-authored-by: Viktor Kessler <[email protected]> Co-authored-by: Yohan Valencia <[email protected]> Co-authored-by: Paul Roman <[email protected]>
Summary by CodeRabbit
New Features
Chores
Docs
Runtime
Tests