security: fix AliasCheck panic (update) (#21510)

Updated `checkServiceExistsOnRemoteServer` to ensure there are services
returned from the specified node before proceeding with the service
matcher.
This commit is contained in:
Kiran Naidoo 2024-07-03 15:48:08 +01:00 committed by GitHub
parent 6f31bfebbe
commit 88bade6cc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -164,6 +164,12 @@ RETRY_CALL:
} }
return false, err return false, err
} }
// Do not proceed for nil returned services.
if out.NodeServices == nil {
return false, fmt.Errorf("no services found on node")
}
for _, srv := range out.NodeServices.Services { for _, srv := range out.NodeServices.Services {
if serviceID.Matches(srv.CompoundServiceID()) { if serviceID.Matches(srv.CompoundServiceID()) {
return true, nil return true, nil