Skip to content

[Server] Check read access before returning Iceberg credentials - #2015

Merged
yili-db merged 6 commits into
unitycatalog:mainfrom
timothyw553:fix/iceberg-credential-authorization
Oct 27, 2026
Merged

yili-db merged 6 commits into
unitycatalog:mainfrom
timothyw553:fix/iceberg-credential-authorization

Conversation

@timothyw553

@timothyw553 timothyw553 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

PR Checklist

  • 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.
  • 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

Iceberg loadTable and loadCredentials return credentials but use the metadata permission check. Require the same read access as UC and Delta credentials.

loadTable keeps returning metadata to callers who pass GET_TABLE. It includes credentials and their refresh endpoint only when the read check passes. loadCredentials returns 403 without read access.

server.authorization.strict-privilege-checks=false keeps the old behavior.

Tests: 63 focused tests and formatting passed.

Follow-up: #2024.

#authorizeAny(#principal, #catalog, OWNER, USE_CATALOG) &&
#authorizeAny(#principal, #schema, OWNER, USE_SCHEMA) &&
#authorizeAny(#principal, #table, OWNER, SELECT)
""";

@timothyw553 timothyw553 Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recall the rule is: Read credentials vending requires all three checks:

Object What the caller needs
Catalog USE CATALOG or ownership of that catalog
Schema USE SCHEMA or ownership of that schema
Table SELECT or ownership of that table

Owning the catalog does not satisfy the schema or table checks. Being a metastore admin does not give automatic read access. MODIFY does not include SELECT.

@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch 2 times, most recently from 6fa1182 to 6ebc0c6 Compare October 20, 2026 00:34
@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch 4 times, most recently from be893b9 to 9cdef5e Compare October 20, 2026 22:22
Comment thread docs/server/auth.md Outdated
setting apply the corrected rules by default.
`server.authorization.strict-privilege-checks` defaults to `true`. With this setting enabled:

- [Iceberg credentials](#table-credential-permissions): Require catalog usage, schema usage,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we list the required grants here explicitly? The bullet says "catalog usage, schema usage, and table read access", but the grants are USE CATALOG, USE SCHEMA and SELECT, or ownership at each level. The table further down has them, so the bullet could name them inline, for example: "Iceberg credentials: loadTable and loadCredentials require USE CATALOG, USE SCHEMA and SELECT (or ownership at each level)."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, i'll name USE CATALOG, USE SCHEMA, and SELECT directly, with ownership as an alternative at each level.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the bullet works for me. The Iceberg rules are spelled out under "Table credential permissions", so this section can stay general. Fine as is.

Comment on lines +28 to +30
* <p>Metastore admin and catalog owner pass unconditionally; schema owner passes with catalog
* {@code USE_CATALOG}; regular callers need {@code USE_SCHEMA} + {@code USE_CATALOG} plus any of
* {@code OWNER} / {@code SELECT} / {@code MODIFY} on the table itself.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we explain this here? GET_TABLE is a general table-read rule, so a detailed explanation of the rule and of which Iceberg endpoints use it is more than this javadoc needs. Could we keep the original wording and put the Iceberg detail on VEND_ICEBERG_TABLE_CREDENTIAL, which already describes the Iceberg rule?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, i'll keep GET_TABLE general and move the Iceberg details to the credential rule.

@shba24 shba24 Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (not a blocker): this is still the endpoint list at d30bc37, and it leaves out Iceberg loadView and reportMetrics. One more reason to keep it general: GET_TABLE is now also the legacy branch of VEND_ICEBERG_TABLE_CREDENTIAL, so an edit here also changes legacy Iceberg credential access. Would something like this work?

/**
 * Authorization policy for reading table metadata. Metastore admin and catalog owner pass
 * unconditionally; schema owner passes with catalog {@code USE_CATALOG}; regular callers need
 * {@code USE_SCHEMA} + {@code USE_CATALOG} plus any of {@code OWNER} / {@code SELECT} / {@code
 * MODIFY} on the table itself.
 *
 * <p>Also the legacy branch of {@link #VEND_ICEBERG_TABLE_CREDENTIAL}, so a change here also
 * changes Iceberg credential access while strict privilege checks are off.
 */

Comment on lines +26 to +42
@CsvSource({
"false, false, false, false",
"false, false, false, true",
"false, false, true, false",
"false, false, true, true",
"false, true, false, false",
"false, true, false, true",
"false, true, true, false",
"false, true, true, true",
"true, false, false, false",
"true, false, false, true",
"true, false, true, false",
"true, false, true, true",
"true, true, false, false",
"true, true, false, true",
"true, true, true, false",
"true, true, true, true"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 16-row table is easy to get wrong when edited: one flipped value or a missing row changes the coverage and no test fails. Can we generate the combinations instead, for example by looping over the bits 0..15 or with a @MethodSource, so every case is present by construction?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fair point. i'll use four nested boolean loops with @MethodSource to generate all 16 combinations.

@shba24 shba24 Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (not a blocker): it's still @CsvSource at d30bc37. Your nested loops would work well. Here's another option that keeps all 16 cases by construction:

static Stream<Arguments> accessCombinations() {
  return IntStream.range(0, 16)
      .mapToObj(i -> Arguments.of((i & 8) != 0, (i & 4) != 0, (i & 2) != 0, (i & 1) != 0));
}

@ParameterizedTest
@MethodSource("accessCombinations")
void tableCredentialsRequireUsageAndDataAccess(
    boolean catalogUsage, boolean schemaUsage, boolean tableRead, boolean tableWrite)

"true, true, true, false",
"true, true, true, true"
})
void tableCredentialsRequireUsageAndDataAccess(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected values come from a hand-written formula (catalogUsage && schemaUsage && tableRead), not from the real expressions. If VEND_ICEBERG_TABLE_CREDENTIAL and VEND_TABLE_CREDENTIAL drift apart, nothing in this test shows it.

The strict branch is a copy of the READ branch of VEND_TABLE_CREDENTIAL (see the TODO). Can we assert against the actual expressions instead? Strict: VEND_ICEBERG_TABLE_CREDENTIAL equals VEND_TABLE_CREDENTIAL with READ. Non-strict: it equals GET_TABLE. The non-strict formula catalogUsage && schemaUsage && (tableRead || tableWrite) also skips the owner paths of GET_TABLE, which this test never stubs, so it is only an approximation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both real expressions are already checked against the same expected READ result, so a difference in these cases would fail. the legacy branch uses GET_TABLE directly, and the HTTP tests cover ownership. i'd keep the independent expectations.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Both real expressions are checked against the same canRead with the same stubs, so a difference between them would fail the test. Thanks for explaining. No change needed.

import org.apache.iceberg.types.Types;
import org.junit.jupiter.api.Test;

public class SdkIcebergCredentialMigrationTest extends SdkAccessControlBaseCRUDTest {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: it would help to show that this is a two-way door. This test starts a fresh server with the flag set to false, and the strict behavior is tested in a different class. One option is to check the same grants and tables under both values: strict denies (the admin and the MODIFY-only user on loadTable and loadCredentials), then false allows, then true denies again.

The flag is read at startup, so this could start a second server on the same database with the other value, if the test harness supports that. Otherwise, running the same scenario under both values would work. Either way it shows that flipping the setting changes only the rules and leaves no state behind.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd keep the current tests here. the flag selects the rule at startup and doesn't change stored grants. both modes already have HTTP coverage.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. The flag only picks the rule at startup and stores nothing, and both modes have HTTP coverage. Fine as is.

@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch 2 times, most recently from 4b8ce4c to 1e627b2 Compare October 21, 2026 19:33
yili-db pushed a commit that referenced this pull request Oct 22, 2026
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2023/files) to
review incremental changes.
-
[**feat/strict-privilege-checks**](#2023)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2023/files)]
← _this PR_
-
[fix/iceberg-credential-authorization](#2015)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2015/files/d63e70154a6f21c4d23d596491c779b66a250367..1e627b250bb34d8df390f050d8307fd5442dddc6)]
-
[fix/model-rename-permissions](#2018)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2018/files/d63e70154a6f21c4d23d596491c779b66a250367..49d68ec662b2f29c588c8f5d67ec74cfc3fe017f)]
-
[fix/permission-grant-validation](#2014)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2014/files/d63e70154a6f21c4d23d596491c779b66a250367..c6a5d3bf21127e62fc81b2b291ea54bb56463b55)]
-
[fix/table-details-permissions](#2016)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2016/files/d63e70154a6f21c4d23d596491c779b66a250367..6c897e034918a99ea3a2c4bdbeac64905c8f9d93)]
-
[fix/volume-rename-permissions](#2017)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2017/files/d63e70154a6f21c4d23d596491c779b66a250367..0ad5aee5216d2ed8085e969c287cc7dee7cdfa98)]

---------
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] 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!
- [x] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Add `server.authorization.strict-privilege-checks`, which defaults to
`true`.
The following permission fixes use this setting so deployments can keep
the previous rules
temporarily while updating their applications and grants. Setting it to
`false` retains the
previous behavior, including access that the corrected checks would
deny.

This PR adds the validated setting and passes it to authorization
expressions as the trusted
`#strict_privilege_checks` variable. Request values cannot change it.
The setting also reaches
response filtering through the shared evaluator. This base PR does not
change permission decisions.

Use the same value on every server instance and restart each instance
after changing it.
The fallback conditions and the setting can be deleted after the
migration.

Tests passed with JDK 17:

```sh
build/sbt javafmtAll "server/testOnly io.unitycatalog.server.utils.ServerPropertiesTest io.unitycatalog.server.UnityCatalogServerTest"
build/sbt "server/testOnly io.unitycatalog.server.auth.decorator.UnityAccessEvaluatorTest"
```

33 tests passed.

Combined validation with all five dependent fixes:
`build/sbt -J-Xmx2G javafmtAll "server/test"`: 923 tests passed.

Signed-off-by: Timothy Wang <[email protected]>
@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch from 1e627b2 to 6244e5c Compare October 22, 2026 02:07
@timothyw553
timothyw553 requested a review from shba24 October 22, 2026 02:34
@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch 2 times, most recently from d30bc37 to c47f002 Compare October 22, 2026 18:26

@shba24 shba24 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, Tim. I took another pass at d30bc37 and found no blockers. The strict rule matches the READ branch of VEND_TABLE_CREDENTIAL, the false mode falls back to GET_TABLE unchanged, and the tests would catch a regression, so this looks good to me. Everything below is a nit and not a blocker, so feel free to take or skip any of them.

Nit (not a blocker): IcebergRestCatalogService.java:906 is outside the diff, so I'm noting it here:

// Drop tables the caller can't read, per-table, matching loadTable and UC REST listTables.

With strict checks, listTables still filters with GET_TABLE, while loadTable now uses the read rule. So a metastore admin, a parent owner or a MODIFY-only user can see a table in the list that loadTable then rejects with 403. The docs already say that's intended, so only the comment is out of date now. Something like this would keep it accurate:

// Drop tables the caller can't see, per-table, using GET_TABLE like UC REST listTables.

The other nits are inline.

#authorizeAll(#principal, #table, SELECT, MODIFY)))
""";

