fimugdha commented on code in PR #1394:
URL: https://github.com/apache/ranger/pull/1394#discussion_r4715957017
##########
security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java:
##########
@@ -2626,17 +2624,19 @@ public List<RangerPrincipal>
getRangerPrincipals(SearchCriteria searchCriteria)
public boolean hasAccessToModule(String moduleName) {
UserSessionBase userSession = ContextUtil.getCurrentUserSession();
- if (userSession != null && userSession.isSuperUser()) {
- return true;
- }
-
- if (userSession != null && userSession.getLoginId() != null) {
- VXUser vxUser =
xUserService.getXUserByUserName(userSession.getLoginId());
+ if (userSession != null) {
+ if (RangerConstants.MODULE_KEY_MANAGER.equals(moduleName)) {
+ return userSession.isKeyAdmin() ||
userSession.isAuditKeyAdmin();
Review Comment:
Thanks for the explanation. I understand the intent: KMS access should be
limited to keyadmin and audit keyadmin.
Currently every caller of hasAccessToModule passes only MODULE_USER_GROUPS,
so the MODULE_KEY_MANAGER check will never run, leaving it as untested code for
a case that doesn't exist today. If you want to keep the guard for future
callers, please add a comment explaining why and add unit test cases.
--
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]