You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Server] Avoid reloading OPA metadata for each privilege check #2108
Is your feature request related to a problem? Please describe.
In the OPA authorizer proposed in #2077, authorizeAny and authorizeAll call authorize for each evaluated privilege. Each call opens a read transaction and loads the same user, resource, and parent records again.
If OPA denies OWNER, UC checks SELECT next. Both checks need the same user, table, schema, and catalog metadata, but UC reads those records twice. Only the privilege differs between the OPA requests.
Describe the solution you would like
Load the shared metadata once per authorizeAny or authorizeAll call and reuse it to build each privilege request.
Continue sending a separate OPA request for each evaluated privilege, in the same order and with the same short-circuit behavior.
Keep the reused metadata within that call; do not share it across requests.
Preserve the existing handling of missing records, database failures, and OPA failures.
Add focused tests that verify the metadata is read once, each evaluated privilege still reaches OPA, and short-circuiting and failure handling are preserved.
#2105 discussion covers caching permission answers when list items share parent checks. This issue covers reusing metadata for different privilege checks. The two changes can be implemented independently.
changed the title [-][Server] Reuse authorization decisions and metadata within a request[/-][+][Server] Avoid reloading OPA metadata for each privilege check[/+]on Nov 4, 2026
Hi, I'd like to contribute this improvement. I'd first trace the OPA authorizer and its tests, then propose reusing shared metadata within each authorizeAny/authorizeAll call while keeping separate OPA requests, evaluation order, short-circuiting, and existing failure behavior. I'd add focused tests for metadata read counts and those behavioral guarantees. Is anyone already working on this, and should the change wait for #2077 to merge?
Thanks for offering to take this on, @Orcus01! We haven’t started working on it, so please go ahead. #2077 is already merged, so you can start from the latest main.
Your proposed approach and tests match what we had in mind. Please keep the change focused on reusing metadata within each call using the existing classes.
Activity
[-][Server] Reuse authorization decisions and metadata within a request[/-][+][Server] Avoid reloading OPA metadata for each privilege check[/+]Orcus01 commentedon Nov 4, 2026
Hi, I'd like to contribute this improvement. I'd first trace the OPA authorizer and its tests, then propose reusing shared metadata within each authorizeAny/authorizeAll call while keeping separate OPA requests, evaluation order, short-circuiting, and existing failure behavior. I'd add focused tests for metadata read counts and those behavioral guarantees. Is anyone already working on this, and should the change wait for #2077 to merge?
timothyw553 commentedon Nov 4, 2026
Thanks for offering to take this on, @Orcus01! We haven’t started working on it, so please go ahead. #2077 is already merged, so you can start from the latest
main.Your proposed approach and tests match what we had in mind. Please keep the change focused on reusing metadata within each call using the existing classes.
[Server] Reuse OPA metadata within each authorization call (unitycata…