From 224218c1e3f21005e04e05f35b28363e6158191a Mon Sep 17 00:00:00 2001 From: Joseph Little Date: Tue, 9 Jul 2024 12:37:47 +0100 Subject: [PATCH] added logging to custom cookie setter including hide sensitive data support --- httpclient/cookies.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/httpclient/cookies.go b/httpclient/cookies.go index 74a2111..268fc27 100644 --- a/httpclient/cookies.go +++ b/httpclient/cookies.go @@ -7,6 +7,8 @@ import ( // loadCustomCookies applies the custom cookies supplied in the config and applies them to the http session. func (c *Client) loadCustomCookies() error { + c.Sugar.Debug("initilizing cookie jar") + cookieJar, err := cookiejar.New(nil) if err != nil { return err @@ -15,12 +17,18 @@ func (c *Client) loadCustomCookies() error { c.http.Jar = cookieJar cookieUrl, err := url.Parse((*c.Integration).GetFQDN()) + c.Sugar.Debug("cookie URL set globally to: %s", cookieUrl) if err != nil { return err } c.http.Jar.SetCookies(cookieUrl, c.config.CustomCookies) - c.Sugar.Debug("custom cookies set: %v", c.http.Jar.Cookies(cookieUrl)) + + if c.config.HideSensitiveData { + c.Sugar.Debug("[REDACTED] cookies set successfully") + } else { + c.Sugar.Debug("custom cookies set: %v", c.http.Jar.Cookies(cookieUrl)) + } return nil }