From 88bade6cc0a735cf26c82c871762032e044b2a74 Mon Sep 17 00:00:00 2001 From: Kiran Naidoo Date: Wed, 3 Jul 2024 15:48:08 +0100 Subject: [PATCH] security: fix AliasCheck panic (update) (#21510) Updated `checkServiceExistsOnRemoteServer` to ensure there are services returned from the specified node before proceeding with the service matcher. --- agent/checks/alias.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/agent/checks/alias.go b/agent/checks/alias.go index 3b0226b9f4..200176364e 100644 --- a/agent/checks/alias.go +++ b/agent/checks/alias.go @@ -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