Repository navigation
[Server] Configure OPA authorization in the server - #2078
Conversation
e5c153c to
3794f17
Compare
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2076/files) to review incremental changes. - [**stack/auth-resource-types**](#2076) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2076/files)] ← _this PR_ - [stack/opa-authorizer](#2077) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2077/files/2912ae45366c1a9e3c3b849ac8c78a6e0ad7f7b8..11a01ea1d1964eb1292dc6bc5dabb7786fce7e2d)] - [stack/opa-server-config](#2078) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2078/files/11a01ea1d1964eb1292dc6bc5dabb7786fce7e2d..3794f17fbd2e0f69148f9369ed972733fc389fca)] --------- Signed-off-by: Timothy Wang <[email protected]> **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated (not applicable to this prerequisite; documentation follows in the integration PR) **Description of changes** The evaluator currently drops the resource type before calling the authorizer. Preserve the resolved `SecurableType` alongside each UUID so a backend can identify the resource it must authorize. Pass that type through `authorize`, `authorizeAny`, and `authorizeAll`, including direct calls from the permission and Iceberg services. Existing SpEL expressions, null guards, and Casbin decision logic keep their behavior. There is no REST API change. Validation: Java formatting and 83 focused server tests passed: ```sh build/sbt javafmtAll 'server/testOnly io.unitycatalog.server.auth.JCasbinAuthorizerTest io.unitycatalog.server.auth.JCasbinAuthorizerMultiInstanceTest io.unitycatalog.server.auth.decorator.UnityAccessEvaluatorTest io.unitycatalog.server.service.PermissionServiceTest io.unitycatalog.server.service.IcebergRestCatalogServiceTest io.unitycatalog.server.sdk.access.TemporaryPathCredentialAccessControlTest' ``` --------- Signed-off-by: Timothy Wang <[email protected]>
277eec6 to
17115ea
Compare
|
/review |
17115ea to
c769110
Compare
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2077/files) to review incremental changes. - [stack/auth-resource-types](#2076) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2076/files)] [MERGED] - [**stack/opa-authorizer**](#2077) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2077/files)] ← _this PR_ - [stack/opa-server-config](#2078) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2078/files/263cd4d4b764f3f32f209c29a3dc9ef9adf73f85..c76911014952bde0835c20721094c002a2c2c75b)] --------- Signed-off-by: Timothy Wang <[email protected]> **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated (not applicable to this prerequisite; documentation follows in the integration PR) **Description of changes** Add an OPA authorizer that asks about each evaluated privilege, such as `USE_CATALOG` on a catalog or `CREATE_TABLE` on a schema. UC still combines the answers through its existing expressions. Any/all checks preserve their order and short-circuit behavior. `OpaInputBuilder` reads the user's UUID, email and optional external ID, plus resource identity and parents. It supports every securable type and staging tables. No native grants, owner fields, tokens, or cloud credentials are sent. OPA replies must contain a boolean `result.allow`; unusable replies and connection failures return a generic `UNAVAILABLE` error, with no native fallback or decision cache. Missing users, resources, or parents deny the check without contacting OPA. Native grant and hierarchy methods delegate to the composed Casbin authorizer for bookkeeping. Server selection and user documentation follow in the child PR. Validation: Java formatting and all 30 backend/metadata tests passed: ```sh build/sbt javafmtAll 'server/testOnly io.unitycatalog.server.auth.OpaAuthorizerTest io.unitycatalog.server.auth.OpaInputBuilderTest' ``` --------- Signed-off-by: Timothy Wang <[email protected]>
c769110 to
f825cd7
Compare
|
/review |
61c4684 to
9de9e92
Compare
| "server.authorization.provider", "casbin", new EnumValidator(true, "casbin", "opa")), | ||
| OPA_DECISION_URL("server.authorization.opa.decision-url", URL_VALIDATOR), | ||
| OPA_RESPONSE_TIMEOUT( | ||
| "server.authorization.opa.response-timeout", "PT5S", POSITIVE_DURATION_VALIDATOR), |
There was a problem hiding this comment.
The 5s response timeout bounds each OPA call, but one request can make several calls in a row: authorizeAny/authorizeAll call OPA once per privilege (OpaAuthorizer.java:113-123), so #authorize(#principal, #metastore, OWNER) || #authorizeAny(#principal, #catalog, OWNER, USE_CATALOG) can make three. If OPA answers slowly but inside 5s each time, the request takes ~15s, past Armeria's 10s request timeout. A call that times out fails the request right away, so a hard-down OPA is fine. Would you consider a lower per-call default (Polaris uses PT2S) or a per-request OPA budget, plus a retry with exponential backoff for connection failures inside that budget? I'm adding matching timeouts to the database and cloud clients, so happy to line the values up.
There was a problem hiding this comment.
the OPA client now cancels pending calls when the UC request times out or is cancelled. added tests for both cases, including checking that later calls never reach OPA. kept the 5s per-call timeout and left retries for separate work.
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] No blockers from me. Casbin stays the default, the new properties are additive, and OPA outages fail closed as 503 across the UC, Iceberg and Delta handlers. I checked the CI log and the Docker-backed SdkOpaAccessControlTest really ran (all four methods), not skipped.
Inline: one design question on where the OPA config validation lives, one test that looks redundant, a question on the UNAVAILABLE unwrapping, a follow-up on list-filtering cost, and a nit. Also +1 to @shba24's thread on the per-call timeout vs the request timeout.
| * @throws BaseException with {@link ErrorCode#INVALID_ARGUMENT} for a missing URL, an unsupported | ||
| * scheme, an invalid host or port, credentials, or a fragment | ||
| */ | ||
| public String getOpaDecisionUrl() { |
There was a problem hiding this comment.
[AI Assisted] Can the OPA rules move into validateProperties()? It already hosts the cross-property checks (validateStorageCleanupConfiguration, validateAuthAllowlistConfiguration), so a dedicated validator on OPA_DECISION_URL plus the "opa requires server.authorization=enable" check there would turn this into a plain getter and drop the nullable opaDecisionUrl local in initializeAuthorizer.
Two side effects of the current placement: a bad OPA config fails only after initMetastoreIfNeeded() has written to the DB, and the generic URL_VALIDATOR echoes the raw value (userinfo included) in its message while this getter is careful not to.
There was a problem hiding this comment.
moved the OPA checks into normal property validation and added a dedicated URL validator that keeps credentials out of errors. startup also revalidates before creating resources, since callers can change properties through set(). the getter now just returns the configured value.
| HibernateConfigurator hibernateConfigurator, | ||
| Repositories repositories) { | ||
| String opaDecisionUrl = null; | ||
| if (serverProperties.isOpaAuthorizationEnabled()) { |
There was a problem hiding this comment.
[AI Assisted] See the comment on getOpaDecisionUrl(): if both checks live in ServerProperties.validateProperties(), this block collapses to return isOpaAuthorizationEnabled() ? new OpaAuthorizer(...) : authorizer; inside the existing try.
There was a problem hiding this comment.
removed the validation block and nullable URL variable. this now just selects the authorizer and logs when OPA is enabled.
| } | ||
|
|
||
| @Test | ||
| public void everyApiReportsAuthorizationUnavailable() throws Exception { |
There was a problem hiding this comment.
[AI Assisted] What does this cover that the existing tests don't? everyApiReportsTheErrorCode right above already renders UNAVAILABLE through all three handlers and asserts the status, and the evaluator unwrapping is already pinned by UnityAccessEvaluatorTest.unavailableDecisionsPropagateWithoutRefresh. I'd drop it.
There was a problem hiding this comment.
removed it and the unused imports. the existing tests already cover the 503 responses and propagation of the original authorization error.
| Boolean result = parser.parseExpression(expression).getValue(context, Boolean.class); | ||
| return result != null && result; | ||
| } catch (SpelEvaluationException e) { | ||
| if (e.getCause() instanceof BaseException failure |
There was a problem hiding this comment.
[AI Assisted] Why unwrap only UNAVAILABLE? If the authorizer throws any BaseException, surfacing its code seems better than leaking the SpEL wrapper as a 500. ResultFilter can stay narrow so unknown errors still filter out, but here the rule could be "unwrap any BaseException cause", which also removes the duplicated UNAVAILABLE check between the two classes. Happy to be told the narrow version is deliberate.
There was a problem hiding this comment.
yes, the narrow check is intentional. the OPA path reports failures as UNAVAILABLE. unwrapping other codes would change existing error responses too, so i'd keep that broader change separate.
|
|
||
| An explicit `false` follows UC's normal deny or list-filter behavior. Transport errors, timeouts, | ||
| HTTP errors, and missing or invalid decisions fail the UC request with HTTP 503. UC never falls | ||
| back to native grants. Decisions are not cached. The response timeout applies to each OPA call; |
There was a problem hiding this comment.
[AI Assisted] Not a blocker, but let's follow up. With OPA, list filtering makes one HTTP call per item per privilege, sequentially, all under Armeria's request timeout. "Can require several calls" undersells that for a schema with hundreds of tables. This is #2077's design, but this PR makes it selectable, so a tracking issue for batching decisions (or at least a sentence on how list cost scales) would help. Related to @shba24's timeout thread.
There was a problem hiding this comment.
added an explicit note that large lists can still require calls for every item. #2105 already reuses shared-parent decisions within a list, but item-specific checks still make separate OPA calls. batching those calls would be separate work.
|
|
||
| @Test | ||
| public void opaRequiresAUrlAndReleasesNativeAuthorizerOnClose() { | ||
| ServerProperties properties = new ServerProperties(serverProperties); |
There was a problem hiding this comment.
[AI Assisted] nit: the Hikari active-connection count is the only such assertion in the suite. If the intent is "closing the OPA authorizer releases the native one", a spy on JCasbinAuthorizer.close() says that directly without coupling to the Casbin adapter holding exactly one connection.
There was a problem hiding this comment.
i kept the connection assertion because it verifies that shutdown returns the connection to the pool while leaving the shared session factory open. a close() spy could pass even if the connection leaked.
9de9e92 to
b576ab1
Compare
|
/review |
shba24
left a comment
There was a problem hiding this comment.
Thanks Tim, this looks good to me. Nothing here blocks; the two nits are optional, feel free to take or skip.
I reviewed 7e80047 locally: the formatter check is clean, and the 6 touched test classes pass (121 tests, including the Docker-backed SdkOpaAccessControlTest against a real OPA server). The cancellation in 7e80047 also covers my earlier point about one UC request making several OPA calls in a row.
Nit (not a blocker): PR description. The description doesn't mention that pending OPA calls are cancelled when the UC request is cancelled or times out. docs/server/auth.md already says it, so this is only for reviewers reading the description. How about adding a sentence like this after the first paragraph?
Pending OPA calls are cancelled when the UC request is cancelled or times out.
| ctx -> { | ||
| ServiceRequestContext root = ctx.root(); | ||
| if (root != null) { | ||
| root.whenRequestCancelling().thenAccept(ctx::cancel); |
There was a problem hiding this comment.
Nit (not a blocker): in Armeria 1.41.1, whenRequestCancelling() never completes for a request that succeeds. Its Javadoc says: "If the request is handled successfully without cancellation, the CompletableFuture won't complete." So each OPA call's thenAccept stage, and the client context it captures, stays attached to the root context until the UC request ends. That's bounded by the request (list pages cap at 100 and decisions are cached per request), so I think it's fine as is. I mention it only in case lists get bigger later.
7e80047 to
d7d2cd0
Compare
|
/review |
1 similar comment
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] Thanks for working through the first round. The validation move, the dedicated URL validator, and the cancellation on UC request timeout all look good. On the Hikari assertion: fair argument, a close() spy could pass with a leaked connection, so it stays as is.
One scope note: this PR now also changes list behavior for Casbin users (5xx during list filtering fails the request instead of dropping items). The description mentions it, but can you call it out as its own behavior-change line? The Validation line also lists only ResultFilterTest (2 tests), while the PR touches ServerPropertiesTest, UnityCatalogServerTest, OpaAuthorizerTest, UnityAccessEvaluatorTest, IcebergRestCatalogServiceTest and SdkOpaAccessControlTest. Please list what was actually run.
| } | ||
| return !authorized; | ||
| } catch (Exception e) { | ||
| if (e instanceof BaseException failure |
There was a problem hiding this comment.
[AI Assisted] Can we flip this to an allow-list? Filter out only explicit denials and 4xx BaseExceptions, and rethrow everything else.
Today a raw runtime exception still gets filtered. TransactionManager rethrows session-open and begin-transaction failures unwrapped (e.g. pool exhaustion), and KeyMapper hits that path while resolving list items, so the item is dropped and the list returns 200. The docs and description say 5xx during list authorization or resource resolution fails the whole request, which isn't true for these. listFilteringKeepsOtherFailuresAsDenials with IllegalStateException currently locks that in; it would flip to "propagates".
There was a problem hiding this comment.
changed the catch to filter only denials and 4xx UC errors, including those wrapped by SpEL. other failures now fail the request; unexpected exceptions get a generic INTERNAL response so database details aren’t exposed. extended the existing regression tests.
| ``` | ||
|
|
||
| For both Casbin and OPA, server errors (HTTP 5xx) during list authorization or resource | ||
| resolution fail the whole request. Previously, affected items could be silently omitted |
There was a problem hiding this comment.
[AI Assisted] nit: "Previously, ..." is time-relative and will go stale; just state the current behavior. Also this paragraph sits in the middle of the identity-provider setup steps. Can it get its own short heading, or move next to the authorization behavior it describes?
There was a problem hiding this comment.
removed “Previously…” and put the paragraph under a “List authorization” heading. it now states the current behavior for both backends.
0e76989 to
d1e4b10
Compare
Use Armeria's cancellation signal to stop OPA HTTP calls when the UC request times out or is cancelled. Verify that later privilege checks send no further OPA requests. Signed-off-by: Timothy Wang <[email protected]>
Release completed client contexts from UC cancellation callbacks. Preserve UC metadata failures and propagate authorization server errors through list filtering. Signed-off-by: Timothy Wang <[email protected]>
Add a regression test for server errors while resolving model parents during list filtering. Clarify that error propagation applies to both Casbin and OPA. Signed-off-by: Timothy Wang <[email protected]>
Filter out explicit denials and UC client errors, including client errors wrapped by expression evaluation. Preserve server error codes and report unexpected failures as INTERNAL with a safe message instead of returning an incomplete list. Extend the existing regression tests and clarify list behavior for both Casbin and OPA. Validation: javafmtAll and 155 selected server tests passed, including four tests against a real OPA server. None skipped. Signed-off-by: Timothy Wang <[email protected]>
d1e4b10 to
ca9f7e3
Compare
Preserve explicit HTTP and invalid-decision errors from OPA while keeping authorization failures as UNAVAILABLE. Update existing tests and clarify the Casbin refresh setting and local example policy. Validation: javafmtAll and all 34 OpaAuthorizerTest and SdkOpaAccessControlTest cases passed, including four tests against OPA in Docker. None skipped. Signed-off-by: Timothy Wang <[email protected]>
|
fixed both in 66c0dc9. explicit OPA errors now keep their specific messages and still return 503. connection failures keep the generic message. also clarified that policy refresh applies only to Casbin. all 34 tests passed, including four against real OPA. |
|
/review |
Signed-off-by: Timothy Wang <[email protected]>
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] The validation line in the PR description still says 155 tests and lists ErrorCodeTest, which was removed earlier. Please update it to the run on this head.
| return result != null && result; | ||
| } catch (SpelEvaluationException e) { | ||
| if (e.getCause() instanceof BaseException failure | ||
| && failure.getErrorCode().getHttpStatus().isServerError()) { |
There was a problem hiding this comment.
[AI Assisted] The evaluator still unwraps every 5xx BaseException, not only UNAVAILABLE. That also changes single #authorize checks for Casbin, and the description does not mention it. No Casbin path throws a 5xx inside SpEL today, and list behavior is already handled in ResultFilter, so narrowing this back to UNAVAILABLE looks sufficient. If you keep the broader rule, please add a line to the description.
There was a problem hiding this comment.
added a line to the description clarifying that this also applies to single authorization checks for both Casbin and OPA.
| @@ -157,6 +158,14 @@ public <T> void filter(SecurableType securableType, List<T> items, UnaryOperator | |||
| iterator.set(result); | |||
| } | |||
| } catch (Exception e) { | |||
There was a problem hiding this comment.
[AI Assisted] Optional future-proofing, since the list path is covered today: this catch rethrows any 5xx BaseException unchanged, so the model-only masking in resolveResourceIdsForItem depends on each source sanitizing its own message. Would it work to mask INTERNAL here once for all list paths, and keep the specific UNAVAILABLE messages from OPA? That would also let us drop the per-call rewrap.
There was a problem hiding this comment.
i’d leave the broader masking for a follow-up. the current metadata lookup failure is already masked and tested, so i’m keeping the existing handling here.
|
The latest AI review found no blockers or "should fix" issues. To keep this PR tightly scoped, I am deferring the following suggestions:
All 95 tests are passing, including the four integration tests against live OPA. |
|
updated the validation line to the run on |
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] Before approval, three items:
(a) Please update the validation line to a run on dc45fb6c that includes UnityCatalogServerTest, ServerPropertiesTest and IcebergRestCatalogServiceTest, which this PR changes. The current line cites 590820de and omits them.
(b) Please open a tracking issue for the broader ResultFilter masking follow-up (masking 5xx errors in the outer catch for all list paths) and link it here.
(c) The "Native permission APIs" paragraph in docs/server/auth.md lists OWNER and READ_METADATA, but PermissionService also accepts MANAGE for the grant-inspection check. Please name MANAGE there too.
Signed-off-by: Timothy Wang <[email protected]>
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] Thanks for the follow-up. The earlier items are resolved: the validation run covers the three test classes, the masking follow-up is tracked in #2177, and MANAGE is named in the docs.
Non-blocking follow-ups:
- The validation line still cites
6fb1cf5d1, not the merge head3564725e. Please refresh the SHA. AGENTS.md, the intro ofdocs/server/auth.md, anddocs/server/helm.mdstill describe authorization orpolicy-refreshas Casbin-only. Please add the OPA wording.
…onFolder` - unitycatalog#2078 added three server builds in `opaCannotRunWithAuthorizationDisabled` and `opaRequiresAUrlAndReleasesNativeAuthorizerOnClose` without one - Those servers wrote their signing keys, `certs.json` and `token.txt` into `etc/conf`, failing `check_etc_conf.sh` Co-authored-by: Isaac <[email protected]> Signed-off-by: Yi Li <[email protected]>
…onFolder` - unitycatalog#2078 added three server builds in `opaCannotRunWithAuthorizationDisabled` and `opaRequiresAUrlAndReleasesNativeAuthorizerOnClose` without one - Those servers wrote their signing keys, `certs.json` and `token.txt` into `etc/conf`, failing `check_etc_conf.sh` Co-authored-by: Isaac <[email protected]> Signed-off-by: Yi Li <[email protected]>
…onFolder` - unitycatalog#2078 added three server builds in `opaCannotRunWithAuthorizationDisabled` and `opaRequiresAUrlAndReleasesNativeAuthorizerOnClose` without one - Those servers wrote their signing keys, `certs.json` and `token.txt` into `etc/conf`, failing `check_etc_conf.sh` Co-authored-by: Isaac <[email protected]> Signed-off-by: Yi Li <[email protected]>
…onFolder` - unitycatalog#2078 added three server builds in `opaCannotRunWithAuthorizationDisabled` and `opaRequiresAUrlAndReleasesNativeAuthorizerOnClose` without one - Those servers wrote their signing keys, `certs.json` and `token.txt` into `etc/conf`, failing `check_etc_conf.sh` Co-authored-by: Isaac <[email protected]> Signed-off-by: Yi Li <[email protected]>
…onFolder` - unitycatalog#2078 added three server builds in `opaCannotRunWithAuthorizationDisabled` and `opaRequiresAUrlAndReleasesNativeAuthorizerOnClose` without one - Those servers wrote their signing keys, `certs.json` and `token.txt` into `etc/conf`, failing `check_etc_conf.sh` Co-authored-by: Isaac <[email protected]> Signed-off-by: Yi Li <[email protected]>
…2167) ## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2167/files) to review incremental changes. - [stack/run_test_followups](#2167) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2167/files)] --------- - Stop `BaseCredRenewITTest` from starting two servers per test - Its own `@BeforeEach beforeEach()` called `super.setUp()` after JUnit had already run the inherited `setUp()`, and the first server was never closed - Override `setUp()` instead - `BaseServerTest.setUp()` now fails if a server is already running, so the pattern cannot return silently; `UnityCatalogServerTest` checks that - Drop `REPLACE_EXISTING` from the signing-key copy, which only tolerated the second call - Fail CI when tests write to `etc/conf` - A server built without its own `configurationFolder` writes its signing keys, `certs.json` and `token.txt` there; two tests added on `main` while #2159 was open did exactly that - `project/scripts/check_etc_conf.sh` fails if any `etc/conf` differs from the checkout: a new file, ignored or not, or an edited or deleted tracked one - `run-uc-unit-tests` runs it after the tests, next to the clean-checkout step from #2334, which skips ignored files such as the generated keys; `upgrade-tests.yml` runs it after the upgrade tests - A fresh CI checkout has only tracked files there, so a local server cannot cause a false failure - Give `migrate/TestServer`, used by `RealUpgradeTest` and `SchemaGateTest`, its own `configurationFolder` - Give the three server builds in the OPA tests of `UnityCatalogServerTest` (#2078) their own `configurationFolder`; CI failed this check on them - `project/tests/test_check_etc_conf.py`, run in the "Build Test" job, checks the script in a throwaway git repository, including a deleted tracked file - `dev/run-tests.py` watches every `etc/conf` locally, at the root and in modules up to two levels deep, including hidden files and subdirectories; `test_run_tests.py` checks it Tested with `dev/run-tests.py` on `main` at #2357: 240 suites, 3971 tests, 0 failures; afterwards the checkout was clean and `check_etc_conf.sh` found nothing. `RealUpgradeTest.upgradesAndKeepsTheData` passed with `UC_TEST_UPGRADES=true`. With the old `beforeEach()` pattern restored, every `AwsCredRenewITTest` test fails with the new `setUp()` message. The test timeout changes that were here moved to #2330. Signed-off-by: Yi Li <[email protected]> **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** <!-- Please state what you've changed and how it might affect the users. --> This pull request and its description were written by Isaac. --------- Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
🥞 Stacked PR
Use this link to review incremental changes.
Signed-off-by: Timothy Wang [email protected]
PR Checklist
docsis updatedDescription of changes
Make OPA selectable with
server.authorization.provider=opa, a decision URL, and a response timeout for each OPA call. Casbin remains the default. Startup rejects OPA with authorization disabled or a missing/invalid decision URL.Pending OPA calls are cancelled when the UC request is cancelled or times out.
OPA failures now reach callers as HTTP 503 through UC, Iceberg, and Delta error handling. UC database failures keep their UC error codes.
Single authorization checks also preserve UC server error codes (HTTP 5xx) for both Casbin and OPA.
Behavior change for both Casbin and OPA: unexpected errors during list authorization or resource resolution fail the whole request instead of silently omitting affected items. Permission denials and client errors (HTTP 4xx) still filter out individual items.
Add configuration documentation and a runnable Rego example. Native grant/revoke/list APIs continue to manage native records; those grants do not affect OPA decisions. UC still enforces local path and staging-creator checks.
Follow-up: #2177 tracks consistent masking of internal errors in the outer list-filter catch.
Validation:
build/sbt javafmtAll.server/testOnlyforUnityCatalogServerTest,ServerPropertiesTest,IcebergRestCatalogServiceTest,ResultFilterTest,UnityAccessEvaluatorTest,OpaAuthorizerTest, andSdkOpaAccessControlTeston6fb1cf5d1: 138 tests passed, none skipped. All fourSdkOpaAccessControlTestcases ran against OPA in Docker.