mneethiraj commented on code in PR #731:
URL: https://github.com/apache/ranger/pull/731#discussion_r2658307899


##########
security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java:
##########
@@ -3220,16 +3220,16 @@ void ensureAdminAccess(RangerPolicy policy, String 
grantor) {
         final boolean isAdmin;
         final boolean isKeyAdmin;
 
-        if (StringUtils.isEmpty(grantor)) {
-            userName   = bizUtil.getCurrentUserLoginId();
-            isAdmin    = bizUtil.isAdmin();
-            isKeyAdmin = bizUtil.isKeyAdmin();
-        } else {
+        if (StringUtils.isEmpty(bizUtil.getCurrentUserLoginId()) && 
StringUtils.isNotEmpty(grantor)) {

Review Comment:
   This will result in using service account identity (impala/hive/hbase) to 
authorize grant/revoke calls, which is not correct.
   
   grant/revoke calls by services like Impala/HiveServer2/HBase authenticate 
with Ranger admin using their service account. The identity of the user 
entering grant/revoke statement is sent in grantor field of the payload. Ranger 
admin ensures that the grantor user has necessary privileages to perform the 
grant/revoke call. If the grantor user doesn't have privileges, the 
grant/revoke must fail. This is the correct behavior.
   
   



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

Reply via email to