mirror of https://github.com/portainer/portainer
fix(api): filter sensitive information from API response (#2103)
parent
b8ed6d3d4a
commit
5f79547138
|
@ -27,8 +27,9 @@ func (handler *Handler) endpointList(w http.ResponseWriter, r *http.Request) *ht
|
||||||
|
|
||||||
filteredEndpoints := security.FilterEndpoints(endpoints, endpointGroups, securityContext)
|
filteredEndpoints := security.FilterEndpoints(endpoints, endpointGroups, securityContext)
|
||||||
|
|
||||||
for _, endpoint := range filteredEndpoints {
|
for idx := range filteredEndpoints {
|
||||||
hideFields(&endpoint)
|
hideFields(&filteredEndpoints[idx])
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.JSON(w, filteredEndpoints)
|
return response.JSON(w, filteredEndpoints)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@ func (handler *Handler) registryList(w http.ResponseWriter, r *http.Request) *ht
|
||||||
|
|
||||||
filteredRegistries := security.FilterRegistries(registries, securityContext)
|
filteredRegistries := security.FilterRegistries(registries, securityContext)
|
||||||
|
|
||||||
for _, registry := range filteredRegistries {
|
for idx := range filteredRegistries {
|
||||||
hideFields(®istry)
|
hideFields(&filteredRegistries[idx])
|
||||||
}
|
}
|
||||||
return response.JSON(w, registries)
|
|
||||||
|
return response.JSON(w, filteredRegistries)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@ func (handler *Handler) userList(w http.ResponseWriter, r *http.Request) *httper
|
||||||
|
|
||||||
filteredUsers := security.FilterUsers(users, securityContext)
|
filteredUsers := security.FilterUsers(users, securityContext)
|
||||||
|
|
||||||
for _, user := range filteredUsers {
|
for idx := range filteredUsers {
|
||||||
hideFields(&user)
|
hideFields(&filteredUsers[idx])
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.JSON(w, filteredUsers)
|
return response.JSON(w, filteredUsers)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue