Repository navigation
feat(views)!: protect trino.run-as-owner and DEFINER view versions by default - #2212
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Authentication state and protected-property configuration crates/lakekeeper/src/service/mod.rs, crates/lakekeeper/src/config.rs, crates/lakekeeper/src/api/router.rs, crates/lakekeeper/src/serve.rs, crates/lakekeeper-storage-postgres/src/test_utils.rs, crates/lakekeeper-integration-tests/tests/view_owner_router.rs |
API state now records authentication status. Configuration always protects Trino’s trino.run-as-owner key and adds configured trusted-engine owner properties. Router setup synchronizes authentication state and logs warnings for mismatches or disabled authentication with configured trusted engines. |
Owner-property authorization rules crates/lakekeeper/src/server/views/owner_property.rs |
The new module checks protected property writes and current-version changes against matched-engine ownership. It identifies properties to remove when a trusted engine changes the view query. |
View creation checks crates/lakekeeper-integration-tests/src/*, crates/lakekeeper/src/server/views/create.rs, crates/lakekeeper-integration-tests/tests/server_views_create.rs |
View creation checks protected property writes and reports authorization failures. Tests cover trusted, untrusted, and unauthenticated requests. |
View commit validation and updates crates/lakekeeper/src/server/views/commit.rs, crates/lakekeeper/src/server/tables.rs, crates/lakekeeper/src/service/contract_verification.rs, crates/lakekeeper-integration-tests/tests/server_views_commit.rs |
View commits check property writes and version changes. When needed, commits append owner-property removals and pass the applied updates to contract verification and commit events. Tests cover authorization and update propagation. |
Audit coverage and operational documentation crates/lakekeeper-integration-tests/tests/audit_corpus.rs, crates/lakekeeper/src/service/events/backends/audit/*, audit-format/unreleased/*, docs/docs/*, examples/access-control-*/docker-compose.yaml, tests/docker-compose.yaml |
Audit tests and fixtures cover denied view creation and commit operations. Documentation, examples, and release notes describe the owner-property rules and trusted-engine setup. |
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant ViewCommit
participant owner_property
participant build_committed_metadata
participant ContractVerification
participant Catalog
participant CommitEvent
ViewCommit->>owner_property: Check requested property writes
ViewCommit->>build_committed_metadata: Build metadata and check version change
build_committed_metadata-->>ViewCommit: Return metadata and applied request
ViewCommit->>ContractVerification: Check applied updates
ViewCommit->>Catalog: Commit view metadata
ViewCommit->>CommitEvent: Emit commit event after retries
Merge Risk: 
Minimal · up to 4580c
-
This change protects the Trino owner property and DEFINER view versions on authenticated servers, and it is documented as a breaking change for operators who rely on Trino creating DEFINER views. No concrete merge-blocking defect was established in the supplied code or tests. Operators need to configure Trino as a trusted engine, as the release notes describe.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 62.07% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 29 functions across 18 files. (11 skipped: 11 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks each view with care,
Owner keys need trust to be there.
New versions pass the proper gate,
Stale keys leave when queries change state.
Audit crumbs record each trail,
The bunny hops beyond the veil.
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
Trino runs a
SECURITY DEFINERview as the user in itstrino.run-as-ownerproperty. Protecting this property was opt-in: Lakekeeper protected it only once Trino was configured as a trusted engine. Lakekeeper now protects it by default on servers with authentication, and also protects the version of views that carry it.Rules
trino.run-as-owner(or another configured owner key) can set, change or remove it. Others get403 ProtectedPropertyModification. Without a configured trusted engine, nobody can writetrino.run-as-owner.403 ProtectedViewVersionChange; they can still change other properties, rename and drop.COMMENT ON COLUMN) keeps the owner.Operators
OWNER_PROPERTY=trino.run-as-owner, matched to the Trino catalog's service identity. Without it, Trino can only createSECURITY INVOKERviews, and existing DEFINER views cannot get a new version.trino.run-as-owner(see View Security → Check Existing Views).Docs:
view-security.md,opa.md,configuration.md,logging.md. Theaccess-control-simpleexample andtests/docker-compose.yamlnow configure Trino as a trusted engine.Release notes
Breaking Changes
trino.run-as-owneror change a view that has it. Configure Trino as a trusted engine to keep creatingSECURITY DEFINERviews.Upgrade Notes
trino.run-as-owner. Make sure each owner is correct; see View Security.Downstream follow-up
State::authentication(ServerAuthentication::Enabled/Disabled); struct literals must set it.new_full_routersets it from the authenticator.CommitViewEvent::requestcan end with a server-addedremove-properties.DynAppConfig::default()protectstrino.run-as-owner. Tests that create DEFINER views need a Trino engine on the request (trino_engine_request()).Summary by CodeRabbit