From 7a19d2e7a48ffc7a6b16889adad63b121e98d82c Mon Sep 17 00:00:00 2001 From: Deniz Onur Duzgun <59659739+dduzgun-security@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:03:10 -0400 Subject: [PATCH] security: fix AliasCheck panic (#21339) * security: fix AliasCheck panic * add changelog --- .changelog/21339.txt | 3 +++ agent/checks/alias.go | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 .changelog/21339.txt diff --git a/.changelog/21339.txt b/.changelog/21339.txt new file mode 100644 index 0000000000..8e8379ada0 --- /dev/null +++ b/.changelog/21339.txt @@ -0,0 +1,3 @@ +```release-note:bug +core: Fix panic runtime error on AliasCheck +``` diff --git a/agent/checks/alias.go b/agent/checks/alias.go index f75c05b958..3b0226b9f4 100644 --- a/agent/checks/alias.go +++ b/agent/checks/alias.go @@ -144,6 +144,9 @@ func (c *CheckAlias) runLocal(stopCh chan struct{}) { type CheckIfServiceIDExists func(*structs.ServiceID) bool func (c *CheckAlias) checkServiceExistsOnRemoteServer(serviceID *structs.ServiceID) (bool, error) { + if serviceID == nil { + return false, fmt.Errorf("serviceID cannot be nil") + } args := c.RPCReq args.Node = c.Node args.AllowStale = true