Skip to content

Commit 2469e3f

Browse files
authored
Fix CVE-2024-6104 in cri-o by patching vendor package source (#9986)
1 parent 9b3f2cc commit 2469e3f

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

SPECS/cri-o/CVE-2024-6104.patch

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
From ab64e79170aea240fa050a929b52607d72c62c9e Mon Sep 17 00:00:00 2001
2+
From: Balakumaran Kannan <kumaran.4353@gmail.com>
3+
Date: Thu, 1 Aug 2024 07:01:21 +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 7bfa759..aead5e1 100644
12+
--- a/vendor/github.com/hashicorp/go-retryablehttp/client.go
13+
+++ b/vendor/github.com/hashicorp/go-retryablehttp/client.go
14+
@@ -467,9 +467,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+
@@ -516,9 +516,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+
@@ -558,7 +558,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+
@@ -590,7 +590,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+
@@ -663,3 +663,17 @@ func PostForm(url string, data url.Values) (*http.Response, error) {
57+
func (c *Client) PostForm(url string, data url.Values) (*http.Response, error) {
58+
return c.Post(url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
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/cri-o/cri-o.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Summary: OCI-based implementation of Kubernetes Container Runtime Interfa
2626
# Define macros for further referenced sources
2727
Name: cri-o
2828
Version: 1.22.3
29-
Release: 5%{?dist}
29+
Release: 6%{?dist}
3030
License: ASL 2.0
3131
Vendor: Microsoft Corporation
3232
Distribution: Mariner
@@ -66,6 +66,7 @@ Patch10: CVE-2024-21626.patch
6666
Patch11: CVE-2024-3154.patch
6767
Patch12: CVE-2024-3727.patch
6868
Patch13: CVE-2021-43565.patch
69+
Patch14: CVE-2024-6104.patch
6970
BuildRequires: btrfs-progs-devel
7071
BuildRequires: device-mapper-devel
7172
BuildRequires: fdupes
@@ -218,6 +219,9 @@ mkdir -p /opt/cni/bin
218219
%{_fillupdir}/sysconfig.kubelet
219220

220221
%changelog
222+
* Thu Aug 01 2024 Bala <balakumaran.kannan@microsoft.com> - 1.22.3-6
223+
- Patch CVE-2024-6104
224+
221225
* Mon Jul 22 2024 Archana Choudhary <archana1@microsoft.com> - 1.22.3-5
222226
- Patch CVE-2021-43565
223227

0 commit comments

Comments
 (0)