Skip to content

[Server] Add BROWSE permission - #2087

Merged
yili-db merged 14 commits into
unitycatalog:mainfrom
timothyw553:feat/browse-privilege
Nov 10, 2026
Merged

yili-db merged 14 commits into
unitycatalog:mainfrom
timothyw553:feat/browse-privilege

Conversation

@timothyw553

@timothyw553 timothyw553 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


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. (No related issue.)
  • 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

This PR lets users discover catalog objects before they have permission to use them. For example, Alice can inspect a sales table's owner and columns before requesting access to its rows.

A catalog BROWSE grant covers the catalog and its contents without USE CATALOG or USE SCHEMA. BROWSE on an external location covers only that location.

By default, get and list requests use only the usual read permissions. Add include_browse=true to also allow discovery through BROWSE.

The owner of main grants Alice BROWSE:

PATCH /api/2.1/unity-catalog/permissions/catalog/main
Content-Type: application/json

{
  "changes": [
    {
      "principal": "[email protected]",
      "add": ["BROWSE"],
      "remove": []
    }
  ]
}

Alice can then request the table's metadata:

GET /api/2.1/unity-catalog/tables/main.public.sales?include_browse=true

With the usual read permissions, Alice gets full metadata. With only BROWSE, this request returns discovery fields marked browse_only=true. With neither, a GET returns PERMISSION_DENIED and a list leaves the object out. Data access, credentials, and changes still require their existing permissions.

Discovery retains catalog and schema properties and storage paths, plus model and volume storage paths. It hides table storage details, function code, and external location credential references.

A shared response filter checks permissions, selects fields, and verifies object IDs. Single-object requests with include_browse false or missing keep the early permission check. Java callers must add includeBrowse and recompile. Pass false to keep existing behavior.

Validation: 67 focused H2 tests, formatting, and Checkstyle passed.

@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@timothyw553
timothyw553 force-pushed the feat/browse-privilege branch from 3216e41 to 2a4fc31 Compare October 29, 2026 23:37
@timothyw553 timothyw553 changed the title [Server] Add BROWSE permission [not human reviewed yet][Server] Add BROWSE permission Oct 29, 2026
@timothyw553
timothyw553 force-pushed the feat/browse-privilege branch 4 times, most recently from 9dafee8 to 8504f42 Compare October 31, 2026 21:56
@timothyw553 timothyw553 changed the title [not human reviewed yet][Server] Add BROWSE permission [Server] Add BROWSE permission Nov 3, 2026
@timothyw553
timothyw553 marked this pull request as ready for review November 3, 2026 07:01
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/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] Thanks for the follow-up commit; the external location descriptions, the auth-disabled test, and the unused VolumeRepository parameter all look good. A few remaining comments inline.

evaluator,
principal,
expression,
Boolean.parseBoolean(ctx.queryParam("include_browse"))

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 flag is parsed here from the raw query string, while every handler also declares @Param("include_browse") Optional<Boolean> includeBrowse and never reads it. Two places parsing the same flag can drift. It fails closed today, so this is not a correctness issue, but it is confusing for the next reader. Can we make the decorator the only reader and drop the unused handler params? If they are kept on purpose, a short comment saying why would help.

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.

kept the params so armeria rejects invalid values. added a comment explaining why. the decorator now uses armeria’s conversion too, with tests for 1 and invalid values.

}

/** Returns full or BROWSE-only metadata, or denies access to a GET result. */
protected <T> T applyResponseFilter(T item, UnaryOperator<T> browseOnly) {

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] With @ResponseAuthorizeFilter on the GET handlers, authorization for every GET (not only include_browse=true) now runs after the repository read instead of in the decorator before the handler. A denied caller still gets PERMISSION_DENIED, but the handler now does the full load for callers it will reject, and errors raised by the handler now come before the auth check. Can we call this out in the PR description? Alternatively, keep the request-time check when include_browse is not set and defer only for the BROWSE fallback.

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, added this to the pr description. it also applies when include_browse is false or omitted.

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] Thanks for documenting it, and the ID check is a good addition. I still think the ordering should be restored for callers who don't opt in: when include_browse is unset, can ResultFilterAction.beforeRequest evaluate the ordinary expression right away (the resource IDs are already resolved there) and only defer to filterResult for the BROWSE fallback? That keeps the enforcement boundary where it was for every existing caller. The bot's Blocker1 asks for the same thing.

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.

