Repository navigation
chore: Move OpenFGA Authorizer to separate crate - #1421
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds a new authz-openfga crate to the workspace and integrates it into lakekeeper and lakekeeper-bin. Refactors authorizer APIs (result types, visibilities, constructors), introduces OpenFGA config module and client factories, widens several catalog/test helpers, and moves test utilities behind a test-utils feature. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Env as Environment
participant AuthCfg as authz-openfga::config::CONFIG
participant Client as authz-openfga::client
participant OpenFGA as OpenFGA service
participant Authorizer as OpenFGAAuthorizer
Env->>AuthCfg: load env / figment
AuthCfg-->>Client: produce OpenFGAConfig
Client->>OpenFGA: build BasicOpenFgaClient (auth, endpoint)
Client->>Authorizer: new_authorizer_from_default_config(client, server_id)
Note right of Authorizer: stores client, health, server_id (pub(crate) fields)
sequenceDiagram
autonumber
participant API as Lakekeeper API
participant Catalog as Catalog
participant Auth as Authorizer
participant Tx as DB Transaction
API->>Catalog: authorized_*_ident_to_id(..., action, tx)
Catalog->>Auth: require_action(actor, object, action)
Auth-->>Catalog: AuthorizerResult<()> (ok / error)
alt allowed
Catalog->>Tx: lookup object id
Tx-->>Catalog: object id
Catalog-->>API: Ok(ObjectId)
else denied / error
Catalog-->>API: Error
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 (4)
crates/lakekeeper/src/service/storage/mod.rs (1)
60-79: Keep MemoryProfile visible to unit testsGating the
Memoryvariant andMemoryProfilesolely behindfeature = "test-utils"makes the type disappear when runningcargo testwithout that feature. The unit tests in this module (e.g.,test_memory_profile_serde) still compile undercfg(test)and now fail to resolveMemoryProfile. Please keep these definitions available for tests, e.g. by using#[cfg(any(test, feature = "test-utils"))], or gate the affected tests accordingly. Right now the crate’s tests no longer compile with default features.crates/lakekeeper/src/service/authn.rs (1)
304-308: Require test-utils feature activation for tests and dependents.• Gating
new_uncheckedbehind#[cfg(feature = "test-utils")]is fine, but existing tests in lakekeeper (and any external crates usingnew_unchecked) must opt into that feature.
• Update CI/test commands tocargo test --all-features(or--features test-utils), and addfeatures = ["test-utils"]to any lakekeeper dependency declarations wherenew_uncheckedis invoked.crates/authz-openfga/src/check.rs (1)
233-236: Don’t swallow catalog commit errorsEach read transaction now ends with
t.commit().await.ok();, which suppresses any error returned by the catalog layer. If the connection/transaction is aborted, we’ll still report success and keep operating with a bad connection. Please propagate the error (e.g.t.commit().await?;) so callers see the failure, and apply the same fix to the table/view branches.Also applies to: 284-286, 330-331
crates/lakekeeper/src/tests/mod.rs (1)
166-175: Fix feature-gated helper usage
memory_io_profileis defined only when thetest-utilsfeature is enabled, yetSetupTestCatalog::setupcalls it unconditionally. Building Lakekeeper without that feature (the default release build) now fails withcannot find function memory_io_profile. Please make the helper available in both configurations or gate the call behind the samecfg.Apply this diff to provide a fallback definition when the feature is disabled:
#[cfg(feature = "test-utils")] #[must_use] pub fn memory_io_profile() -> StorageProfile { crate::service::storage::MemoryProfile::default().into() } + +#[cfg(not(feature = "test-utils"))] +#[must_use] +pub fn memory_io_profile() -> StorageProfile { + crate::service::storage::MemoryProfile::default().into() +}
🧹 Nitpick comments (6)
crates/lakekeeper/src/api/management/v1/role.rs (1)
138-138: Document the public trait and consider sealing it.Now that
Serviceis part of the public API, it should include documentation explaining its purpose, usage, and whether external implementations are supported. The trait appears to follow a pattern where it's public for use but not intended for external implementation (all methods have default implementations, and there's only one internal implementor on line 135).Consider adding documentation and potentially sealing the trait to prevent unintended external implementations:
+/// Service trait for role management operations. +/// +/// This trait provides methods for creating, listing, updating, and deleting roles +/// within projects. All methods include authorization checks and transactional guarantees. +/// +/// # Implementation +/// This trait is sealed and cannot be implemented outside of this crate. +/// The only implementation is provided for `ApiServer`. pub trait Service<C: Catalog, A: Authorizer, S: SecretStore> +: private::Sealed { async fn create_role(Then add a sealing module at the end of the file:
mod private { use super::*; pub trait Sealed {} impl<C: Catalog, A: Authorizer + Clone, S: SecretStore> Sealed for ApiServer<C, A, S> {} }crates/lakekeeper/src/catalog/tables.rs (1)
1741-1741: Consider renaming the localcreate_table_requestfunction to reduce confusion.While the current usage is correct, having two similarly named functions with different signatures (imported
create_table_requestaliased ascreate_request, and localcreate_table_requestat line 1818) could lead to confusion. Consider renaming the local function to something likecreate_table_request_with_formatto make the distinction clearer.crates/lakekeeper/src/service/authz/implementations/mod.rs (1)
3-66: Remove commented code instead of leaving it in place.The entire OpenFGA integration has been commented out as part of moving it to the separate
authz-openfgacrate. Instead of leaving these large commented blocks, consider removing them entirely to reduce technical debt and improve code clarity. Version control preserves the history if needed.Apply this diff to remove the commented code:
pub(super) mod allow_all; - -// // #[cfg(feature = "authz-openfga")] -// // pub mod openfga; - -// /// Get the default authorizer from the configuration -// /// -// /// # Errors -// /// Default model is not obtainable, i.e. if the model is not found in openfga -// // Return error model here to convert it into anyhow in bin. IcebergErrorResponse does -// // not implement StdError -// pub async fn get_default_authorizer_from_config( -// server_id: ServerId, -// ) -> Result<Arc<dyn Authorizer>, ErrorModel> { -// match &CONFIG.authz_backend { -// AuthZBackend::AllowAll => Ok(allow_all::AllowAllAuthorizer { server_id }.into()), -// #[cfg(feature = "authz-openfga")] -// AuthZBackend::OpenFGA => { -// todo!() -// } // AuthZBackend::OpenFGA => Ok(openfga::new_authorizer_from_config(server_id).await?.into()), -// } -// } - -// /// Migrate the default authorizer to a new model version. -// /// -// /// # Errors -// /// Migration fails - for details check the documentation of the configured -// /// Authorizer implementation -// pub async fn migrate_default_authorizer( -// server_id: ServerId, -// ) -> std::result::Result<(), ErrorModel> { -// match &CONFIG.authz_backend { -// AuthZBackend::AllowAll => { -// let _ = server_id; -// Ok(()) -// } -// #[cfg(feature = "authz-openfga")] -// AuthZBackend::OpenFGA => { -// todo!() -// // let client = openfga::new_client_from_default_config().await?; -// // let store_name = None; -// // openfga::migrate(&client, store_name, server_id).await?; -// Ok(()) -// } -// } -// } - -// #[derive(Debug, Clone)] -// pub enum BuiltInAuthorizers { -// AllowAll(allow_all::AllowAllAuthorizer), -// #[cfg(feature = "authz-openfga")] -// OpenFGA(openfga::OpenFGAAuthorizer), -// } - -// impl From<allow_all::AllowAllAuthorizer> for BuiltInAuthorizers { -// fn from(authorizer: allow_all::AllowAllAuthorizer) -> Self { -// Self::AllowAll(authorizer) -// } -// } - -// #[cfg(feature = "authz-openfga")] -// impl From<openfga::OpenFGAAuthorizer> for BuiltInAuthorizers { -// fn from(authorizer: openfga::OpenFGAAuthorizer) -> Self { -// Self::OpenFGA(authorizer) -// } -// }crates/lakekeeper/src/tests/internal_helper.rs (1)
41-52: Consider caching the current_thread runtime for efficiency.The
test_block_onfunction creates a new current_thread runtime on every call whencommon_runtime=false. While acceptable for test code, you could optimize by caching aLazyLock<Runtime>for the current_thread case similar to the multi_thread case, reducing overhead in tests.Example optimization:
+static CURRENT_THREAD_RUNTIME: LazyLock<Runtime> = LazyLock::new(|| { + tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .expect("failed to start Tokio runtime") +}); + #[track_caller] pub(crate) fn test_block_on<F: Future>(f: F, common_runtime: bool) -> F::Output { - { - if common_runtime { - return COMMON_RUNTIME.block_on(f); - } - tokio::runtime::Builder::new_current_thread() - .enable_all() - .build() - .expect("failed to start Tokio runtime") - .block_on(f) + if common_runtime { + COMMON_RUNTIME.block_on(f) + } else { + CURRENT_THREAD_RUNTIME.block_on(f) } }Cargo.toml (1)
3-3: Consider removing the commented-out workspace member.The commented-out
lakekeeper-binmember could be confusing. If it's removed from the workspace, consider deleting the line entirely. If it's temporarily disabled for this PR, add a comment explaining why.crates/authz-openfga/src/config.rs (1)
24-26: Avoid reallocating inis_openfga_enabledWe can lean on pattern matching instead of rebuilding a
Stringevery call.- self.authz_backend == AuthZBackend::External("openfga".to_string()) + matches!( + self.authz_backend, + AuthZBackend::External(ref backend) if backend == "openfga" + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (44)
Cargo.toml(2 hunks)crates/authz-openfga/Cargo.toml(1 hunks)crates/authz-openfga/src/api.rs(3 hunks)crates/authz-openfga/src/authorizer.rs(40 hunks)crates/authz-openfga/src/check.rs(5 hunks)crates/authz-openfga/src/client.rs(2 hunks)crates/authz-openfga/src/config.rs(1 hunks)crates/authz-openfga/src/entities.rs(2 hunks)crates/authz-openfga/src/error.rs(1 hunks)crates/authz-openfga/src/health.rs(2 hunks)crates/authz-openfga/src/lib.rs(1 hunks)crates/authz-openfga/src/migration.rs(8 hunks)crates/authz-openfga/src/migration/migration_fns_v4.rs(6 hunks)crates/authz-openfga/src/models.rs(2 hunks)crates/authz-openfga/src/relations.rs(3 hunks)crates/lakekeeper/Cargo.toml(3 hunks)crates/lakekeeper/src/api/management/v1/bootstrap.rs(2 hunks)crates/lakekeeper/src/api/management/v1/role.rs(1 hunks)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs(3 hunks)crates/lakekeeper/src/catalog/mod.rs(1 hunks)crates/lakekeeper/src/catalog/namespace.rs(1 hunks)crates/lakekeeper/src/catalog/tables.rs(2 hunks)crates/lakekeeper/src/catalog/views.rs(1 hunks)crates/lakekeeper/src/catalog/views/commit.rs(1 hunks)crates/lakekeeper/src/catalog/views/create.rs(1 hunks)crates/lakekeeper/src/catalog/views/drop.rs(4 hunks)crates/lakekeeper/src/catalog/views/exists.rs(2 hunks)crates/lakekeeper/src/catalog/views/list.rs(4 hunks)crates/lakekeeper/src/catalog/views/load.rs(2 hunks)crates/lakekeeper/src/catalog/views/rename.rs(2 hunks)crates/lakekeeper/src/config.rs(3 hunks)crates/lakekeeper/src/lib.rs(3 hunks)crates/lakekeeper/src/request_metadata.rs(2 hunks)crates/lakekeeper/src/service/authn.rs(2 hunks)crates/lakekeeper/src/service/authz/implementations/allow_all.rs(1 hunks)crates/lakekeeper/src/service/authz/implementations/mod.rs(1 hunks)crates/lakekeeper/src/service/authz/mod.rs(2 hunks)crates/lakekeeper/src/service/event_publisher/mod.rs(1 hunks)crates/lakekeeper/src/service/storage/mod.rs(14 hunks)crates/lakekeeper/src/service/storage/s3.rs(6 hunks)crates/lakekeeper/src/tests/internal_helper.rs(1 hunks)crates/lakekeeper/src/tests/mod.rs(1 hunks)release-please/.release-please-manifest.json(1 hunks)release-please/release-please-config.json(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-21T09:54:54.868Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1348
File: .sqlx/query-1c1a32de33e3f54464a1107f7d4d4b8cbd99dd69aae1c740561c3cbbea2eaa19.json:9-10
Timestamp: 2025-09-21T09:54:54.868Z
Learning: In the lakekeeper codebase, ServerId newtype uses manual conversion between uuid::Uuid and ServerId at query call sites rather than sqlx transparent annotations like #[sqlx(transparent)]. The manual conversion approach is the preferred pattern in this codebase.
Applied to files:
crates/authz-openfga/src/migration.rs
📚 Learning: 2025-09-08T09:10:07.658Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1328
File: crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs:103-112
Timestamp: 2025-09-08T09:10:07.658Z
Learning: The OpenFGAAuthorizer constructor in crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs should maintain backward compatibility during the transition away from nil UUIDs. Hard assertions that would panic on nil UUID input should be avoided to prevent breaking existing deployments.
Applied to files:
crates/authz-openfga/src/client.rscrates/lakekeeper/src/service/authz/implementations/mod.rscrates/authz-openfga/src/migration/migration_fns_v4.rs
📚 Learning: 2025-09-25T06:54:15.179Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1378
File: crates/lakekeeper/src/api/management/v1/warehouse/undrop.rs:51-53
Timestamp: 2025-09-25T06:54:15.179Z
Learning: In the lakekeeper codebase, when iterating over &[TabularId] and pattern matching TabularId::View(id), the id variable has type &ViewId. Using *id correctly dereferences to get ViewId, which can be passed directly to authorization methods that expect ViewId parameters.
Applied to files:
crates/lakekeeper/src/catalog/views.rscrates/lakekeeper/src/catalog/tables.rscrates/lakekeeper/src/catalog/views/exists.rs
🧬 Code graph analysis (30)
crates/lakekeeper/src/catalog/mod.rs (1)
crates/lakekeeper/src/api/iceberg/mod.rs (4)
namespace(59-59)s3_signer(65-65)tables(60-60)views(61-61)
crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)
crates/lakekeeper/src/service/authz/mod.rs (2)
crates/authz-openfga/src/authorizer.rs (1)
implementation_name(70-72)crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
implementation_name(53-55)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (2)
crates/authz-openfga/src/authorizer.rs (1)
implementation_name(70-72)crates/lakekeeper/src/service/authz/mod.rs (2)
implementation_name(205-205)implementation_name(1087-1089)
crates/authz-openfga/src/migration.rs (1)
crates/authz-openfga/src/client.rs (1)
new_client_from_default_config(15-51)
crates/authz-openfga/src/client.rs (3)
crates/authz-openfga/src/migration.rs (1)
get_active_auth_model_id(108-127)crates/authz-openfga/src/authorizer.rs (1)
server_id(74-76)crates/lakekeeper/src/service/authz/mod.rs (2)
server_id(209-209)server_id(1091-1093)
crates/lakekeeper/src/catalog/views/create.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)
crates/authz-openfga/src/api.rs (1)
crates/authz-openfga/src/migration.rs (1)
authorizer_for_empty_store(172-193)
crates/lakekeeper/src/service/authn.rs (1)
crates/lakekeeper/src/service/identifier/project.rs (1)
try_new(43-66)
crates/lakekeeper/src/catalog/views.rs (2)
crates/authz-openfga/src/check.rs (1)
authorized_view_ident_to_id(318-318)crates/lakekeeper/src/catalog/views/exists.rs (2)
authorized_view_ident_to_id(27-27)authorized_view_ident_to_id(42-58)
crates/lakekeeper/src/catalog/views/list.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)
crates/authz-openfga/src/health.rs (2)
crates/authz-openfga/src/client.rs (2)
new_authorizer(80-98)new_client_from_default_config(15-51)crates/authz-openfga/src/migration.rs (1)
migrate(142-161)
crates/lakekeeper/src/catalog/views/commit.rs (2)
crates/lakekeeper/src/catalog/views.rs (2)
create_view(45-53)setup(167-197)crates/lakekeeper/src/tests/internal_helper.rs (2)
create_view(115-133)create_view_request(149-190)
crates/lakekeeper/src/api/management/v1/bootstrap.rs (3)
crates/authz-openfga/src/authorizer.rs (1)
implementation_name(70-72)crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
implementation_name(53-55)crates/lakekeeper/src/service/authz/mod.rs (2)
implementation_name(205-205)implementation_name(1087-1089)
crates/lakekeeper/src/service/storage/mod.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
test_block_on(41-52)
crates/lakekeeper/src/catalog/namespace.rs (4)
crates/authz-openfga/src/check.rs (1)
authorized_namespace_ident_to_id(225-225)crates/lakekeeper/src/catalog/views/list.rs (1)
authorized_namespace_ident_to_id(37-37)crates/lakekeeper/src/catalog/tables.rs (2)
authorized_namespace_ident_to_id(97-97)authorized_namespace_ident_to_id(171-171)crates/lakekeeper/src/catalog/tables/create_table.rs (1)
authorized_namespace_ident_to_id(154-154)
crates/lakekeeper/src/service/storage/s3.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
test_block_on(41-52)
crates/lakekeeper/src/catalog/views/rename.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)
crates/authz-openfga/src/migration/migration_fns_v4.rs (3)
crates/authz-openfga/src/client.rs (1)
new_client_from_default_config(15-51)crates/authz-openfga/src/authorizer.rs (2)
new(54-64)server_id(74-76)crates/lakekeeper/src/service/authz/mod.rs (3)
new(1034-1040)server_id(209-209)server_id(1091-1093)
crates/lakekeeper/src/catalog/views/load.rs (1)
crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)
crates/lakekeeper/src/catalog/views/drop.rs (2)
crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)crates/lakekeeper/src/tests/mod.rs (1)
random_request_metadata(222-224)
crates/authz-openfga/src/lib.rs (3)
crates/authz-openfga/src/client.rs (1)
new_authorizer_from_default_config(59-70)crates/authz-openfga/src/authorizer.rs (2)
check(821-832)new(54-64)crates/authz-openfga/src/migration.rs (1)
migrate(142-161)
crates/authz-openfga/src/check.rs (4)
crates/lakekeeper/src/catalog/namespace.rs (7)
catalog(110-110)authorized_namespace_ident_to_id(308-308)authorized_namespace_ident_to_id(343-343)authorized_namespace_ident_to_id(383-383)authorized_namespace_ident_to_id(441-441)authorized_namespace_ident_to_id(535-552)create_namespace(190-291)crates/lakekeeper/src/catalog/tables.rs (6)
catalog(109-109)authorized_namespace_ident_to_id(97-97)authorized_namespace_ident_to_id(171-171)authorized_table_ident_to_id(624-624)authorized_table_ident_to_id(667-667)authorized_table_ident_to_id(1230-1247)crates/lakekeeper/src/catalog/views/exists.rs (2)
authorized_view_ident_to_id(27-27)authorized_view_ident_to_id(42-58)crates/authz-openfga/src/migration.rs (1)
authorizer_for_empty_store(172-193)
crates/lakekeeper/src/catalog/tables.rs (3)
crates/authz-openfga/src/check.rs (1)
authorized_table_ident_to_id(268-268)crates/lakekeeper/src/tests/internal_helper.rs (1)
create_table_request(192-217)crates/lakekeeper/src/tests/mod.rs (1)
random_request_metadata(222-224)
crates/authz-openfga/src/config.rs (1)
crates/lakekeeper/src/config.rs (7)
get_config(35-80)default(401-403)default(431-500)config(53-54)from(543-552)deserialize(376-385)deserialize(572-578)
crates/lakekeeper/src/catalog/views/exists.rs (2)
crates/authz-openfga/src/check.rs (1)
authorized_view_ident_to_id(318-318)crates/lakekeeper/src/tests/internal_helper.rs (1)
create_view_request(149-190)
crates/lakekeeper/src/config.rs (1)
crates/authz-openfga/src/config.rs (3)
default(101-103)config(43-43)get_config(29-51)
crates/authz-openfga/src/authorizer.rs (6)
crates/authz-openfga/src/health.rs (1)
health(12-14)crates/lakekeeper/src/service/authz/mod.rs (30)
health(1078-1080)implementation_name(205-205)implementation_name(1087-1089)server_id(209-209)server_id(1091-1093)api_doc(212-212)api_doc(1095-1097)new_router(215-215)new_router(1099-1101)check_actor(219-219)check_actor(1103-1105)can_bootstrap(222-222)can_bootstrap(1107-1109)bootstrap(225-225)bootstrap(1111-1113)list_projects_impl(228-228)list_projects_impl(1115-1120)can_search_users_impl(239-239)can_search_users_impl(1122-1124)delete_user(598-598)delete_user(1227-1229)delete_role(611-611)delete_role(1240-1242)create_project(615-619)create_project(1244-1250)delete_table(672-672)delete_table(1304-1306)delete_view(686-686)delete_view(1318-1320)from(172-174)crates/authz-openfga/src/api.rs (1)
new_v1_router(1345-1423)crates/lakekeeper/src/request_metadata.rs (2)
actor(165-170)user_id(64-70)crates/authz-openfga/src/error.rs (3)
from(54-56)from(60-120)from(124-127)crates/authz-openfga/src/client.rs (2)
new_authorizer(80-98)new_client_from_default_config(15-51)
crates/lakekeeper/src/tests/mod.rs (3)
crates/lakekeeper/src/implementations/postgres/migrations/mod.rs (1)
migrate(27-96)crates/lakekeeper/src/catalog/mod.rs (2)
new(103-122)setup(328-349)crates/authz-openfga/src/check.rs (1)
setup(598-629)
crates/lakekeeper/src/tests/internal_helper.rs (3)
crates/lakekeeper/src/tests/mod.rs (1)
random_request_metadata(222-224)crates/lakekeeper/src/catalog/mod.rs (2)
new(103-122)create_ns(310-326)crates/lakekeeper/src/api/iceberg/v1/tables.rs (1)
not_specified(412-417)
⏰ 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). (9)
- GitHub Check: security_audit
- GitHub Check: docker / docker
- GitHub Check: openfga
- GitHub Check: docker / docker
- GitHub Check: test
- GitHub Check: clippy
- GitHub Check: check-generated-openapi-matches
- GitHub Check: sqlx-check
- GitHub Check: security_audit
🔇 Additional comments (19)
crates/lakekeeper/src/service/event_publisher/mod.rs (1)
47-49: Lint suppression makes senseAllowing
clippy::unused_asynchere keeps the async signature stable across feature flags without spurious lint noise. Looks good.crates/lakekeeper/src/catalog/tables.rs (1)
1230-1247: LGTM! Public visibility enables OpenFGA crate integration.The change from
pub(crate)topubvisibility is appropriate for the architectural refactoring to move the OpenFGA authorizer to a separate crate. The function maintains proper authorization enforcement by requiring both warehouse and table actions before returning theTableId, so exposing it as a public API is safe.crates/lakekeeper/src/service/authn.rs (1)
288-302: LGTM: Public API exposure with proper validation.Making
try_newpublic is appropriate for the goal of moving OpenFGA Authorizer to a separate crate. The method has comprehensive validation (empty check, length limit, control characters, IdP ID presence) and clear error handling. The doc comments are well-written and follow Rust documentation standards.crates/authz-openfga/src/health.rs (1)
1-8: LGTM! Import reorganization aligns with crate separation.The import path updates correctly reference lakekeeper for shared types (Health, ProjectId, ServerId), and the test function rename to
new_client_from_default_configis consistent with the refactoring in client.rs.Also applies to: 41-52
crates/authz-openfga/src/client.rs (1)
59-70: LGTM! Visibility upgrade is correct for crate separation.The function
new_authorizer_from_default_configis nowpub(previouslypub(crate)), which is necessary since the OpenFGA authorizer is being moved to a separate crate and needs to be accessible from lakekeeper. The rename fromnew_authorizer_from_configtonew_authorizer_from_default_configalso better conveys that it uses the crate's default configuration.crates/authz-openfga/src/relations.rs (1)
62-78: LGTM! Clean trait abstraction for Actor conversion.The
ActorExttrait provides a well-defined extension point for convertingActortoOption<UserOrRole>. The implementation correctly handles the three Actor variants (Principal, Role, Anonymous), and the crate-level visibility is appropriate.crates/lakekeeper/src/tests/internal_helper.rs (1)
54-217: LGTM! Well-structured test utilities.The centralized test helper functions (
create_ns,create_table,drop_table,create_view,drop_namespace) provide clean abstractions for common test operations. The factory functions (create_view_request,create_table_request) encapsulate test data generation nicely.release-please/.release-please-manifest.json (1)
4-5: LGTM! Correctly adds authz-openfga to release manifest.The new crate entry is properly formatted and versioned at 0.10.0, consistent with the other workspace crates.
crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
1197-1197: LGTM! Test import simplification improves readability.The change from
crate::catalog::views::create::test::create_view_requesttotests::create_view_requestuses the centralized test utilities and reduces verbosity.Also applies to: 1238-1238, 1321-1321
crates/lakekeeper/src/catalog/views/list.rs (1)
99-99: LGTM! Consistent test import simplification.The import path changes align with the centralized test utilities pattern, improving consistency across the test suite.
Also applies to: 137-137, 201-201, 409-409
crates/lakekeeper/src/catalog/views/drop.rs (1)
182-182: LGTM: Test helper consolidation.The import path simplification improves test maintainability by centralizing test utilities under the
testsmodule.crates/lakekeeper/src/catalog/mod.rs (1)
6-6: LGTM: Module visibility broadened for crate separation.Making
namespaceandviewsmodules public supports the PR's objective of extracting the OpenFGA authorizer into a separate crate, which needs access to these catalog components.Also applies to: 11-11
crates/lakekeeper/src/catalog/views.rs (1)
12-12: LGTM: Function visibility broadened for OpenFGA integration.Making
authorized_view_ident_to_idpublic enables the separateauthz-openfgacrate to perform authorization checks on views, as seen incrates/authz-openfga/src/check.rs:317.crates/lakekeeper/src/catalog/views/create.rs (1)
213-213: LGTM: Test helper consolidation.Consistent with the broader test infrastructure refactoring, this change centralizes the
create_view_requesthelper under the sharedtestsmodule.crates/lakekeeper/src/catalog/views/rename.rs (1)
115-115: LGTM: Test helper consolidation.Consistent with the test infrastructure refactoring across view-related test modules.
crates/lakekeeper/src/catalog/views/load.rs (1)
141-141: LGTM: Test helper consolidation.Aligns with the test infrastructure refactoring pattern applied across view-related test modules.
Cargo.toml (1)
4-4: LGTM: Workspace changes for OpenFGA separation.Adding
authz-openfgaas a workspace member andtracing-testdependency supports the PR's objective of extracting the OpenFGA authorizer into a separate crate.Also applies to: 161-161
crates/lakekeeper/Cargo.toml (2)
31-31: LGTM: Test utilities feature flag.The
test-utilsfeature properly gates test infrastructure, enabling in-memory storage for testing scenarios.
127-127: LGTM: Self-referential dev-dependency for test utilities.The pattern of adding the crate as a dev-dependency with
test-utilsenabled is a common and correct approach in Rust for exposing test utilities without polluting the production dependency tree.
|
@CodeRabbit full review. |
|
@c-thiel: I'll perform a full review of this PR that moves the OpenFGA Authorizer to a separate crate. I've noted your observation about the I'll review the entire changeset, including:
✅ Actions performedFull review triggered. |
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 (4)
crates/lakekeeper/src/service/storage/mod.rs (1)
8-74: Restore Memory profile for unit testsBy switching all
Memorydefinitions from#[cfg(test)]to#[cfg(feature = "test-utils")], the memory profile disappears when we runcargo testwithout explicitly enabling that feature. The unit tests at the bottom of this file still referenceMemoryProfile::default()andStorageProfile::Memory, so the build now fails unless the feature is manually toggled on. Please gate these items (and the corresponding match arms) withcfg(any(test, feature = "test-utils"))so unit tests keep working out of the box while still allowing you to enable the variant in other crates via the feature flag.crates/authz-openfga/src/authorizer.rs (1)
1012-1050: Reset continuation token per userset suffix
delete_user_relationsreuses the samecontinuation_tokenacross all suffixes. After the first suffix finishes, the token remainsSome(""), so thewhile continuation_token != Some(String::new())guard short-circuits and every subsequent suffix (including the base user without suffix) is skipped. As a result, we leave relations in place and the cascade delete silently fails. Reset the token at the beginning of each suffix iteration so every userset is actually scanned.Apply this fix:
- let mut continuation_token = None; - for suffix in s { + let mut continuation_token = None; + for suffix in s { + continuation_token = None; let user = format!("{fga_user_str}{suffix}"); while continuation_token != Some(String::new()) { let response = selfcrates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
20-38: Remove unconditionalcrate::testsimport
crate::testsonly exists when we compile withcfg(test)or enable thetest-utilsfeature. Pullingtests::create_view_requestinto the top-level import list makes a normal (feature-less) build fail, because the module isn’t defined. Please keep this helper import inside the#[cfg(test)]module (or gate it with the same cfg) so release builds still compile.service::{ authz::{Authorizer, CatalogProjectAction, CatalogWarehouseAction}, secrets::SecretStore, task_queue::{tabular_expiration_queue::TabularExpirationTask, TaskFilter, TaskQueueName}, Catalog, ListFlags, NamespaceId, State, TabularId, Transaction, }, - tests::create_view_request, ProjectId, WarehouseId,crates/lakekeeper/src/tests/mod.rs (1)
133-137: Default test setup now runs as an anonymous actorWhen
SetupTestCatalog::builder()is used without explicitly supplying auser_id, the new code falls back torandom_request_metadata(), which now returnsRequestMetadata::new_unauthenticated()(Actor::Anonymous). The subsequent bootstrap/warehouse creation paths call intoApiServer::create_warehouse, which goes throughAuthorizer::require_action; anonymous actors are rejected withAuthenticationRequired(seechecked_writein crates/authz-openfga/src/api.rs). As a result the default builder (withoutuser_id) now panics on.unwrap(), breaking the common helper flow. Please restore the previous behaviour of generating a real (random) principal or surface an explicit requirement foruser_idso we never execute privileged ops as anonymous.pub(crate) fn random_request_metadata() -> RequestMetadata { - RequestMetadata::new_unauthenticated() + let user = + UserId::new_unchecked("oidc", &uuid::Uuid::now_v7().to_string()); + RequestMetadata::random_human(user) }
🧹 Nitpick comments (4)
crates/lakekeeper/src/config.rs (1)
368-406: Previous review concern addressed: normalization implemented correctly.The deserialization now trims and normalizes input (line 381), which addresses the previous review comment about whitespace and casing issues. The implementation correctly handles "allowall", "allow-all", and their variants.
Minor observation: The
Serializeimplementation (line 397) callsto_lowercase()on theExternalvariant's string, which is already normalized during deserialization. While redundant, this is defensive and harmless.Consider adding a test case for whitespace handling to ensure the trim operation works as expected:
#[test] fn test_authz_backend_with_whitespace() { figment::Jail::expect_with(|jail| { jail.set_env("LAKEKEEPER_TEST__AUTHZ_BACKEND", " AllowAll "); let config = get_config(); assert_eq!(config.authz_backend, AuthZBackend::AllowAll); Ok(()) }); figment::Jail::expect_with(|jail| { jail.set_env("LAKEKEEPER_TEST__AUTHZ_BACKEND", " my-authz "); let config = get_config(); assert_eq!( config.authz_backend, AuthZBackend::External("my-authz".to_string()) ); Ok(()) }); }crates/lakekeeper/src/catalog/tables.rs (1)
1231-1245: Fix action conversion bound direction
authorized_table_ident_to_idnow takesaction: impl From<CatalogTableAction>, butrequire_table_actionneeds something that can be converted into aCatalogTableAction. With the current bound we only admit types you can build from a catalog action, so API‑level enums likeAPITableAction(whereCatalogTableAction: From<APITableAction>) cannot be passed here. Please flip the constraint toInto<CatalogTableAction>and hand the converted value torequire_table_action.-pub async fn authorized_table_ident_to_id<C: Catalog, A: Authorizer>( +pub async fn authorized_table_ident_to_id<C: Catalog, A: Authorizer>( authorizer: A, metadata: &RequestMetadata, warehouse_id: WarehouseId, table_ident: &TableIdent, list_flags: ListFlags, - action: impl From<CatalogTableAction> + std::fmt::Display + Send, + action: impl Into<CatalogTableAction> + std::fmt::Display + Send, transaction: <C::Transaction as Transaction<C::State>>::Transaction<'_>, ) -> Result<TableId> { authorizer - .require_table_action(metadata, warehouse_id, table_details, action) + .require_table_action(metadata, warehouse_id, table_details, action.into()) .await .map_err(set_not_found_status_code) }crates/lakekeeper/src/service/authn.rs (1)
288-302: Clarify visibility of UserId::try_new
Consider restricting it topub(crate)since no external references were found; if it’s intended as part of the public API, document it in the crate-level docs and note the change in the CHANGELOG.crates/lakekeeper-bin/src/authorizer.rs (1)
24-32: Consider adding migration status logging.The migration function silently succeeds when OpenFGA is disabled. Consider adding a log statement to indicate when migration is skipped for observability.
pub(crate) async fn migrate(server_id: ServerId) -> anyhow::Result<()> { if OPENFGA_CONFIG.is_openfga_enabled() { let client = lakekeeper_authz_openfga::new_client_from_default_config().await?; // Passing None here will use the store name from the config let store_name_override = None; openfga_migrate(&client, store_name_override, server_id).await?; + } else { + tracing::info!("Skipping OpenFGA migration (OpenFGA not enabled)"); } Ok(()) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (50)
Cargo.toml(2 hunks)crates/authz-openfga/Cargo.toml(1 hunks)crates/authz-openfga/src/api.rs(3 hunks)crates/authz-openfga/src/authorizer.rs(40 hunks)crates/authz-openfga/src/check.rs(5 hunks)crates/authz-openfga/src/client.rs(2 hunks)crates/authz-openfga/src/config.rs(1 hunks)crates/authz-openfga/src/entities.rs(2 hunks)crates/authz-openfga/src/error.rs(1 hunks)crates/authz-openfga/src/health.rs(2 hunks)crates/authz-openfga/src/lib.rs(1 hunks)crates/authz-openfga/src/migration.rs(8 hunks)crates/authz-openfga/src/migration/migration_fns_v4.rs(6 hunks)crates/authz-openfga/src/models.rs(2 hunks)crates/authz-openfga/src/relations.rs(3 hunks)crates/lakekeeper-bin/Cargo.toml(1 hunks)crates/lakekeeper-bin/src/authorizer.rs(1 hunks)crates/lakekeeper-bin/src/main.rs(3 hunks)crates/lakekeeper-bin/src/serve.rs(2 hunks)crates/lakekeeper-bin/src/ui.rs(1 hunks)crates/lakekeeper/Cargo.toml(3 hunks)crates/lakekeeper/src/api/management/v1/bootstrap.rs(2 hunks)crates/lakekeeper/src/api/management/v1/role.rs(1 hunks)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs(3 hunks)crates/lakekeeper/src/catalog/mod.rs(1 hunks)crates/lakekeeper/src/catalog/namespace.rs(1 hunks)crates/lakekeeper/src/catalog/tables.rs(2 hunks)crates/lakekeeper/src/catalog/views.rs(1 hunks)crates/lakekeeper/src/catalog/views/commit.rs(1 hunks)crates/lakekeeper/src/catalog/views/create.rs(1 hunks)crates/lakekeeper/src/catalog/views/drop.rs(4 hunks)crates/lakekeeper/src/catalog/views/exists.rs(2 hunks)crates/lakekeeper/src/catalog/views/list.rs(4 hunks)crates/lakekeeper/src/catalog/views/load.rs(2 hunks)crates/lakekeeper/src/catalog/views/rename.rs(2 hunks)crates/lakekeeper/src/config.rs(3 hunks)crates/lakekeeper/src/lib.rs(3 hunks)crates/lakekeeper/src/request_metadata.rs(2 hunks)crates/lakekeeper/src/service/authn.rs(2 hunks)crates/lakekeeper/src/service/authz/implementations/allow_all.rs(1 hunks)crates/lakekeeper/src/service/authz/implementations/mod.rs(1 hunks)crates/lakekeeper/src/service/authz/mod.rs(2 hunks)crates/lakekeeper/src/service/event_publisher/mod.rs(1 hunks)crates/lakekeeper/src/service/storage/mod.rs(14 hunks)crates/lakekeeper/src/service/storage/s3.rs(6 hunks)crates/lakekeeper/src/tests/internal_helper.rs(1 hunks)crates/lakekeeper/src/tests/mod.rs(1 hunks)docs/docs/api/management-open-api.yaml(1 hunks)release-please/.release-please-manifest.json(1 hunks)release-please/release-please-config.json(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-25T06:54:15.179Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1378
File: crates/lakekeeper/src/api/management/v1/warehouse/undrop.rs:51-53
Timestamp: 2025-09-25T06:54:15.179Z
Learning: In the lakekeeper codebase, when iterating over &[TabularId] and pattern matching TabularId::View(id), the id variable has type &ViewId. Using *id correctly dereferences to get ViewId, which can be passed directly to authorization methods that expect ViewId parameters.
Applied to files:
crates/lakekeeper/src/catalog/views.rscrates/lakekeeper/src/catalog/views/exists.rscrates/lakekeeper/src/catalog/tables.rs
📚 Learning: 2025-09-08T09:10:07.658Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1328
File: crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs:103-112
Timestamp: 2025-09-08T09:10:07.658Z
Learning: The OpenFGAAuthorizer constructor in crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs should maintain backward compatibility during the transition away from nil UUIDs. Hard assertions that would panic on nil UUID input should be avoided to prevent breaking existing deployments.
Applied to files:
crates/lakekeeper-bin/src/authorizer.rscrates/authz-openfga/src/migration/migration_fns_v4.rscrates/lakekeeper-bin/src/main.rscrates/lakekeeper-bin/src/serve.rscrates/lakekeeper/src/service/authz/implementations/mod.rs
📚 Learning: 2025-09-21T09:54:54.868Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1348
File: .sqlx/query-1c1a32de33e3f54464a1107f7d4d4b8cbd99dd69aae1c740561c3cbbea2eaa19.json:9-10
Timestamp: 2025-09-21T09:54:54.868Z
Learning: In the lakekeeper codebase, ServerId newtype uses manual conversion between uuid::Uuid and ServerId at query call sites rather than sqlx transparent annotations like #[sqlx(transparent)]. The manual conversion approach is the preferred pattern in this codebase.
Applied to files:
crates/authz-openfga/src/migration.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: check-generated-openapi-matches
- GitHub Check: test
- GitHub Check: clippy
- GitHub Check: sqlx-check
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
🔇 Additional comments (37)
release-please/.release-please-manifest.json (1)
4-5: Manifest entry looks goodThe new
crates/authz-openfgamapping integrates cleanly with release-please; no issues spotted.crates/lakekeeper/src/service/event_publisher/mod.rs (1)
47-77: Verify that this lint suppression is intentional.The
#[allow(clippy::unused_async)]attribute correctly suppresses warnings when thenatsfeature is disabled, as the function would have no await points in that configuration. This approach maintains a consistent async API surface across feature flags, which is reasonable for a config-builder function.However, this change appears tangential to the PR's main objective of moving OpenFGA to a separate crate. Please confirm this lint suppression was intentionally added as part of this work (perhaps due to dependency or feature flag adjustments), rather than being an unrelated cleanup.
crates/lakekeeper/src/catalog/views.rs (1)
12-12: LGTM: Visibility widening to support new crate structure.The change from
pub(crate)topubforauthorized_view_ident_to_idaligns with the PR's objective to move OpenFGA authorization to a separate crate, allowing external access to this validation helper.crates/lakekeeper/src/request_metadata.rs (1)
284-286: LGTM: Import style refactoring.The change from a local import to a fully-qualified path
iceberg_ext::catalog::rest::IcebergErrorResponsemaintains identical behavior while making the type's origin explicit at the call site.crates/lakekeeper/src/api/management/v1/role.rs (1)
138-138: LGTM: Public API expansion for authorization integration.Widening the
Servicetrait visibility frompub(crate)topubenables the separateauthz-openfgacrate to implement or interact with role management services. The trait's generic constraints and method signatures remain unchanged.crates/lakekeeper/Cargo.toml (2)
31-31: LGTM: Test utilities properly configured.The
test-utilsfeature now correctly enableslakekeeper-io/storage-in-memory, providing actual in-memory storage functionality for tests rather than being an empty feature flag.
127-128: LGTM: Standard self-dependency pattern for test utilities.The dev-dependency on
lakekeeperwithtest-utilsenabled is a standard Rust pattern that makes test utilities available to the crate's own tests without requiring feature activation in every test file.crates/lakekeeper/src/service/authz/mod.rs (2)
205-206: LGTM: Useful addition for authorizer identification.The new
implementation_name()static method provides a clean way to identify the authorizer implementation at runtime, which can be helpful for logging, metrics, and debugging across different authorization backends.
1087-1089: LGTM: Appropriate test implementation.The
HidingAuthorizerreturns a descriptive name "test-hiding-authorizer" that clearly identifies it as a test utility, consistent with its purpose as a testing mock.crates/lakekeeper/src/catalog/namespace.rs (1)
534-535: LGTM: Public API expansion with helpful documentation.The visibility change from
pub(crate)topubenables the separateauthz-openfgacrate to use this namespace validation and authorization helper. The added doc comment clearly describes the function's purpose, improving the public API's usability.crates/authz-openfga/src/health.rs (2)
1-8: LGTM: Import restructuring for new crate organization.The imports are now properly organized with
lakekeepertypes imported from the main crate and OpenFGA-specific types imported via crate-relative paths, aligning with the new separate crate structure.
41-48: LGTM: Test updates for new client API.The test correctly uses
new_client_from_default_config()instead of the previousnew_client_from_config(), reflecting the updated client construction API in the refactored authz-openfga crate.Also applies to: 52-52
crates/lakekeeper/src/catalog/views/drop.rs (1)
182-182: LGTM: Test helper import consolidation.The import reorganization to use centralized test helpers improves maintainability and reduces code duplication across test modules.
Cargo.toml (2)
3-3: LGTM: New authz-openfga workspace member.The addition of the authz-openfga crate to the workspace aligns with the PR's objective to separate OpenFGA authorization into its own crate.
161-161: LGTM: tracing-test dependency addition.The addition of tracing-test is reasonable for testing infrastructure in the new authz-openfga crate.
crates/lakekeeper/src/catalog/views/create.rs (1)
213-213: LGTM: Test helper import consolidation.Consistent with the broader test refactor to use centralized test utilities.
crates/lakekeeper/src/catalog/views/commit.rs (1)
403-404: LGTM: Test import consolidation.Consistent with the broader refactor to centralize test utilities.
crates/lakekeeper/src/service/authn.rs (1)
304-308: LGTM: Feature-gated test utility.The change from
cfg(test)tocfg(feature = "test-utils")aligns with the PR objective to make test utilities available to other crates when needed. This is acknowledged in the PR comments as a deliberate design choice.crates/authz-openfga/src/error.rs (3)
2-2: LGTM: Import path updated for separate crate.The import path change from
iceberg_ext::catalog::resttolakekeeper::apiis correct for the new authz-openfga crate structure, where it now depends on the lakekeeper crate as an external dependency.
5-5: LGTM: FgaType import path updated.The import path correctly references
crate::FgaTypefor the new crate structure.
7-10: LGTM: Public visibility for error types.Making
OpenFGAResultandOpenFGAErrorpublic is appropriate for the new authz-openfga crate, as these types will be part of its public API and need to be accessible to consumers of the crate.crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
53-55: No changes needed:implementation_name()is defined in theAuthorizertrait and implemented by all authorizer variants.crates/lakekeeper/src/catalog/mod.rs (1)
6-11: Confirm public API innamespaceandviewsmodules
A quick search found no public items—please manually verify that any intended types, functions, or traits in these modules are correctly exposed and documented, that making them public aligns with the authz-openfga integration, and that future breaking changes are handled carefully.crates/lakekeeper/src/catalog/views/exists.rs (1)
42-58: LGTM! Visibility widened to support new crate structure.The function
authorized_view_ident_to_idvisibility changed frompub(crate)topub, which is appropriate for the new architecture where the OpenFGA authorizer is in a separate crate and may need to access this helper.crates/authz-openfga/src/migration.rs (3)
108-127: LGTM! Visibility change aligns with crate boundaries.The
get_active_auth_model_idfunction visibility changed topub(crate), which is appropriate for internal use within the authz-openfga crate.
142-161: LGTM! Public visibility enables external migration orchestration.The
migratefunction is nowpub, making it accessible from the lakekeeper-bin crate for orchestrating authorization migrations. This aligns with the separation of concerns in the new architecture.
51-51: Schema include paths resolve correctly after crate relocation.crates/lakekeeper-bin/src/authorizer.rs (1)
1-22: LGTM! Well-structured authorizer selection pattern.The
AuthorizerEnumprovides a clean abstraction for runtime authorizer selection. Key design decisions:
- Boxing
OpenFGAAuthorizerprevents the enum from being excessively large- Conditional initialization based on
OPENFGA_CONFIG.is_openfga_enabled()ensures the correct backend is selected- Using
anyhow::Resultis appropriate for application-level error handling in the binarycrates/lakekeeper/src/lib.rs (3)
16-16: LGTM! Public API cleaned up after OpenFGA extraction.Removing
OpenFGAAuthfrom the public exports is correct, as OpenFGA-specific types have been moved to theauthz-openfgacrate. This reduces the surface area of the lakekeeper crate's public API.
40-41: LGTM! Feature-gated sqlx re-export follows best practices.Conditionally re-exporting
sqlxbehind the"sqlx"feature flag prevents unnecessary transitive dependencies when the feature is not needed.
60-61: LGTM! Test utilities available via feature flag.Making the tests module available under both
testandtest-utilsfeature conditions allows test utilities to be shared with other crates (likeauthz-openfga) that depend on lakekeeper withfeatures = ["test-utils"].crates/lakekeeper-bin/src/serve.rs (1)
26-40: LGTM! Clean integration of the new authorizer selection pattern.The changes successfully integrate
AuthorizerEnum:
- Line 26: Uses the new async initialization method
- Lines 30-40: Pattern matching with informative logging for each variant
- Line 37: Correctly dereferences the boxed
OpenFGAAuthorizerwith*authzThe logging statements provide good observability into which authorizer was selected at runtime.
crates/lakekeeper-bin/src/main.rs (3)
13-16: LGTM! Imports updated to reflect new crate structure.The imports correctly reference:
BUILT_IN_API_CONFIGSfrom the lakekeeper service moduleOpenFGAAuthorizerfrom the newlakekeeper-authz-openfgacrate
152-153: LGTM! Migration path updated to use new module.The authorizer migration now uses the local
authorizer::migratefunction, which provides a cleaner abstraction and centralizes the migration logic for different authorizer backends.
183-189: LGTM! Improved OpenAPI generation with proper error handling.The OpenAPI generation logic has been improved:
- Line 183: Borrows
CONFIG.authz_backendby reference, avoiding unnecessary moves- Line 185-186: Handles the
External("openfga")case correctly- Line 188: Provides clear error messages for unsupported external backends using
anyhow::bail!This provides better extensibility while preventing silent failures for unsupported backends.
crates/authz-openfga/Cargo.toml (1)
21-21: openfga-client version is current and secure. Pinned to 0.4.0, the latest stable release, with no known security advisories.crates/lakekeeper/src/api/management/v1/bootstrap.rs (1)
57-57: Breaking API change:authz_backendfield type changed from enum to String.The
authz_backendfield inServerInfonow returns a plain string instead of theAuthZBackendenum, breaking existing clients.Enforce:
- Document in release notes
- Communicate to API consumers
- Bump API version
✅ Actions performedComments resolved and changes approved. |
|
@CodeRabbit anything still open? Else approve. |
|
@c-thiel: All items from the review have been addressed and resolved. The refactoring to move the OpenFGA Authorizer to a separate crate looks good: ✅ Clean separation into Approving the changes! ✅ Actions performedComments resolved and changes approved. |
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
* 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
Refactor
Chores