You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "peter-toth (via GitHub)" <gi...@apache.org> on 2026/07/03 08:57:19 UTC

Re: [PR] [SPARK-57882][SQL] Enforce AuthV2 metadata authorization on GetPrimaryKeys and GetCrossReference operations [spark]

peter-toth commented on code in PR #56962:
URL: https://github.com/apache/spark/pull/56962#discussion_r3518706991


##########
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/GetCrossReferenceOperation.java:
##########
@@ -117,6 +121,21 @@ public void runInternal() throws HiveSQLException {
     setState(OperationState.RUNNING);
     try {
        IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient();
+      if (isAuthV2Enabled()) {
+        List<HivePrivilegeObject> privObjs = new ArrayList<>();
+        if (parentTableName != null) {
+          privObjs.add(new HivePrivilegeObject(
+              HivePrivilegeObjectType.TABLE_OR_VIEW, parentSchemaName, parentTableName));
+        }
+        if (foreignTableName != null) {
+          privObjs.add(new HivePrivilegeObject(
+              HivePrivilegeObjectType.TABLE_OR_VIEW, foreignSchemaName, foreignTableName));
+        }
+        String cmdStr = "catalog : " + parentCatalogName
+            + ", parentSchema : " + parentSchemaName + ", parentTable : " + parentTableName
+            + ", foreignSchema : " + foreignSchemaName + ", foreignTable : " + foreignTableName;

Review Comment:
   Good catch - done. It now rejects with `Access denied` when neither parent nor foreign table is specified (`privObjs` empty), so an unscoped request fails closed instead of running an empty authorization check.



##########
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java:
##########
@@ -75,6 +79,13 @@ public void runInternal() throws HiveSQLException {
     setState(OperationState.RUNNING);
     try {
       IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient();
+      if (isAuthV2Enabled()) {
+        List<HivePrivilegeObject> privObjs = Collections.singletonList(
+            new HivePrivilegeObject(HivePrivilegeObjectType.TABLE_OR_VIEW, schemaName, tableName));
+        String cmdStr = "catalog : " + catalogName + ", schema : " + schemaName
+            + ", table : " + tableName;

Review Comment:
   Done - it now rejects when `tableName` is null, before building the privilege object.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org