Skip to content

[#13839] fix(server): Enforce metadata tag permissions on branch-1.3 - #13843

Merged
mchades merged 1 commit into
apache:branch-1.3from
mchades:codex/fix-tag-read-authz-1.3
Oct 15, 2026
Merged

mchades merged 1 commit into
apache:branch-1.3from
mchades:codex/fix-tag-read-authz-1.3

Conversation

@mchades

@mchades mchades commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Apply the server fix from #13794 to branch-1.3: group the complete CAN_ACCESS_METADATA expression and add regression coverage for both tag REST routes and Java client tag reads, using 1.3's supported types and privileges.

Why are the changes needed?

Metadata access could bypass tag permissions and expose associated tags to unauthorized users.

Fix: #13839 (branch-1.3)

Does this PR introduce any user-facing change?

Tag reads through metadata objects now enforce tag permissions.

How was this patch tested?

  • Reproduced both the expression and Java HTTP regressions before the fix; both pass after it.
  • 324 server-common tests, 43 server authorization tests, and 10 TagOperationsAuthorizationIT tests passed.
  • Spotless and git diff --check passed.

…h-1.3

Adapt the server fix from apache#13794 (5ef4945)
to branch-1.3. Group the complete CAN_ACCESS_METADATA expansion so object
access cannot bypass tag permissions.

Cover both REST authorization expressions with table and view permissions,
and add a Java client HTTP regression for denied and authorized tag reads.

Co-authored-by: Akshay Thorat <ak007t@gmail.com>
@mchades
mchades requested review from jerryshao and roryqi and a balanced review from Copilot October 14, 2026 07:15

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open finding
What changed in this PR

Backports a server authorization fix to branch-1.3 to ensure metadata-object tag reads can’t bypass tag permissions, and adds regression coverage for both REST routes and the Java client.

Changes:

  • Groups the full CAN_ACCESS_METADATA authorization sub-expression to enforce correct operator precedence.
  • Adds a server-side unit test verifying tag reads require both metadata access and tag permissions across both REST resources.
  • Extends Java client integration coverage to include getTag() authorization via metadata-backed tag APIs.
File Description
server/​src/​test/​java/​org/​apache/​gravitino/​server/​web/​rest/​authorization/​TestMetadataObjectTagAuthorizationExpression.java Adds a regression test to validate tag-read authorization isn’t bypassed via metadata access.
server-common/​src/​main/​java/​org/​apache/​gravitino/​server/​authorization/​expression/​AuthorizationExpressionConverter.java Fixes precedence by wrapping the full CAN_ACCESS_METADATA OR-chain in parentheses.
clients/​client-java/​src/​test/​java/​org/​apache/​gravitino/​client/​integration/​test/​authorization/​TagOperationsAuthorizationIT.java Extends IT coverage to assert getTag() obeys tag permissions when accessed via metadata objects.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +44 to +48
for (String type : new String[] {"TABLE", "VIEW"}) {
MockAuthorizationExpressionEvaluator evaluator =
new MockAuthorizationExpressionEvaluator(
AuthorizationExpressionConverter.replaceCanAccessMetadataPrivilege(expression)
.replace("entityType", "'" + type + "'"));
@roryqi

roryqi commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Do we need to fix this issue in the main branch?

@mchades

mchades commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Do we need to fix this issue in the main branch?

yes, the same fixed included in #13794

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Overall Project 69.1% +0.03% 🟢
Files changed 98.11% 🟢

Module Coverage
aliyun 19.74% 🔴
api 47.62% 🟢
authorization-common 85.96% 🟢
authorization-ranger 10.17% 🔴
aws 53.54% 🟢
aws-bundle 0.0% 🔴
azure 32.1% 🔴
azure-bundle 0.0% 🔴
catalog-common 19.13% 🔴
catalog-fileset 80.73% 🟢
catalog-glue 71.33% 🟢
catalog-hive 80.55% 🟢
catalog-jdbc-clickhouse 84.7% 🟢
catalog-jdbc-common 50.73% 🟢
catalog-jdbc-doris 83.12% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 81.8% 🟢
catalog-jdbc-oceanbase 78.6% 🟢
catalog-jdbc-postgresql 83.89% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 75.49% 🟢
catalog-lakehouse-generic 61.21% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.98% 🟢
catalog-lakehouse-paimon 82.17% 🟢
catalog-model 77.99% 🟢
cli 44.51% 🟢
client-java 78.31% 🟢
client-java-runtime 0.0% 🔴
common 51.08% 🟢
core 83.8% 🟢
filesystem-hadoop3 77.68% 🟢
flink 18.07% 🔴
flink-common 50.82% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-common 15.43% 🔴
hive-metastore-common 62.61% 🟢
hive-metastore3-libs 58.8% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 60.39% 🟢
iceberg-rest-server 75.24% 🟢
idp-basic 86.79% 🟢
integration-test-common 0.0% 🔴
jobs 60.37% 🟢
lance-common 29.23% 🔴
lance-rest-server 60.7% 🟢
lineage 59.39% 🟢
optimizer 82.85% 🟢
optimizer-api 42.56% 🟢
server 89.65% 🟢
server-common 78.61% +0.73% 🟢
spark 28.57% 🔴
spark-common 48.61% 🟢
trino-connector 62.84% 🟢
Files
Module File Coverage
server-common AuthorizationExpressionConverter.java 98.11% 🟢

@mchades
mchades merged commit 35031e7 into apache:branch-1.3 Oct 15, 2026
35 checks passed
@mchades
mchades deleted the codex/fix-tag-read-authz-1.3 branch October 15, 2026 01:34
@mchades mchades self-assigned this Oct 15, 2026
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.

[Bug report] Metadata tag reads bypass tag permissions on main and branch-1.3

3 participants