From cbc06c08563ad15a8d1304e50972dd9d0f5cf32c Mon Sep 17 00:00:00 2001 From: Brian Howe <30811239+bhowe34@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:48:48 -0500 Subject: [PATCH] ensure response is not nil before sanitizing (#27923) Co-authored-by: akshya96 <87045294+akshya96@users.noreply.github.com> --- command/agentproxyshared/cache/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/command/agentproxyshared/cache/handler.go b/command/agentproxyshared/cache/handler.go index c51a6b8346..d136983178 100644 --- a/command/agentproxyshared/cache/handler.go +++ b/command/agentproxyshared/cache/handler.go @@ -85,6 +85,10 @@ func ProxyHandler(ctx context.Context, logger hclog.Logger, proxier Proxier, inm logical.RespondError(w, http.StatusInternalServerError, fmt.Errorf("failed to get the response: %w", err)) } return + } else if resp == nil { + metrics.IncrCounter([]string{"agent", "proxy", "error"}, 1) + logical.RespondError(w, http.StatusInternalServerError, fmt.Errorf("failed to get the response: %w", err)) + return } err = sanitizeAutoAuthTokenResponse(ctx, logger, inmemSink, req, resp)