Skip to content

Commit 5ddc12c

Browse files
[Medium] Patch cert-manager for CVE-2025-32386, CVE-2025-32387, CVE-2025-22872 (#13443)
1 parent 81002d5 commit 5ddc12c

File tree

3 files changed

+138
-1
lines changed

3 files changed

+138
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 0e7a1fa0b7d23464ad2102424d1c9af0f1b576d7 Mon Sep 17 00:00:00 2001
2+
From: Kevin Lockwood <[email protected]>
3+
Date: Wed, 21 May 2025 13:55:14 -0700
4+
Subject: [PATCH] Patch CVE-2025-22872
5+
6+
Upstream reference: https://github.com/golang/net/commit/e1fcd82abba34df74614020343be8eb1fe85f0d9.patch
7+
---
8+
vendor/golang.org/x/net/html/token.go | 18 ++++++++++++++++--
9+
1 file changed, 16 insertions(+), 2 deletions(-)
10+
11+
diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go
12+
index 50f7c6a..cf52f26 100644
13+
--- a/vendor/golang.org/x/net/html/token.go
14+
+++ b/vendor/golang.org/x/net/html/token.go
15+
@@ -839,8 +839,22 @@ func (z *Tokenizer) readStartTag() TokenType {
16+
if raw {
17+
z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end]))
18+
}
19+
- // Look for a self-closing token like "<br/>".
20+
- if z.err == nil && z.buf[z.raw.end-2] == '/' {
21+
+ // Look for a self-closing token (e.g. <br/>).
22+
+ //
23+
+ // Originally, we did this by just checking that the last character of the
24+
+ // tag (ignoring the closing bracket) was a solidus (/) character, but this
25+
+ // is not always accurate.
26+
+ //
27+
+ // We need to be careful that we don't misinterpret a non-self-closing tag
28+
+ // as self-closing, as can happen if the tag contains unquoted attribute
29+
+ // values (i.e. <p a=/>).
30+
+ //
31+
+ // To avoid this, we check that the last non-bracket character of the tag
32+
+ // (z.raw.end-2) isn't the same character as the last non-quote character of
33+
+ // the last attribute of the tag (z.pendingAttr[1].end-1), if the tag has
34+
+ // attributes.
35+
+ nAttrs := len(z.attr)
36+
+ if z.err == nil && z.buf[z.raw.end-2] == '/' && (nAttrs == 0 || z.raw.end-2 != z.attr[nAttrs-1][1].end-1) {
37+
return SelfClosingTagToken
38+
}
39+
return StartTagToken
40+
--
41+
2.34.1
42+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From cd21b448e8cdd4a4be1bae172d3dad8dbeafa59b Mon Sep 17 00:00:00 2001
2+
From: Kevin Lockwood <[email protected]>
3+
Date: Wed, 16 Apr 2025 12:57:19 -0700
4+
Subject: [PATCH] [Medium] Patch cert-manager for CVE-2025-32386
5+
6+
Link: https://github.com/helm/helm/commit/d8ca55fc669645c10c0681d49723f4bb8c0b1ce7
7+
---
8+
.../helm/v3/pkg/chart/loader/archive.go | 32 ++++++++++++++++++-
9+
.../helm/v3/pkg/chart/loader/directory.go | 4 +++
10+
2 files changed, 35 insertions(+), 1 deletion(-)
11+
12+
diff --git a/vendor/helm.sh/helm/v3/pkg/chart/loader/archive.go b/vendor/helm.sh/helm/v3/pkg/chart/loader/archive.go
13+
index 8b38cb8..c42ff31 100644
14+
--- a/vendor/helm.sh/helm/v3/pkg/chart/loader/archive.go
15+
+++ b/vendor/helm.sh/helm/v3/pkg/chart/loader/archive.go
16+
@@ -33,6 +33,15 @@ import (
17+
"helm.sh/helm/v3/pkg/chart"
18+
)
19+
20+
+// MaxDecompressedChartSize is the maximum size of a chart archive that will be
21+
+// decompressed. This is the decompressed size of all the files.
22+
+// The default value is 100 MiB.
23+
+var MaxDecompressedChartSize int64 = 100 * 1024 * 1024 // Default 100 MiB
24+
+
25+
+// MaxDecompressedFileSize is the size of the largest file that Helm will attempt to load.
26+
+// The size of the file is the decompressed version of it when it is stored in an archive.
27+
+var MaxDecompressedFileSize int64 = 5 * 1024 * 1024 // Default 5 MiB
28+
+
29+
var drivePathPattern = regexp.MustCompile(`^[a-zA-Z]:/`)
30+
31+
// FileLoader loads a chart from a file
32+
@@ -110,6 +119,7 @@ func LoadArchiveFiles(in io.Reader) ([]*BufferedFile, error) {
33+
34+
files := []*BufferedFile{}
35+
tr := tar.NewReader(unzipped)
36+
+ remainingSize := MaxDecompressedChartSize
37+
for {
38+
b := bytes.NewBuffer(nil)
39+
hd, err := tr.Next()
40+
@@ -169,10 +179,30 @@ func LoadArchiveFiles(in io.Reader) ([]*BufferedFile, error) {
41+
return nil, errors.New("chart yaml not in base directory")
42+
}
43+
44+
- if _, err := io.Copy(b, tr); err != nil {
45+
+ if hd.Size > remainingSize {
46+
+ return nil, fmt.Errorf("decompressed chart is larger than the maximum size %d", MaxDecompressedChartSize)
47+
+ }
48+
+
49+
+ if hd.Size > MaxDecompressedFileSize {
50+
+ return nil, fmt.Errorf("decompressed chart file %q is larger than the maximum file size %d", hd.Name, MaxDecompressedFileSize)
51+
+ }
52+
+
53+
+ limitedReader := io.LimitReader(tr, remainingSize)
54+
+
55+
+ bytesWritten, err := io.Copy(b, limitedReader)
56+
+ if err != nil {
57+
return nil, err
58+
}
59+
60+
+ remainingSize -= bytesWritten
61+
+ // When the bytesWritten are less than the file size it means the limit reader ended
62+
+ // copying early. Here we report that error. This is important if the last file extracted
63+
+ // is the one that goes over the limit. It assumes the Size stored in the tar header
64+
+ // is correct, something many applications do.
65+
+ if bytesWritten < hd.Size || remainingSize <= 0 {
66+
+ return nil, fmt.Errorf("decompressed chart is larger than the maximum size %d", MaxDecompressedChartSize)
67+
+ }
68+
+
69+
data := bytes.TrimPrefix(b.Bytes(), utf8bom)
70+
71+
files = append(files, &BufferedFile{Name: n, Data: data})
72+
diff --git a/vendor/helm.sh/helm/v3/pkg/chart/loader/directory.go b/vendor/helm.sh/helm/v3/pkg/chart/loader/directory.go
73+
index bbe5438..fe3e67a 100644
74+
--- a/vendor/helm.sh/helm/v3/pkg/chart/loader/directory.go
75+
+++ b/vendor/helm.sh/helm/v3/pkg/chart/loader/directory.go
76+
@@ -102,6 +102,10 @@ func LoadDir(dir string) (*chart.Chart, error) {
77+
return fmt.Errorf("cannot load irregular file %s as it has file mode type bits set", name)
78+
}
79+
80+
+ if fi.Size() > MaxDecompressedFileSize {
81+
+ return fmt.Errorf("chart file %q is larger than the maximum file size %d", fi.Name(), MaxDecompressedFileSize)
82+
+ }
83+
+
84+
data, err := ioutil.ReadFile(name)
85+
if err != nil {
86+
return errors.Wrapf(err, "error reading %s", n)
87+
--
88+
2.34.1
89+

SPECS/cert-manager/cert-manager.spec

Lines changed: 7 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: 22%{?dist}
4+
Release: 23%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -36,6 +36,8 @@ Patch13: CVE-2025-22868.patch
3636
Patch14: CVE-2025-22869.patch
3737
Patch15: CVE-2025-30204.patch
3838
Patch16: CVE-2024-51744.patch
39+
Patch17: CVE-2025-32386.patch
40+
Patch18: CVE-2025-22872.patch
3941

4042
BuildRequires: golang
4143
Requires: %{name}-acmesolver
@@ -129,6 +131,10 @@ install -D -m0755 bin/webhook %{buildroot}%{_bindir}/
129131
%{_bindir}/webhook
130132

131133
%changelog
134+
* Tue Apr 15 2025 Kevin Lockwood <[email protected]> - 1.11.2-23
135+
- Fix CVE-2025-32386 and Fix CVE-2025-32387
136+
- Fix CVE-2025-22872
137+
132138
* Mon Mar 31 2025 Jyoti Kanase <[email protected]> - 1.11.2-22
133139
- Fix CVE-2024-51744
134140

0 commit comments

Comments
 (0)