mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
fix(service): webhook vulnerability for passing an invalid image tag EE-2121 (#6269)
* fix(service): webhook vulnerability for passing an invalid image tag
This commit is contained in:
parent
dfb0ba9efe
commit
a9406764ee
9 changed files with 115 additions and 5 deletions
|
@ -603,3 +603,21 @@ func getAuthorizationsFromRoles(roleIdentifiers []portainer.RoleID, roles []port
|
|||
|
||||
return authorizations
|
||||
}
|
||||
|
||||
func (service *Service) UserIsAdminOrAuthorized(userID portainer.UserID, endpointID portainer.EndpointID, authorizations []portainer.Authorization) (bool, error) {
|
||||
user, err := service.dataStore.User().User(userID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if user.Role == portainer.AdministratorRole {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
for _, authorization := range authorizations {
|
||||
_, authorized := user.EndpointAuthorizations[endpointID][authorization]
|
||||
if authorized {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue