Skip to content

[Server] Reject privilege grants on invalid object types - #2014

Merged
yili-db merged 1 commit into
unitycatalog:mainfrom
timothyw553:fix/permission-grant-validation
Oct 23, 2026
Merged

yili-db merged 1 commit into
unitycatalog:mainfrom
timothyw553:fix/permission-grant-validation

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

Reject grants on the wrong object type, such as USE CATALOG on a schema. Check all additions before saving any changes. Old invalid grants can still be revoked.

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

Tests: 20 focused tests and formatting passed. API docs regenerated.

@timothyw553
timothyw553 force-pushed the fix/permission-grant-validation branch from b1e7cb4 to 4b91e54 Compare October 19, 2026 18:48
@timothyw553
timothyw553 force-pushed the fix/permission-grant-validation branch 7 times, most recently from 6fecf71 to c6a5d3b 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/permission-grant-validation branch from c6a5d3b to 82edaf5 Compare October 22, 2026 02:07
@yili-db

yili-db commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

/review

@timothyw553
timothyw553 force-pushed the fix/permission-grant-validation branch 2 times, most recently from 896a437 to 5951bf4 Compare October 22, 2026 18:26
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

Comment thread api/all.yaml Outdated
summary: Update a permission
description: |
Updates the permissions for a securable.
When server.authorization.strict-privilege-checks is true (the default), each added

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 you remove this temp section here? This behavior changing flag is a implementation details of the server, not part of the protocol itself.

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, removed it from the spec. keeping the flag details in the server docs.

Comment thread api/all.yaml Outdated
schema:
$ref: '#/components/schemas/PermissionsList'
'400':
description: With strict privilege checks enabled, an added privilege does not apply to the securable type.

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.

It doesn't need to mention the strict privilege checks. And any invalid input can trigger it, rather than just added privilege does not apply to the securable type.
It's also optional. Most endpoints in this file don't repeat the common error cases, like "400 for invalid input".

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.

yep, removed the 400 entry too.

@timothyw553
timothyw553 force-pushed the fix/permission-grant-validation branch from 5951bf4 to 4fab7c4 Compare October 23, 2026 18:45
@timothyw553
timothyw553 requested a review from yili-db October 23, 2026 19:09
@yili-db
yili-db merged commit 8dfad7a into unitycatalog:main Oct 23, 2026
17 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