GaOrtiga commented on code in PR #7153:
URL: https://github.com/apache/cloudstack/pull/7153#discussion_r1095823504


##########
server/src/main/java/com/cloud/api/ApiResponseHelper.java:
##########
@@ -2490,7 +2490,11 @@ public NetworkResponse 
createNetworkResponse(ResponseView view, Network network)
         if (network.getVpcId() != null) {
             Vpc vpc = ApiDBUtils.findVpcById(network.getVpcId());
             if (vpc != null) {
-                response.setVpcId(vpc.getUuid());
+                try {
+                    
_accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, false, 
vpc);
+                    response.setVpcId(vpc.getUuid());
+                } catch (PermissionDeniedException e){
+                }

Review Comment:
   @DaanHoogland , the reason to do this is to abstract the ID of the VPC from 
the account that does not have access to it; this way, the account would know 
the network belongs to a VPC, but would not be able to redirect to the VPC tab 
in the UI. Here follows an example, with VPCUser being accessible by the 
account and VPCRoot not being accessible:
   
   
![image](https://user-images.githubusercontent.com/49285692/216619535-a742f954-dcfd-4834-94f1-23687d2f09a2.png)
   
   >at least we should log that something was denied/not setting or disclosing 
vpcid.
   
   You are right, there should be a log there, I will add it.



-- 
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]

Reply via email to