Skip to content

Commit 9b3f2cc

Browse files
authored
Fix CVE-2024-6104 in rook by patching vendor gomodule (#9993)
1 parent eb5dffc commit 9b3f2cc

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

SPECS/rook/CVE-2024-6104.patch

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
From 5801fdff931e19a5cc9397b8a0cc7dfb4c8a67c0 Mon Sep 17 00:00:00 2001
2+
From: Balakumaran Kannan <kumaran.4353@gmail.com>
3+
Date: Thu, 1 Aug 2024 12:47:50 +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/rook/rook.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Summary: Orchestrator for distributed storage systems in cloud-native environments
2020
Name: rook
2121
Version: 1.6.2
22-
Release: 20%{?dist}
22+
Release: 21%{?dist}
2323
License: Apache-2.0
2424
Vendor: Microsoft Corporation
2525
Distribution: Mariner
@@ -57,6 +57,7 @@ Patch0: flexvolume-dir.patch
5757
Patch1: CVE-2022-21698.patch
5858
Patch2: CVE-2023-44487.patch
5959
Patch3: CVE-2021-44716.patch
60+
Patch4: CVE-2024-6104.patch
6061
# Ceph version is needed to set correct container tag in manifests
6162
BuildRequires: ceph
6263
# Rook requirements
@@ -255,6 +256,9 @@ sed -i -e "s|\(.*tag: \)VERSION|\1%{helm_appVersion}|" %{values_yaml}
255256
# bother adding docs or changelog or anything
256257

257258
%changelog
259+
* Thu Aug 01 2024 Bala <balakumaran.kannan@microsoft.com> - 1.6.2-21
260+
- Patch CVE-2024-6104
261+
258262
* Thu Jun 06 2024 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 1.6.2-20
259263
- Bump release to rebuild with go 1.21.11
260264

0 commit comments

Comments
 (0)