Skip to content

Commit 900820e

Browse files
committed
Merge branch 'main' into 2.0
2 parents 5d1d799 + b3f3558 commit 900820e

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

SPECS/jx/CVE-2024-51744.patch

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
From 68de34ae9ace1867680141ae1a3cdd9e9cab9a76 Mon Sep 17 00:00:00 2001
2+
From: jykanase <[email protected]>
3+
Date: Thu, 20 Mar 2025 04:11:52 +0000
4+
Subject: [PATCH] CVE-2024-51744
5+
6+
Source Link: https://github.com/golang-jwt/jwt/commit/7b1c1c00a171c6c79bbdb40e4ce7d197060c1c2c
7+
---
8+
.../github.com/form3tech-oss/jwt-go/parser.go | 37 +++++++++++--------
9+
1 file changed, 21 insertions(+), 16 deletions(-)
10+
11+
diff --git a/vendor/github.com/form3tech-oss/jwt-go/parser.go b/vendor/github.com/form3tech-oss/jwt-go/parser.go
12+
index d6901d9..9fddb7d 100644
13+
--- a/vendor/github.com/form3tech-oss/jwt-go/parser.go
14+
+++ b/vendor/github.com/form3tech-oss/jwt-go/parser.go
15+
@@ -13,13 +13,21 @@ type Parser struct {
16+
SkipClaimsValidation bool // Skip claims validation during token parsing
17+
}
18+
19+
-// Parse, validate, and return a token.
20+
-// keyFunc will receive the parsed token and should return the key for validating.
21+
-// If everything is kosher, err will be nil
22+
+// Parse parses, validates, verifies the signature and returns the parsed token. keyFunc will
23+
+// receive the parsed token and should return the key for validating.
24+
func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
25+
return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
26+
}
27+
28+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object
29+
+// implementing the Claims interface. This provides default values which can be overridden and
30+
+// allows a caller to use their own type, rather than the default MapClaims implementation of
31+
+// Claims.
32+
+//
33+
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such
34+
+// as RegisteredClaims), make sure that a) you either embed a non-pointer version of the claims or
35+
+// b) if you are using a pointer, allocate the proper memory for it before passing in the overall
36+
+// claims, otherwise you might run into a panic.
37+
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
38+
token, parts, err := p.ParseUnverified(tokenString, claims)
39+
if err != nil {
40+
@@ -56,12 +64,17 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
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+
@@ -69,22 +82,14 @@ 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+
// WARNING: Don't use this method unless you know what you're doing
86+
--
87+
2.45.2
88+

SPECS/jx/jx.spec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Command line tool for working with Jenkins X.
22
Name: jx
33
Version: 3.2.236
4-
Release: 20%{?dist}
4+
Release: 21%{?dist}
55
License: Apache-2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -30,7 +30,7 @@ Source1: %{name}-%{version}-vendor.tar.gz
3030
Patch0: CVE-2023-44487.patch
3131
Patch1: CVE-2021-44716.patch
3232
Patch2: CVE-2023-45288.patch
33-
33+
Patch3: CVE-2024-51744.patch
3434
BuildRequires: golang
3535
%global debug_package %{nil}
3636
%define our_gopath %{_topdir}/.gopath
@@ -72,6 +72,9 @@ make test && \
7272
%{_bindir}/jx
7373

7474
%changelog
75+
* Thur Mar 20 2025 Jyoti Kanase <[email protected]> - 3.2.236-21
76+
- Fix CVE-2024-51744
77+
7578
* Mon Sep 09 2024 CBL-Mariner Servicing Account <[email protected]> - 3.2.236-20
7679
- Bump release to rebuild with go 1.22.7
7780

0 commit comments

Comments
 (0)