You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "krishnamuttevi (via GitHub)" <gi...@apache.org> on 2026/06/03 09:23:34 UTC

[PR] RANGER-5624: Fix inconsistent updatedBy masking in get groups/groupName [ranger]

krishnamuttevi opened a new pull request, #993:
URL: https://github.com/apache/ranger/pull/993

   Currently, there is an inconsistency in the masking behavior of the updatedBy field in VXGroup responses across group retrieval APIs. When a group is fetched by its ID (GET /xusers/groups/{id}), the field is correctly masked to prevent metadata leakage. However, retrieving the exact same group by its name ( GET /xusers/groups/groupName/ group_name} ) bypasses this masking and exposes the actual user value (e.g., "Admin"). This inconsistency leads to an unreliable API contract and the unintended exposure of sensitive user-related metadata.
   
   This was solved by:
   
   1. Resolve the group ID using the requested group name directly within the xuserrest layer.
   
   2. Route the subsequent retrieval call through the existing xUserMgr.getXGroup(id) method.
   
   3. Update the following unit tests accordingly
   
   Align the underlying logic so both endpoints share the exact same retrieval pipeline, ensuring the updatedBy field is consistently masked across all responses.
   
   
   


-- 
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: dev-unsubscribe@ranger.apache.org

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


Re: [PR] RANGER-5624: Fix inconsistent updatedBy masking in get groups/groupName [ranger]

Posted by "krishnamuttevi (via GitHub)" <gi...@apache.org>.
krishnamuttevi commented on code in PR #993:
URL: https://github.com/apache/ranger/pull/993#discussion_r3534172012


##########
security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java:
##########
@@ -855,30 +854,8 @@ public VXUser getXUserByUserName(@Context HttpServletRequest request, @PathParam
     @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_X_GROUP_BY_GROUP_NAME + "\")")
     public VXGroup getXGroupByGroupName(@Context HttpServletRequest request, @PathParam("groupName") String groupName) {
         VXGroup         vXGroup     = xGroupService.getGroupByGroupName(groupName);
-        UserSessionBase userSession = ContextUtil.getCurrentUserSession();
-
-        // Plain ROLE_USER may only fetch groups they belong to; not config super-users.
-        if (userSession != null && userSession.getLoginId() != null && userSession.isSingleRoleUserSession()) {
-            VXUser  loggedInVXUser = xUserService.getXUserByUserName(userSession.getLoginId());
-            boolean isMatch        = false;
-
-            if (loggedInVXUser != null && vXGroup != null) {
-                List<XXGroup> userGroups = xGroupService.getGroupsByUserId(loggedInVXUser.getId());
-
-                for (XXGroup xXGroup : userGroups) {
-                    if (xXGroup != null && StringUtils.equals(xXGroup.getName(), vXGroup.getName())) {
-                        isMatch = true;
-                        break;
-                    }
-                }
-            }
-
-            if (!isMatch) {
-                vXGroup = null;
-            }
-        }
-
-        return vXGroup;
+        Long id = vXGroup.getId();

Review Comment:
   here if it is a non admin role - (auditor, keyadmin)
   passes both masked and exception
   
   but if  non admin role - (user) + non group member  - it gives 403 forbidden 
   and  non admin role - (user) + group member  - it gives vxgroup with masked updated by field



-- 
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: dev-unsubscribe@ranger.apache.org

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


Re: [PR] RANGER-5624: Fix inconsistent updatedBy masking in get groups/groupName [ranger]

Posted by "pradeepagrawal8184 (via GitHub)" <gi...@apache.org>.
pradeepagrawal8184 commented on code in PR #993:
URL: https://github.com/apache/ranger/pull/993#discussion_r3533951079


##########
security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java:
##########
@@ -855,30 +854,8 @@ public VXUser getXUserByUserName(@Context HttpServletRequest request, @PathParam
     @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_X_GROUP_BY_GROUP_NAME + "\")")
     public VXGroup getXGroupByGroupName(@Context HttpServletRequest request, @PathParam("groupName") String groupName) {
         VXGroup         vXGroup     = xGroupService.getGroupByGroupName(groupName);
-        UserSessionBase userSession = ContextUtil.getCurrentUserSession();
-
-        // Plain ROLE_USER may only fetch groups they belong to; not config super-users.
-        if (userSession != null && userSession.getLoginId() != null && userSession.isSingleRoleUserSession()) {
-            VXUser  loggedInVXUser = xUserService.getXUserByUserName(userSession.getLoginId());
-            boolean isMatch        = false;
-
-            if (loggedInVXUser != null && vXGroup != null) {
-                List<XXGroup> userGroups = xGroupService.getGroupsByUserId(loggedInVXUser.getId());
-
-                for (XXGroup xXGroup : userGroups) {
-                    if (xXGroup != null && StringUtils.equals(xXGroup.getName(), vXGroup.getName())) {
-                        isMatch = true;
-                        break;
-                    }
-                }
-            }
-
-            if (!isMatch) {
-                vXGroup = null;
-            }
-        }
-
-        return vXGroup;
+        Long id = vXGroup.getId();

Review Comment:
   what is the behavior if a non-admin(user role) user is accessing a group when he is part of the group and when he is not.



-- 
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: dev-unsubscribe@ranger.apache.org

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


Re: [PR] RANGER-5624: Fix inconsistent updatedBy masking in get groups/groupName [ranger]

Posted by "pradeepagrawal8184 (via GitHub)" <gi...@apache.org>.
pradeepagrawal8184 merged PR #993:
URL: https://github.com/apache/ranger/pull/993


-- 
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: dev-unsubscribe@ranger.apache.org

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