Skip to content

Commit 0dc23ab

Browse files
authored
Fix CVE-2024-6104 in keda by patching vendor gomodule (#9990)
1 parent 60d4679 commit 0dc23ab

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

SPECS/keda/CVE-2024-6104.patch

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
From 7314ebdc4e965359fba5cf19fbffb6af5e712d0e Mon Sep 17 00:00:00 2001
2+
From: Balakumaran Kannan <kumaran.4353@gmail.com>
3+
Date: Thu, 1 Aug 2024 12:21:11 +0000
4+
Subject: [PATCH] Patch CVE-2024-6104
5+
6+
---
7+
.../hashicorp/go-retryablehttp/client.go | 26 ++++++++++++++-----
8+
1 file changed, 20 insertions(+), 6 deletions(-)
9+
10+
diff --git a/vendor/github.com/hashicorp/go-retryablehttp/client.go b/vendor/github.com/hashicorp/go-retryablehttp/client.go
11+
index f1ccd3d..25d7ef5 100644
12+
--- a/vendor/github.com/hashicorp/go-retryablehttp/client.go
13+
+++ b/vendor/github.com/hashicorp/go-retryablehttp/client.go
14+
@@ -499,9 +499,9 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
15+
if logger != nil {
16+
switch v := logger.(type) {
17+
case Logger:
18+
- v.Printf("[DEBUG] %s %s", req.Method, req.URL)
19+
+ v.Printf("[DEBUG] %s %s", req.Method, redactURL(req.URL))
20+
case LeveledLogger:
21+
- v.Debug("performing request", "method", req.Method, "url", req.URL)
22+
+ v.Debug("performing request", "method", req.Method, "url", redactURL(req.URL))
23+
}
24+
}
25+
26+
@@ -548,9 +548,9 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
27+
if err != nil {
28+
switch v := logger.(type) {
29+
case Logger:
30+
- v.Printf("[ERR] %s %s request failed: %v", req.Method, req.URL, err)
31+
+ v.Printf("[ERR] %s %s request failed: %v", req.Method, redactURL(req.URL), err)
32+
case LeveledLogger:
33+
- v.Error("request failed", "error", err, "method", req.Method, "url", req.URL)
34+
+ v.Error("request failed", "error", err, "method", req.Method, "url", redactURL(req.URL))
35+
}
36+
} else {
37+
// Call this here to maintain the behavior of logging all requests,
38+
@@ -590,7 +590,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
39+
}
40+
41+
wait := c.Backoff(c.RetryWaitMin, c.RetryWaitMax, i, resp)
42+
- desc := fmt.Sprintf("%s %s", req.Method, req.URL)
43+
+ desc := fmt.Sprintf("%s %s", req.Method, redactURL(req.URL))
44+
if code > 0 {
45+
desc = fmt.Sprintf("%s (status: %d)", desc, code)
46+
}
47+
@@ -622,7 +622,7 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
48+
}
49+
c.HTTPClient.CloseIdleConnections()
50+
return nil, fmt.Errorf("%s %s giving up after %d attempts",
51+
- req.Method, req.URL, c.RetryMax+1)
52+
+ req.Method, redactURL(req.URL), c.RetryMax+1)
53+
}
54+
55+
// Try to read the response body so we can reuse this connection.
56+
@@ -703,3 +703,17 @@ func (c *Client) StandardClient() *http.Client {
57+
Transport: &RoundTripper{Client: c},
58+
}
59+
}
60+
+
61+
+
62+
+// Taken from url.URL#Redacted() which was introduced in go 1.15.
63+
+func redactURL(u *url.URL) string {
64+
+ if u == nil {
65+
+ return ""
66+
+ }
67+
+
68+
+ ru := *u
69+
+ if _, has := ru.User.Password(); has {
70+
+ ru.User = url.UserPassword(ru.User.Username(), "xxxxx")
71+
+ }
72+
+ return ru.String()
73+
+}
74+
--
75+
2.33.8
76+

SPECS/keda/keda.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Kubernetes-based Event Driven Autoscaling
22
Name: keda
33
Version: 2.4.0
4-
Release: 21%{?dist}
4+
Release: 22%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -31,6 +31,7 @@ Source1: %{name}-%{version}-vendor-v2.tar.gz
3131
Patch0: CVE-2022-21698.patch
3232
Patch1: CVE-2023-44487.patch
3333
Patch2: CVE-2021-44716.patch
34+
Patch3: CVE-2024-6104.patch
3435

3536
BuildRequires: golang
3637

@@ -66,6 +67,9 @@ cp ./bin/keda-adapter %{buildroot}%{_bindir}
6667
%{_bindir}/%{name}-adapter
6768

6869
%changelog
70+
* Thu Aug 01 2024 Bala <balakumaran.kannan@microsoft.com> - 2.4.0-22
71+
- Patch CVE-2024-6104
72+
6973
* Wed Jul 17 2024 Muhammad Falak R Wani <mwani@microsoft.com> - 2.4.0-21
7074
- Drop requirement on a specific version of golang
7175

0 commit comments

Comments
 (0)