From 720ae7511bf7f516a7cef4bea02922739b79645c Mon Sep 17 00:00:00 2001 From: Sam Feifer Date: Tue, 16 Jul 2024 14:32:04 -0400 Subject: [PATCH] Resolves: RHEL-44887 --- 1004-vendor-Redacted-Url-in-logs.patch | 51 ++++++++++++++++++++++++++ grafana.spec | 7 +++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 1004-vendor-Redacted-Url-in-logs.patch diff --git a/1004-vendor-Redacted-Url-in-logs.patch b/1004-vendor-Redacted-Url-in-logs.patch new file mode 100644 index 0000000..9ac5827 --- /dev/null +++ b/1004-vendor-Redacted-Url-in-logs.patch @@ -0,0 +1,51 @@ +diff --git a/vendor/github.com/hashicorp/go-retryablehttp/client.go b/vendor/github.com/hashicorp/go-retryablehttp/client.go +index f40d241..765a828 100644 +--- a/vendor/github.com/hashicorp/go-retryablehttp/client.go ++++ b/vendor/github.com/hashicorp/go-retryablehttp/client.go +@@ -584,9 +584,9 @@ func (c *Client) Do(req *Request) (*http.Response, error) { + if logger != nil { + switch v := logger.(type) { + case LeveledLogger: +- v.Debug("performing request", "method", req.Method, "url", req.URL) ++ v.Debug("performing request", "method", req.Method, "url", req.URL.Redacted()) + case Logger: +- v.Printf("[DEBUG] %s %s", req.Method, req.URL) ++ v.Printf("[DEBUG] %s %s", req.Method, req.URL.Redacted()) + } + } + +@@ -641,9 +641,9 @@ func (c *Client) Do(req *Request) (*http.Response, error) { + if err != nil { + switch v := logger.(type) { + case LeveledLogger: +- v.Error("request failed", "error", err, "method", req.Method, "url", req.URL) ++ v.Error("request failed", "error", err, "method", req.Method, "url", req.URL.Redacted()) + case Logger: +- v.Printf("[ERR] %s %s request failed: %v", req.Method, req.URL, err) ++ v.Printf("[ERR] %s %s request failed: %v", req.Method, req.URL.Redacted(), err) + } + } else { + // Call this here to maintain the behavior of logging all requests, +@@ -679,7 +679,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) { + + wait := c.Backoff(c.RetryWaitMin, c.RetryWaitMax, i, resp) + if logger != nil { +- desc := fmt.Sprintf("%s %s", req.Method, req.URL) ++ desc := fmt.Sprintf("%s %s", req.Method, req.URL.Redacted()) + if resp != nil { + desc = fmt.Sprintf("%s (status: %d)", desc, resp.StatusCode) + } +@@ -735,11 +735,11 @@ func (c *Client) Do(req *Request) (*http.Response, error) { + // communicate why + if err == nil { + return nil, fmt.Errorf("%s %s giving up after %d attempt(s)", +- req.Method, req.URL, attempt) ++ req.Method, req.URL.Redacted(), attempt) + } + + return nil, fmt.Errorf("%s %s giving up after %d attempt(s): %w", +- req.Method, req.URL, attempt, err) ++ req.Method, req.URL.Redacted(), attempt, err) + } + + // Try to read the response body so we can reuse this connection. diff --git a/grafana.spec b/grafana.spec index 53b3bfe..5acfee5 100644 --- a/grafana.spec +++ b/grafana.spec @@ -25,7 +25,7 @@ end} Name: grafana Version: 10.2.6 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Metrics dashboard and graph editor License: AGPL-3.0-only URL: https://grafana.org @@ -81,6 +81,7 @@ Patch10: 0010-remove-bcrypt-references.patch Patch1001: 1001-vendor-patch-removed-backend-crypto.patch Patch1002: 1002-vendor-use-pbkdf2-from-OpenSSL.patch Patch1003: 1003-vendor-skip-goldenfiles-tests.patch +Patch1004: 1004-vendor-Redacted-Url-in-logs.patch # Intersection of go_arches and nodejs_arches ExclusiveArch: %{grafana_arches} @@ -781,6 +782,7 @@ cp -p %{SOURCE8} %{SOURCE9} %{SOURCE10} SELinux %ifarch s390x i686 armv7hl %patch -P 1003 -p1 %endif +%patch -P 1004 -p1 %build @@ -1020,6 +1022,9 @@ fi %{_datadir}/selinux/*/grafana.pp %changelog +* Tue Jul 16 2024 Sam Feifer - 10.2.6-6 +- Resolves: RHEL-44887 + * Tue Jul 9 2024 Sam Feifer - 10.2.6-5 - Resolves: RHEL-35909 - Resolves: RHEL-43354