Skip to content

Commit 60d4679

Browse files
authored
Fix CVE-2024-6104 in cert-manager by patching vendor package sources (#9981)
1 parent 2469e3f commit 60d4679

2 files changed

Lines changed: 86 additions & 1 deletion

File tree

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

SPECS/cert-manager/cert-manager.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Automatically provision and manage TLS certificates in Kubernetes
22
Name: cert-manager
33
Version: 1.11.2
4-
Release: 11%{?dist}
4+
Release: 12%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -22,6 +22,7 @@ Source1: %{name}-%{version}-govendor.tar.gz
2222
Patch0: CVE-2023-48795.patch
2323
Patch1: CVE-2023-45288.patch
2424
Patch2: CVE-2024-26147.patch
25+
Patch3: CVE-2024-6104.patch
2526
BuildRequires: golang
2627
Requires: %{name}-acmesolver
2728
Requires: %{name}-cainjector
@@ -114,6 +115,9 @@ install -D -m0755 bin/webhook %{buildroot}%{_bindir}/
114115
%{_bindir}/webhook
115116

116117
%changelog
118+
* Wed Jul 31 2023 Bala <balakumaran.kannan@microsoft.com> - 1.11.2-12
119+
- Patch for CVE-2024-6104
120+
117121
* Thu Jun 06 2024 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 1.11.2-11
118122
- Bump release to rebuild with go 1.21.11
119123

0 commit comments

Comments
 (0)