Skip to content

fix(catalog): authorize list pages without holding a read connection - #2058

Merged
c-thiel merged 1 commit into
mainfrom
christian/vak-667-list-endpoints-hold-a-read-connection-while-authorizing-so
Sep 28, 2026
Merged

c-thiel merged 1 commit into
mainfrom
christian/vak-667-list-endpoints-hold-a-read-connection-while-authorizing-so

Conversation

@c-thiel

@c-thiel c-thiel commented Sep 27, 2026 •

Copy link
Copy Markdown
Member
  • Each page of a namespace, table, view or soft-deleted tabular list is read in its own read transaction, committed before the page is authorized, so a list never holds a read connection while an authorizer that reads the catalog waits for another.
  • The table and view lists check ListEverything on the namespace once per request.
  • HidingAuthorizer::with_check_hook runs a future inside every catalog object check, for tests of authorizers that read the catalog.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when listing namespaces, tables, views, and soft-deleted items concurrently, especially when database read connections are limited.
    • Listing requests now release database read transactions between page retrieval and authorization checks, helping prevent connection contention during paginated results.
    • Preserved authorization filtering and pagination behavior, including next-page token handling.

- Each page of a namespace, table, view or soft-deleted tabular list is read in its own read transaction, committed before the page is authorized, so a list never holds a read connection while an authorizer that reads the catalog waits for another.
- The table and view lists check `ListEverything` on the namespace once per request.
- `HidingAuthorizer::with_check_hook` runs a future inside every catalog object check, for tests of authorizers that read the catalog.
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cb893d16-c120-415d-a434-9ad928e5815a

📥 Commits

Reviewing files that changed from the base of the PR and between 1720a19 and c010a73.

📒 Files selected for processing (8)
  • crates/lakekeeper-integration-tests/tests/list_read_pool.rs
  • crates/lakekeeper/src/api/management/v1/warehouse/mod.rs
  • crates/lakekeeper/src/server/mod.rs
  • crates/lakekeeper/src/server/namespace.rs
  • crates/lakekeeper/src/server/tables.rs
  • crates/lakekeeper/src/server/tabular.rs
  • crates/lakekeeper/src/server/views/list.rs
  • crates/lakekeeper/src/service/authz/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

Listing pagination now commits each fetched page before authorization. Namespace, table, view, and soft-deleted-tabular listing paths use separated fetch and authorization steps. New integration tests exercise these paths concurrently with a two-connection read pool.

Changes

Listing pagination and authorization

Layer / File(s) Summary
Commit fetched pages before authorization
crates/lakekeeper/src/server/mod.rs
fetch_until_full_page fetches each page in a read transaction, commits it, then passes the page to authorization.
Adapt namespace and soft-deleted listings
crates/lakekeeper/src/server/namespace.rs, crates/lakekeeper/src/api/management/v1/warehouse/mod.rs
These listing paths now supply separate page-fetch and authorization callbacks. Soft-deleted listings fetch namespace records when individual authorization is needed.
Separate table and view fetching from authorization
crates/lakekeeper/src/server/tabular.rs, crates/lakekeeper/src/server/tables.rs, crates/lakekeeper/src/server/views/list.rs
Table and view handlers check ListEverything before fetching. Shared entity-listing macros separate page fetching from authorization.
Test concurrent listings with a constrained read pool
crates/lakekeeper/src/service/authz/mod.rs, crates/lakekeeper-integration-tests/tests/list_read_pool.rs
HidingAuthorizer supports an asynchronous check hook. Integration tests cover concurrent namespace, table, view, and soft-deleted-tabular listings.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Suggested reviewers: brgr-s

Merge Risk: ⚪ Minimal · up to c010a

The listing changes are ready to merge after normal checks; no outstanding issue was identified.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to c010a

Releasing the read connection before authorization addresses the reported pool contention. Table and view listings now check a broad listing permission before fetching the page, however, so a revocation during that fetch may not affect the response. The possible exposure is limited to listing metadata in that request.

Retained concerns

  • Medium · security · inferred: Moving the table/view ListEverything decision ahead of page fetching may allow a listing response to use permission revoked during that fetch, without a subsequent per-object visibility check.
Security review details

Security Blast Radius

  • inferred — The identified race concerns metadata returned by a table or view list for an initially authorized namespace. When ListEverything is true, all fetched items pass the mask and the helper normally returns at most the requested page rather than repeatedly refilling it.

Security Findings and Attack Paths

  • inferred — A caller allowed ListEverything at the early check could receive table or view identifiers after that permission is revoked during page fetching. The earlier implementation checked after fetching; whether production revocation semantics make this observable remains unverified.

Trust Boundaries and Controls

  • observed — Namespace ListTables or ListViews authorization precedes catalog access. ListEverything is a broader namespace-level decision that deliberately replaces per-object IncludeInList checks; without it, those checks remain.

Resilience and Maintainability Implications

  • observed — Initial and refill pages follow the same commit-before-authorization sequence, and errors propagate instead of returning a partially assembled authorized response.

Hardening Proposals

  • proposed — If revocations must affect in-flight listings, revalidate ListEverything after the page transaction closes and before omitting per-object checks; preserve the commit-before-authorization ordering.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: authorizing catalog list pages without holding a read connection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each page in flight
The read pool stays within its might
Names, tables, and views appear
Hidden rows are filtered clear
Eight requests hop through the queue
Soft-deleted lists join them too

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

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

@c-thiel
c-thiel merged commit f17759c into main Sep 28, 2026
74 checks passed
@c-thiel
c-thiel deleted the christian/vak-667-list-endpoints-hold-a-read-connection-while-authorizing-so branch September 28, 2026 05:29
brgr-s pushed a commit that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant