Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/536#discussion_r33399534
  
    --- Diff: 
api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java ---
    @@ -203,9 +201,22 @@ public void execute() {
                     hostResponse.setObjectName("host");
                     hostResponses.add(hostResponse);
                 }
    -
                 response.setResponses(hostResponses, result.second());
             }
    +        // Remove sensitive details from host response
    +        List<HostResponse> hostResponsesList = response.getResponses();
    +        for (HostResponse hostResponse: hostResponsesList) {
    +            Map<String, String> hostDetails = hostResponse.getDetails();
    +            if (hostDetails == null) continue;
    +            if (hostDetails.containsKey("username")) {
    +                hostDetails.remove("username");
    +            }
    +            if (hostDetails.containsKey("password")) {
    +                hostDetails.remove("password");
    +            }
    +            hostResponse.setDetails(hostDetails);
    --- End diff --
    
    Why not perform this filtering on a defensive copy of the map in 
HostResponse.setDetails()?  I am also concerned about directly manipulating the 
details map in this method as it changes the view for any other objects holding 
references to it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to