Bug 10631: Updated SearchHost authorization action (#10655)

Updated authorization on 'host/search' endpoint so that logged in users can list hosts.
This commit is contained in:
Juan Fernandez 2023-03-21 15:29:59 -04:00 committed by GitHub
parent f30fe7e4a9
commit 5c465549e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -0,0 +1 @@
Bug: Updated authorization action used on host/search endpoint

View file

@ -324,7 +324,7 @@ func searchHostsEndpoint(ctx context.Context, request interface{}, svc fleet.Ser
}
func (svc *Service) SearchHosts(ctx context.Context, matchQuery string, queryID *uint, excludedHostIDs []uint) ([]*fleet.Host, error) {
if err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionRead); err != nil {
if err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionList); err != nil {
return nil, err
}