@yili-db fixed. ordinary GETs now check permissions before the handler runs when include_browse is false or unset. kept the returned object ID check and added a regression test to confirm the handler never runs for those denied requests.

@EnumSource(
value = TableType.class,
names = {"MANAGED", "EXTERNAL", "VIEW"})
void tableDiscoveryKeepsColumnFieldsAndOmitsStorageAndDefinitions(TableType tableType)

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 that the converter is an allowlist, so a new TableInfo or ColumnInfo field stays hidden by default. But this test builds its input from hand-written JSON, so adding a field to the spec still passes and nobody has to decide whether BROWSE callers should see it. Can we add a check that populates every model property and asserts the exact browse-visible field set? Then a new field fails the test until someone classifies it. Same for FunctionInfo, where input_params and return_params are copied as whole objects, so a new nested parameter field would show up in browse responses automatically.

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, extended the existing tests to cover every table, column, and function field, including nested parameters. new fields now fail the tests until we decide how browse should handle them.

yili-db pushed a commit that referenced this pull request Nov 3, 2026
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2091/files) to
review incremental changes.
-
[**stack/permission-enums**](#2091)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2091/files)]
← _this PR_
-
[stack/feat/browse-privilege](#2087)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2087/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..8504f42cac04ea8cac31e3b86807530ba0144057)]
-
[stack/feat/create-model-version-privilege](#2085)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2085/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..8575d777673066ca569002d40f6eab19631c936f)]
-
[stack/feat/manage-privilege](#2088)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2088/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..b41a2d34cfad7af957d8fd9ebd5446d0a42cd74b)]
-
[stack/feat/read-metadata-privilege](#2086)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2086/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..dd162f6987b22700fca3b18ac5105cc261e19e6a)]
-
[stack/feat/write-volume-privilege](#2084)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2084/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..7112a998365fc1d322bae3f26f6ba00d9fefc39e)]

---------
**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**

Add `BROWSE`, `MANAGE`, `WRITE VOLUME`, `CREATE MODEL VERSION`, and
`READ METADATA` to the API and server enums. Validate where each
permission can be granted. The child PRs add the authorization checks
for each permission.

**Before**

With authorization enabled, the owner of `main.public.sales` tries to
grant an existing user metadata access:

```http
PATCH /api/2.1/unity-catalog/permissions/table/main.public.sales
Content-Type: application/json

{"changes": [{"principal": "[email protected]", "add": ["READ METADATA"]}]}
```

The API rejects the request because `READ METADATA` is not a recognized
privilege.

**After**

The owner repeats the same request:

```http
PATCH /api/2.1/unity-catalog/permissions/table/main.public.sales
Content-Type: application/json

{"changes": [{"principal": "[email protected]", "add": ["READ METADATA"]}]}
```

The API accepts and saves the grant. It also accepts `BROWSE`, `MANAGE`,
`WRITE VOLUME`, and `CREATE MODEL VERSION` on their supported object
types. For example, `BROWSE` is valid on a catalog or external location
and is rejected on a table.

The child PRs add the authorization checks that make these grants affect
metadata reads, grant changes, and credential requests.

This is the shared parent for #2084, #2085, #2086, #2087, and #2088.

Validation: 21 focused enum and permission tests passed on JDK 17. API
generation, Java formatting, and server Compile/Test Checkstyle passed.

Signed-off-by: Timothy Wang <[email protected]>
@timothyw553
timothyw553 requested a review from yili-db November 4, 2026 10:00
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

1 similar comment
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@yili-db

yili-db commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

/review

@timothyw553
timothyw553 force-pushed the feat/browse-privilege branch from 804ec92 to df95074 Compare November 5, 2026 22:35
@yili-db

yili-db commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db

yili-db commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

[AI Assisted] Nice resolution of the ResultFilter merge; the separate browseBatch is exactly what #2105 needs, and the H2 suite is green on this head.

A few small things:

@timothyw553
timothyw553 force-pushed the feat/browse-privilege branch from df95074 to 265958b Compare November 6, 2026 05:00
Reject GET results when their ID differs from the ID resolved for authorization.

Signed-off-by: Timothy Wang <[email protected]>
Keep the next authorized item when a BROWSE permission check or projection fails.

Signed-off-by: Timothy Wang <[email protected]>
Move the UI type refresh to a follow-up PR. The UI does not use the new BROWSE fields yet.

Signed-off-by: Timothy Wang <[email protected]>
Keep SDK calls explicit and check BROWSE list permission reuse.
Update batching assertions for the READ METADATA rule.

Signed-off-by: Timothy Wang <[email protected]>
Reject denied single-object requests before the handler runs when BROWSE is
disabled. Keep response filtering and returned-object ID validation.

Signed-off-by: Timothy Wang <[email protected]>
@timothyw553
timothyw553 force-pushed the feat/browse-privilege branch from 265958b to 310318c Compare November 6, 2026 18:44
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@timothyw553

Copy link
Copy Markdown
Collaborator Author

@yili-db

yili-db commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

This needs @tdas approval for api/all.yaml

@yili-db

yili-db commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

/review

@tdas tdas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lgtm on API changes

@yili-db

yili-db commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db
yili-db merged commit a9c956e into unitycatalog:main Nov 10, 2026
21 of 22 checks passed
murali-db pushed a commit to delta-io/delta that referenced this pull request Nov 12, 2026
#### Which Delta project/connector is this regarding?

- [ ] Spark
- [ ] Standalone
- [x] Flink
- [ ] Kernel
- [ ] Other (fill in here)

## Description

Building Delta against Unity Catalog after
unitycatalog/unitycatalog#2087 fails before tests run. The generated
Java client adds an `includeBrowse` argument to its get/list methods.
For example, `SchemasApi.listSchemas(String, Integer, String)` now
requires a fourth `Boolean` argument. The Flink connector still calls
the old methods.

Pass `false` for the new argument in the four Flink calls. This keeps
the previous behavior and avoids requesting discovery-only metadata.
Move the pinned UC revision from `6e99222` to `a9c956e`, the merge
commit for the API change, so the default build uses the matching
client. Update the seven Spark test calls and the Scala quickstart call
that also use these methods and share the pin.

## How was this patch tested?

Built and locally published the UC client and Hadoop artifacts from both
exact revisions. With the original Delta source, `flink/compile` passes
against `0.8.0-SNAPSHOT-6e99222` and fails against
`0.8.0-SNAPSHOT-a9c956e` with all four argument-count errors.

Added a WireMock regression test that calls all four Flink methods and
checks that each HTTP request sends `include_browse=false`.

With this patch and UC `0.8.0-SNAPSHOT-a9c956e`, all 10 focused tests
pass:

```sh
build/sbt -DunityCatalogVersion=0.8.0-SNAPSHOT-a9c956e \
  'flink/testOnly io.delta.flink.table.UnityCatalogTest io.delta.flink.sink.sql.FlinkUnityCatalogTest'
```

Java format checks pass:

```sh
build/sbt -DunityCatalogVersion=0.8.0-SNAPSHOT-a9c956e \
  flink/Compile/javafmtCheck flink/Test/javafmtCheck sparkUnityCatalog/Test/javafmtCheck
```

The seven changed Spark Java test files also compile against the new UC
client in a targeted `javac` check with cached dependencies. The full
Spark integration suite and the Scala quickstart were not run.

## Does this PR introduce _any_ user-facing changes?

No. This restores compilation against the updated UC Java client and
keeps the existing metadata behavior.

Signed-off-by: Timothy Wang <[email protected]>
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