----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/71724/#review218583 -----------------------------------------------------------
security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java Lines 3940 (patched) <https://reviews.apache.org/r/71724/#comment306316> I think this should be treated as validation failure. Also, this is a good place to check if it is allowed to specify 'ownerName': boolean isOwnerSpecified = StringUtils.isNotBlank(request.getOwnerUser()); boolean isGrantorNotLoggedInUser = !StringUtils.equals(loggedInUser, request.getGrantor()); if (isOwnerSpecified || isGrantorNotLoggedInUser) { boolean hasAdminPrivilege = bizUtil.isAdmin() || svcStore.isServiceAdminUser(rangerService.getName(), loggedInUser) || bizUtil.isUserAllowedForGrantRevoke(rangerService, Allowed_User_List_For_Grant_Revoke, loggedInUser); if (!hasAdminPrivilege) { throw restErrorUtil.createGrantRevokeRESTException("Invalid grant/revoke request"); } } security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java Lines 3943 (patched) <https://reviews.apache.org/r/71724/#comment306317> Since 'rangerService' already includes all service-configs, consider avoiding calls to DB i.e. svcStore.isServiceAdminUser(); instead consider adding a method in bizUtil, similar to isUserAllowedForGrantRevoke(). - Madhan Neethiraj On Nov. 9, 2019, 2:42 a.m., Abhay Kulkarni wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/71724/ > ----------------------------------------------------------- > > (Updated Nov. 9, 2019, 2:42 a.m.) > > > Review request for ranger, Madhan Neethiraj, Ramesh Mani, and Sailaja > Polavarapu. > > > Bugs: RANGER-2642 > https://issues.apache.org/jira/browse/RANGER-2642 > > > Repository: ranger > > > Description > ------- > > If Grant/Revoke REST API is invoked by a user which is not a admin or not > listed in policy.grantrevoke.auth.users config parameter value, then resource > being granted permission to should not specify ownership information. > Otherwise, such user may be able to modify a resource for which it does not > have delegated-admin privilege. > > > Diffs > ----- > > > agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyRepository.java > 065120f84 > security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java > 3d8a32977 > > > Diff: https://reviews.apache.org/r/71724/diff/4/ > > > Testing > ------- > > Passed all unit tests > > > Thanks, > > Abhay Kulkarni > >