/** Iceberg credential responses use the read rule, or the old metadata rule during migration. */

@shba24 shba24 Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (not a blocker): createTable and updateTable also return credential config, under CREATE_TABLE and UPDATE_ICEBERG_TABLE, so "Iceberg credential responses" reads a bit broader than this rule. How about naming the two endpoints and the flag?

/** Iceberg loadTable and loadCredentials: the read rule with strict checks, GET_TABLE otherwise. */

// ===== loadCredentials (GET_TABLE) -- same gate as loadTable; renews a table's vended creds
// =====
p1.loadCredentials(CAT, SCHEMA, "tbl_none"); // catalog OWNER
// ===== loadCredentials (VEND_TABLE_CREDENTIAL, READ) =====

@shba24 shba24 Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (not a blocker): this endpoint uses VEND_ICEBERG_TABLE_CREDENTIAL, not VEND_TABLE_CREDENTIAL, so someone grepping for either constant could be misled. Maybe:

// ===== loadCredentials (VEND_ICEBERG_TABLE_CREDENTIAL, strict) =====

Comment thread docs/server/auth.md Outdated

## Table credential permissions

With authorization enabled, Unity Catalog and Delta table credential requests require the

@shba24 shba24 Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (not a blocker): Delta staging-table credentials (GET /delta/v1/staging-tables/{table_id}/credentials, DeltaApiService.java:357) only check table OWNER, with no catalog or schema check. So "Unity Catalog and Delta table credential requests require the permissions below" is a little broader than the code. Scoping it to existing tables would fix that:

With authorization enabled, Unity Catalog and Delta table credential requests for existing tables require the permissions below.

@shba24 shba24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Tim. The remaining comments are nits, not blockers, so feel free to address them here or in a follow-up.

@yili-db

yili-db commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

/review

@Get("/v1/catalogs/{catalog}/namespaces/{namespace}/tables/{table}")
@ProducesJson
@AuthorizeExpression(AuthorizeExpressions.GET_TABLE)
@AuthorizeExpression(AuthorizeExpressions.VEND_ICEBERG_TABLE_CREDENTIAL)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] Should loadTable keep GET_TABLE and drop only the credentials when the caller lacks read access, instead of returning 403 for the whole request? I think this needs to change in this PR.

The fix only has to stop loadTable from vending credentials. Rejecting the metadata too is a separate, breaking behavior change. Strict checks are on by default, so on upgrade every metastore admin, catalog/schema owner, and MODIFY-only caller loses metadata-only loadTable over Iceberg REST (DESCRIBE, schema browsing, catalog sync). Those callers can still read the same metadata through UC REST getTable and Delta API loadTable, so the 403 doesn't protect anything. It just breaks Iceberg clients. It also makes Iceberg the only API that doesn't separate metadata from credentials: UC REST and Delta use GET_TABLE for metadata and VEND_TABLE_CREDENTIAL only on the credential endpoints.

