Skip to content

[Cherry-pick to branch-1.3] [#12729] fix(authz): Authorize generic view operations (#12797) - #12868

Merged
mchades merged 2 commits into
branch-1.3from
cherry-pick-7da9b6fe-to-branch-1.3
Sep 3, 2026
Merged

[Cherry-pick to branch-1.3] [#12729] fix(authz): Authorize generic view operations (#12797)#12868
mchades merged 2 commits into
branch-1.3from
cherry-pick-7da9b6fe-to-branch-1.3

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Cherry-pick Information:

  • Original commit: 7da9b6f
  • Target branch: branch-1.3
  • Status: ✅ Conflicts resolved manually

Resolution:

  • Kept the branch-1.3 privilege table and applied only the View metadata authorization wording.
  • Added the imports required by the View interceptor tests without bringing in unrelated main-only changes.

Validation:

  • ./gradlew :core:test --tests org.apache.gravitino.hook.TestViewHookDispatcher --no-daemon
  • ./gradlew :server:test --tests org.apache.gravitino.server.web.filter.TestGravitinoInterceptionService --tests org.apache.gravitino.server.web.rest.TestViewOperations --tests org.apache.gravitino.server.web.rest.authorization.TestViewAuthorizationExpression --no-daemon
  • ./gradlew :iceberg:iceberg-rest-server:test --tests org.apache.gravitino.iceberg.service.rest.authorization.TestIcebergViewAuthorizationExpression --no-daemon
  • ./gradlew :docs:build --no-daemon
  • Conflict-marker scan and git diff --check

### What changes were proposed in this pull request?

- Register generic `ViewOperations` with `GravitinoInterceptionService`.
- Add authorization expressions and metadata for list, create, load,
alter, and drop endpoints.
- Filter listed views by ownership or `SELECT_VIEW`.
- Set the generic View creator as owner and preserve authorization
mappings across rename.
- Reuse `CREATE_VIEW`, `SELECT_VIEW`, and owner-based mutation semantics
without introducing an `ALTER_VIEW` privilege.
- Update authorization, OpenAPI, and View design documentation.

### Why are the changes needed?

Generic View REST operations currently bypass metadata authorization,
allowing requests to reach catalog lookup before privilege checks.

Fix: #12729

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

Yes. When authorization is enabled:

- Generic View endpoints enforce metadata-operation authorization.
- View listings only return authorized entries.
- Newly created Views are owned by their creator.
- Alter and drop operations are owner-based.

This does not add an explicit `INVOKER`/`DEFINER` option, `DEFINER`
execution, or new engine integration. The current Iceberg engine path
continues to use invoker behavior.

### How was this patch tested?

- Ran 50 focused authorization, interceptor, REST, ownership-hook, and
Iceberg View tests.
- Ran Spotless checks for all affected Java modules.
- Ran `./gradlew :docs:build --no-daemon`.
- Ran `git diff origin/main...HEAD --check`.
# Conflicts:
#	docs/security/access-control.md
#	server/src/test/java/org/apache/gravitino/server/web/filter/TestGravitinoInterceptionService.java
@github-actions github-actions Bot added cherry-pick Automatically opened cherry-pick PR cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge labels Sep 3, 2026
@github-actions
github-actions Bot requested a review from jerryshao September 3, 2026 05:19
@jerryshao

Copy link
Copy Markdown
Contributor

@mchades can you please fix the conflicts?

@jerryshao

Copy link
Copy Markdown
Contributor

@mchades please update the PR title/descriptio/label.

@mchades mchades changed the title [DO NOT MERGE] [Cherry-pick to branch-1.3] [#12729] fix(authz): Authorize generic view operations (#12797) [Cherry-pick to branch-1.3] [#12729] fix(authz): Authorize generic view operations (#12797) Sep 3, 2026
@mchades mchades removed the cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge label Sep 3, 2026
@mchades

mchades commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

fixed

@mchades mchades self-assigned this Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Author

Code Coverage Report

Overall Project 68.23% -0.11% 🟢
Files changed 47.18% 🔴

Module Coverage
aliyun 1.72% 🔴
api 47.7% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 10.4% 🔴
catalog-fileset 80.23% 🟢
catalog-glue 68.95% 🟢
catalog-hive 79.42% 🟢
catalog-jdbc-clickhouse 84.7% 🟢
catalog-jdbc-common 45.48% 🟢
catalog-jdbc-doris 82.61% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-oceanbase 78.6% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 82.14% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 78.16% 🟢
common 50.81% 🟢
core 83.01% -0.54% 🟢
filesystem-hadoop3 77.3% 🟢
flink 0.0% 🔴
flink-common 49.22% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-common 10.88% 🔴
hive-metastore-common 53.77% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 58.15% 🟢
iceberg-rest-server 73.87% -1.28% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 24.42% 🔴
lance-rest-server 60.13% 🟢
lineage 53.02% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴
server 87.78% +0.52% 🟢
server-common 76.28% -0.03% 🟢
spark 28.57% 🔴
spark-common 41.66% 🟢
trino-connector 47.35% 🟢
Files
Module File Coverage
core ViewHookDispatcher.java 86.21% 🟢
GravitinoEnv.java 12.56% 🔴
iceberg-rest-server RenameViewAuthzHandler.java 0.0% 🔴
server ViewOperations.java 100.0% 🟢
GravitinoInterceptionService.java 93.69% 🟢
server-common AuthorizationExpressionConstants.java 0.0% 🔴

@mchades
mchades merged commit be34870 into branch-1.3 Sep 3, 2026
35 checks passed
@mchades
mchades deleted the cherry-pick-7da9b6fe-to-branch-1.3 branch September 3, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick Automatically opened cherry-pick PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants