You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/01/20 14:04:53 UTC
[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #5879: Role escalation prevention
DaanHoogland commented on a change in pull request #5879:
URL: https://github.com/apache/cloudstack/pull/5879#discussion_r788794681
##########
File path: server/src/main/java/com/cloud/user/AccountManagerImpl.java
##########
@@ -1110,6 +1123,31 @@ public UserAccount createUserAccount(final String userName, final String passwor
return _userAccountDao.findById(userId);
}
+ /**
+ * if there is any permission under the requested role that is not permitted for the caller, refuse
+ */
+ private void checkRoleEscalation(Account caller, Long requestedRoleId) {
+ List<RolePermission> requestedPermissions = roleService.findAllPermissionsBy(requestedRoleId);
+
+ for (RolePermission permission : requestedPermissions) {
+ if (permission.getPermission() == Permission.ALLOW) {
+ String command = permission.getRule().getRuleString();
+ if (command.contains("*")) {
+ // find all api that match command and loop
+ checkApiAccess(caller, command);
+ } else {
+ checkApiAccess(caller, command);
+ }
Review comment:
:) it will be when done, still in progress @Pearl1594
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org