This also matches the Iceberg REST model, where credentials are optional, and what Polaris does: LOAD_TABLE needs TABLE_READ_PROPERTIES, and only LOAD_TABLE_WITH_READ_DELEGATION needs TABLE_READ_DATA.

Suggested shape:

  • loadTable: keep @AuthorizeExpression(GET_TABLE). With strict checks, evaluate the read rule in the handler, much like getLoadCredentialPrivileges already does for READ_WRITE. If it fails, return the metadata without credential config and without the loadCredentials refresh endpoint, since a refresh would 403.
  • loadCredentials: keep VEND_ICEBERG_TABLE_CREDENTIAL as in this PR (403 without read access).
  • ETag: include whether credentials were vended. Otherwise a caller who first got a no-credentials response and is later granted SELECT keeps getting 304 with the cached response until the metadata changes.
  • Tests: assert metadata-only success (non-empty metadata, no credential config) for the admin, catalog owner, schema owner, and MODIFY-only cases that now assert 403.

A follow-up could return 403 when the client explicitly requests X-Iceberg-Access-Delegation: vended-credentials without read access, as Polaris does. That part could go on #2024.

cc @shba24

@timothyw553 timothyw553 Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair. loadTable now keeps GET_TABLE and omits credentials and the refresh endpoint when the read check fails. loadCredentials still returns 403. i also updated the ETag and tests.

i left the header alone. the spec allows metadata without credentials even when the client requests them.

@yili-db yili-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] A few smaller items, secondary to the loadTable comment above. If that one is adopted, some of these will move, so feel free to batch them.

