Skip to content

Commit cf8ffe0

Browse files
[AUTO-CHERRYPICK] [Low] patch cert-manager for CVE-2024-51744 - branch main (#13360)
Co-authored-by: jykanase <v-jykanase@microsoft.com>
1 parent 3550cc4 commit cf8ffe0

2 files changed

Lines changed: 93 additions & 1 deletion

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
From 24c143f0c31c653523182e958d1e73c8e1022541 Mon Sep 17 00:00:00 2001
2+
From: jykanase <v-jykanase@microsoft.com>
3+
Date: Thu, 27 Mar 2025 11:36:04 +0000
4+
Subject: [PATCH] CVE-2024-51744
5+
6+
Source Link: https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c#diff-83eb8e32639d01cf443d6d8bde24c1c8be78766090d8c5f8586c36250cfedca6R50-R51
7+
---
8+
vendor/github.com/golang-jwt/jwt/v4/parser.go | 33 ++++++++++++-------
9+
1 file changed, 21 insertions(+), 12 deletions(-)
10+
11+
diff --git a/vendor/github.com/golang-jwt/jwt/v4/parser.go b/vendor/github.com/golang-jwt/jwt/v4/parser.go
12+
index 2f61a69..e11fb89 100644
13+
--- a/vendor/github.com/golang-jwt/jwt/v4/parser.go
14+
+++ b/vendor/github.com/golang-jwt/jwt/v4/parser.go
15+
@@ -36,12 +36,20 @@ func NewParser(options ...ParserOption) *Parser {
16+
return p
17+
}
18+
19+
-// Parse parses, validates, verifies the signature and returns the parsed token.
20+
-// keyFunc will receive the parsed token and should return the key for validating.
21+
+// Parse parses, validates, verifies the signature and returns the parsed token. keyFunc will
22+
+// receive the parsed token and should return the key for validating.
23+
func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
24+
return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
25+
}
26+
-
27+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object
28+
+// implementing the Claims interface. This provides default values which can be overridden and
29+
+// allows a caller to use their own type, rather than the default MapClaims implementation of
30+
+// Claims.
31+
+//
32+
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such
33+
+// as RegisteredClaims), make sure that a) you either embed a non-pointer version of the claims or
34+
+// b) if you are using a pointer, allocate the proper memory for it before passing in the overall
35+
+// claims, otherwise you might run into a panic.
36+
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
37+
token, parts, err := p.ParseUnverified(tokenString, claims)
38+
if err != nil {
39+
@@ -77,13 +85,18 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
40+
}
41+
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
42+
}
43+
+
44+
+ // Perform validation
45+
+ token.Signature = parts[2]
46+
+ if err := token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
47+
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorSignatureInvalid}
48+
+ }
49+
50+
vErr := &ValidationError{}
51+
52+
// Validate Claims
53+
if !p.SkipClaimsValidation {
54+
if err := token.Claims.Valid(); err != nil {
55+
-
56+
// If the Claims Valid returned an error, check if it is a validation error,
57+
// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
58+
if e, ok := err.(*ValidationError); !ok {
59+
@@ -91,22 +104,18 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
60+
} else {
61+
vErr = e
62+
}
63+
+ return token, vErr
64+
}
65+
}
66+
67+
- // Perform validation
68+
- token.Signature = parts[2]
69+
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
70+
- vErr.Inner = err
71+
- vErr.Errors |= ValidationErrorSignatureInvalid
72+
- }
73+
-
74+
if vErr.valid() {
75+
token.Valid = true
76+
return token, nil
77+
}
78+
+ // No errors so far, token is valid.
79+
+ token.Valid = true
80+
81+
- return token, vErr
82+
+ return token, nil
83+
}
84+
85+
// ParseUnverified parses the token but doesn't validate the signature.
86+
--
87+
2.45.2
88+

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: 21%{?dist}
4+
Release: 22%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -35,6 +35,7 @@ Patch12: CVE-2025-27144.patch
3535
Patch13: CVE-2025-22868.patch
3636
Patch14: CVE-2025-22869.patch
3737
Patch15: CVE-2025-30204.patch
38+
Patch16: CVE-2024-51744.patch
3839

3940
BuildRequires: golang
4041
Requires: %{name}-acmesolver
@@ -128,6 +129,9 @@ install -D -m0755 bin/webhook %{buildroot}%{_bindir}/
128129
%{_bindir}/webhook
129130

130131
%changelog
132+
* Mon Mar 31 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 1.11.2-22
133+
- Fix CVE-2024-51744
134+
131135
* Fri Mar 28 2025 Kanishk Bansal <kanbansal@microsoft.com> - 1.11.2-21
132136
- Patch CVE-2025-30204
133137

0 commit comments

Comments
 (0)