Skip to content

Commit a837ac8

Browse files
author
Prachi Damle
committed
Adding Operate access check at service layer, since we are not checking access on the command parameter here
1 parent e5d7226 commit a837ac8

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

‎api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import org.apache.log4j.Logger;
2020

2121
import org.apache.cloudstack.acl.IAMEntityType;
22-
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
23-
import org.apache.cloudstack.api.ACL;
2422
import org.apache.cloudstack.api.APICommand;
2523
import org.apache.cloudstack.api.ApiCommandJobType;
2624
import org.apache.cloudstack.api.ApiConstants;
@@ -47,7 +45,6 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
4745
// ////////////// API parameters /////////////////////
4846
// ///////////////////////////////////////////////////
4947

50-
@ACL(accessType = AccessType.OperateEntry, pointerToEntity = "securityGroupId")
5148
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, description = "The ID of the egress rule", entityType=SecurityGroupRuleResponse.class)
5249
private Long id;
5350

‎server/src/com/cloud/network/security/SecurityGroupManagerImpl.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.apache.commons.codec.digest.DigestUtils;
4444
import org.apache.log4j.Logger;
4545

46+
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
4647
import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupEgressCmd;
4748
import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupIngressCmd;
4849
import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupCmd;
@@ -812,7 +813,7 @@ private boolean revokeSecurityGroupRule(final Long id, SecurityRuleType type) {
812813

813814
// Check permissions
814815
SecurityGroup securityGroup = _securityGroupDao.findById(rule.getSecurityGroupId());
815-
_accountMgr.checkAccess(caller, null, true, securityGroup);
816+
_accountMgr.checkAccess(caller, AccessType.OperateEntry, true, securityGroup);
816817

817818
return Transaction.execute(new TransactionCallback<Boolean>() {
818819
@Override

0 commit comments

Comments
 (0)