Backport of security: fix AliasCheck panic (update) into release/1.19.x (#21511)

backport of commit 8c3682afd3

Co-authored-by: Kiran Naidoo <kiran@kiran.za.org>
pull/21515/head
hc-github-team-consul-core 2024-07-03 08:11:59 -07:00 committed by GitHub
parent 73d46d6350
commit 1e3ea57e0a
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
}
// 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 {
if serviceID.Matches(srv.CompoundServiceID()) {
return true, nil