Agreed in earlier threads but not in c47f002:

  • Docs bullet should name USE CATALOG, USE SCHEMA, and SELECT (#2015 (comment)).
  • GET_TABLE javadoc should stay general instead of listing endpoints (#2015 (comment)). The current list also leaves out Iceberg loadView and reportMetrics.
  • Generate the 16 combinations instead of a hand-written @CsvSource (#2015 (comment)).

Outside the diff:

  • AuthorizeExpressions class javadoc says endpoints for the same operation "must grant identical access". With the flag off, Iceberg and native credential access now differ on purpose. Can we add a line noting VEND_ICEBERG_TABLE_CREDENTIAL is a temporary exception, tracked in #2024?
  • The PR description says "No related issue", but the code now has TODO(#2024). Can we link #2024?

// ===== loadCredentials (GET_TABLE) -- same gate as loadTable; renews a table's vended creds
// =====
p1.loadCredentials(CAT, SCHEMA, "tbl_none"); // catalog OWNER
// ===== loadCredentials (VEND_TABLE_CREDENTIAL, READ) =====

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] nit: this endpoint now uses VEND_ICEBERG_TABLE_CREDENTIAL, not VEND_TABLE_CREDENTIAL, so someone grepping for either constant could be misled.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, corrected the comment to VEND_ICEBERG_TABLE_CREDENTIAL.

.thenReturn(tableRead && tableWrite);
when(authorizer.authorize(principal, catalog, Privileges.USE_CATALOG)).thenReturn(catalogUsage);
when(authorizer.authorize(principal, schema, Privileges.USE_SCHEMA)).thenReturn(schemaUsage);
when(authorizer.authorize(principal, table, Privileges.MODIFY)).thenReturn(tableWrite);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] nit: none of the three expressions calls authorize(principal, table, MODIFY), so this stub is dead. Can we drop it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd keep this for #2016. GET_TABLE uses the direct MODIFY check there.

Comment thread docs/server/auth.md Outdated

## Table credential permissions

With authorization enabled, Unity Catalog and Delta table credential requests require the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] nit: Delta staging-table credentials (GET /delta/v1/staging-tables/{table_id}/credentials) only check table OWNER, with no catalog or schema check, so this sentence is a bit broader than the code. Scoping it to existing tables would fix it, e.g. "Unity Catalog and Delta table credential requests for existing tables require the permissions below." (Same point shba24 raised earlier.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, scoped it to existing tables.

@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch from c47f002 to 067a4db Compare October 23, 2026 18:46
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

throw new NoSuchTableException("Table does not exist: %s", namespace + "." + table);
}
boolean refsOnly = refsOnly(snapshots);
boolean includeCredentials = canLoadCredentials(state.tableId());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be embedded into getLoadCredentialPrivileges.
Currently it returns READ_ONLY vs READ_WRITE. It can be changed to return NONE as well.
Then the read/write should also be made into part etag?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. reusing getLoadCredentialPrivileges now

UUID principalId = userRepository.findPrincipalId();
if (serverProperties.isAuthorizationEnabled()
&& serverProperties.isStrictPrivilegeChecksEnabled()
&& !accessEvaluator.evaluate(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not ideal pattern for (principal, object) authorization. this will be addressed in some future work.

@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch from 2985dbe to 13aebea Compare October 24, 2026 00:13
@yili-db

yili-db commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

/review

UUID principalId = userRepository.findPrincipalId();
if (serverProperties.isAuthorizationEnabled()
&& serverProperties.isStrictPrivilegeChecksEnabled()
&& !accessEvaluator.evaluate(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timothyw553 I think I told you earlier to use accessEvaluator.evaluate so that it can perfectly reuse VEND_TABLE_CREDENTIAL so that the source of truth is one place.
Sorry I wasn't aware of one thing: accessEvaluator.evaluate considers permission denied as uncommon and tries to refresh casbin permissions and retry before really deny the access. As the end result, each loadTable without READ permission could stall for up to a second if server.authorization.policy-refresh is on (or even longer if the refresh is slow).

To avoid that, I think here it can call authorizer.authorize directly like canWrite does below, and possibly reuse some value like isOwner.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, i can check if they can read without going through the cache refresh. but i'm just wondering why do we want to do this? the refresh mechanism exists for some reason (which i do not know when) -- why don't we want to use it here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if someone just granted read access on another server, your proposed possibly-stale check may need to wait for the regular background refresh to see that grant.

@yili-db yili-db Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concern is that it always stall for 1 second (or longer if it takes longer to refresh), each time it loadTable without the read access.
And if you see the following part of this function you can see the read v.s. write check still doesn't go with the cache refresh as they call authorizer.authorize directly anyway.

Use one permission check for no credentials, read-only credentials, and
read/write credentials. Include those permissions in the ETag so grants
change conditional loadTable responses.

Signed-off-by: Timothy Wang <[email protected]>
Check cached catalog, schema, and table permissions when deciding whether
to return Iceberg credentials. Add a regression assertion that a denied
check does not request a policy refresh.

Signed-off-by: Timothy Wang <[email protected]>
@timothyw553
timothyw553 force-pushed the fix/iceberg-credential-authorization branch from 3e5327a to 289ae94 Compare October 26, 2026 18:09
@yili-db

yili-db commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

/review

&& serverProperties.isStrictPrivilegeChecksEnabled()) {
Map<SecurableType, UUID> resourceIds =
keyMapper.mapResourceKeys(Map.of(TABLE, state.tableId().toString()));
boolean canRead =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] Nice, this looks great: in-memory checks only, and the never().refreshAuthorizations assertion keeps it that way. Thanks for turning it around so quickly!

One small suggestion: could we add a short comment here on why this doesn't go through UnityAccessEvaluator? Calling evaluate with VEND_TABLE_CREDENTIAL looks like the obvious cleanup (one of the AI reviewers suggested exactly that), and without the context someone might bring the refresh stall back. Something like:

// Use cached permissions directly, not UnityAccessEvaluator: a deny here is the normal
// metadata-only result, not a failed request, so it must not trigger a policy refresh.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@timothyw553
timothyw553 requested a review from yili-db October 27, 2026 03:57
@yili-db

yili-db commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db
yili-db merged commit 10100ac into unitycatalog:main Oct 27, 2026
19 checks passed
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.

3 participants