Skip to content

[Server] Remove MODIFY from table metadata checks - #2016

Merged
yili-db merged 7 commits into
unitycatalog:mainfrom
timothyw553:fix/table-details-permissions
Oct 28, 2026
Merged

yili-db merged 7 commits into
unitycatalog:mainfrom
timothyw553:fix/table-details-permissions

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

MODIFY currently allows table details and listings without SELECT. Stop accepting it as a substitute for SELECT in GET_TABLE. Use the same rule for UC table listings.

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

Tests: 24 focused tests and formatting passed.

@timothyw553
timothyw553 force-pushed the fix/table-details-permissions branch from 31176eb to 00b06ec Compare October 19, 2026 18:57
@timothyw553
timothyw553 force-pushed the fix/table-details-permissions branch 7 times, most recently from fc61c32 to 6c897e0 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/table-details-permissions branch 3 times, most recently from 1b1d3bd to 2592c25 Compare October 22, 2026 18:26
@yili-db

yili-db commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

/review

@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] The direction looks right: GET_TABLE was the only table read rule that accepted MODIFY without SELECT, and pointing listTables at the shared constant removes a copy that could drift. A few comments inline.

Two smaller things, not blocking:

  • No test checks that a MODIFY-only user is denied on Delta loadTable and tableExists in strict mode. SdkTableAccessControlCRUDTest already grants REGULAR_1 MODIFY next to its Delta section, so it would be one line there.
  • Can the description say why this breaks no one? Writes already need SELECT + MODIFY, so a MODIFY-only grant had no write use.

Comment thread docs/server/auth.md Outdated

Set `server.authorization.strict-privilege-checks=false` to restore the previous metadata rules.
With both usage permissions, `MODIFY` without `SELECT` again permits table details and listings.
This also restores its previous access to Iceberg `loadTable`, `tableExists`, and `loadCredentials`.

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] This overlaps with #2015, which moves Iceberg loadTable and loadCredentials off GET_TABLE onto their own rule. Both PRs also edit the GET_TABLE Javadoc, UnityAccessEvaluatorTest, and the Iceberg section of SdkIcebergRestCatalogAccessControlTest. If #2015 lands first, this sentence, the loadCredentials denial on tbl_mod, and the Iceberg assertions in SdkTableMetadataMigrationTest need rebasing onto the new rule. Can you note the overlap in the description so whoever rebases knows what to fix?

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.

yes, rebased it.

@@ -24,8 +24,8 @@ private AuthorizeExpressions() {}
* Authorization policy for reading table metadata (UC REST {@code GET /tables/{name}}, UC Delta

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] This list is partial: GET_TABLE now also gates UC listTables and Iceberg tableExists, loadCredentials, loadView, reportMetrics and listTables, plus the per-table listing filters. Someone changing the expression later wouldn't know it changes what listings show. Can we say "every table read endpoint and the per-table listing filter" instead of naming endpoints? Same for the endpoint list in the auth.md section.

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. changed to talk about metadata reads and listing too -- also made it shorter :-)

#authorize(#principal, #schema, USE_SCHEMA) &&
#authorizeAny(#principal, #table, OWNER, SELECT, MODIFY))
(#authorizeAny(#principal, #table, OWNER, SELECT) ||
(!#strict_privilege_checks && #authorize(#principal, #table, MODIFY))))

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] The description says this clause and the fallback-mode test go away after migration. Can we have a tracking issue and a TODO(#issue) here and on SdkTableMetadataMigrationTest? #2014, #2015, #2017 and #2018 each add a similar temporary test class, so listing them all in that issue, or using one naming scheme ("Migration" or "Legacy"), would make the cleanup one pass.

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.

added TODO(#2024) here and on SdkTableMetadataMigrationTest

assertThat(
new UnityAccessEvaluator(authorizer, strictPrivilegeChecks)
.evaluate(principal, AuthorizeExpressions.GET_TABLE, resources, Map.of()))
.isEqualTo(expected || (!strictPrivilegeChecks && useCatalog && useSchema && modify));

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] For strict=false this expected value is the production clause rewritten, so a bug in the clause would be mirrored here. Can we add an explicit expectedWhenNotStrict column? Adding .as("strict=%s", strictPrivilegeChecks) would also make a failure say which mode broke.

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. now cases gives the expected result for both modes. failures show the mode, owner and grants.

@timothyw553
timothyw553 force-pushed the fix/table-details-permissions branch from 2592c25 to db7fc52 Compare October 23, 2026 18:46
@yili-db

yili-db commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

/review


class UnityAccessEvaluatorTest {

@ParameterizedTest

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] Can we make this a plain @Test that calls a helper, like NormalizedURLTest does? Passing the grants as a set reads better than six positional CSV columns, and spelling out the result for each mode removes the expected || (!strict && ...) formula, which copies the production rule. For example:

@Test
void getTableRequiresSelectOrAnOwnerRule() throws Exception {
  assertGetTable(/* owned= */ null, Set.of(), /* strict= */ false, /* legacy= */ false);
  assertGetTable(null, Set.of(USE_CATALOG, USE_SCHEMA, SELECT), true, true);
  // MODIFY without SELECT passes only with strict checks off.
  assertGetTable(null, Set.of(USE_CATALOG, USE_SCHEMA, MODIFY), false, true);
  assertGetTable(null, Set.of(USE_SCHEMA, SELECT, MODIFY), false, false);
  assertGetTable(METASTORE, Set.of(), true, true);
  assertGetTable(CATALOG, Set.of(), true, true);
  assertGetTable(SCHEMA, Set.of(USE_CATALOG), true, true);
  assertGetTable(SCHEMA, Set.of(USE_SCHEMA, SELECT, MODIFY), false, false);
  assertGetTable(TABLE, Set.of(USE_CATALOG, USE_SCHEMA), true, true);
  assertGetTable(TABLE, Set.of(USE_SCHEMA), false, false);
  ...
}

assertGetTable(owned, grants, expectedStrict, expectedLegacy) would hold the mock setup and evaluate GET_TABLE once per mode.

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, switched to a plain @test with the helper and named grants

@yili-db

yili-db commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Please rebase

@timothyw553
timothyw553 force-pushed the fix/table-details-permissions branch from ccddd3f to f38bbf5 Compare October 27, 2026 18:39
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@timothyw553

Copy link
Copy Markdown
Collaborator Author

i didn't find the nits in the ai review pressing.

Comment thread docs/server/auth.md
Existing invalid grants can still be removed.
- [Iceberg credentials](#table-credential-permissions): returning credentials from `loadTable`
or `loadCredentials` requires `USE CATALOG`, `USE SCHEMA`, and `SELECT`, or ownership at each level.
- Table metadata: `MODIFY` no longer substitutes for `SELECT` for table details, listings,

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] This now conflicts with the end of the "Table credential permissions" section (line 445): "Table listings and tableExists keep their existing permission checks." That sentence came from #2015, and this PR changes both. Can we update it, e.g. "Table listings and tableExists use the table metadata rule, so MODIFY alone does not qualify."?

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.

updated it -- removed below

@yili-db
yili-db merged commit 5e4e3d7 into unitycatalog:main Oct 28, 2026
18 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.

2 participants