DanielZhu58 commented on code in PR #6884:
URL: https://github.com/apache/hive/pull/6884#discussion_r4418716121


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/BaseHandler.java:
##########
@@ -874,6 +874,28 @@ private void authorizeProxyPrivilege() throws TException {
     }
   }
 
+  /**
+   * Tells whether the caller may be treated as a trusted proxy/operator (e.g. 
HiveServer2 or the compactor),
+   * using the same rules as {@link #authorizeProxyPrivilege()} but without 
failing the call: the caller is
+   * trusted in embedded mode, when the proxy check is disabled, in test mode, 
or when the user has host-proxy
+   * privileges.
+   */
+  protected boolean hasProxyPrivilege() throws TException {
+    if (!HiveMetaStore.isMetaStoreRemote() ||
+        !MetastoreConf.getBoolVar(conf, 
MetastoreConf.ConfVars.EVENT_DB_NOTIFICATION_API_AUTH) ||
+        conf.getBoolean(HIVE_IN_TEST.getVarname(), false)) {
+      return true;
+    }
+    String user;
+    try {
+      user = SecurityUtils.getUGI().getShortUserName();

Review Comment:
   Fixed in the shared authorizeProxyPrivilege: for PLAIN calls we now use the 
transport's authenticated user and fail closed if it is missing. 
   This also fixes the existing notification APIs and the APIs in HIVE-29979. 
Not covered by an automated test, since it needs a Kerberos + PLAIN setup. SASL 
PLAIN without Kerberos is not covered.



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