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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to