Skip to content

Commit 877ff01

Browse files
[AUTO-CHERRYPICK] [Medium] Patch influxdb for CVE-2025-22870 and CVE-2024-51744 - branch main (#13152)
Co-authored-by: Sreenivasulu Malavathula (HCL Technologies Ltd) <v-smalavathu@microsoft.com>
1 parent 6f5f1ed commit 877ff01

3 files changed

Lines changed: 214 additions & 1 deletion

File tree

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
From 78ef06fbde145deea5303f193b795f173db4c4a3 Mon Sep 17 00:00:00 2001
2+
From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
3+
Date: Tue, 18 Mar 2025 14:56:14 -0500
4+
Subject: [PATCH] Address CVE-2024-51744
5+
6+
---
7+
.../github.com/form3tech-oss/jwt-go/parser.go | 36 +++++++++++--------
8+
vendor/github.com/golang-jwt/jwt/parser.go | 36 +++++++++++--------
9+
2 files changed, 42 insertions(+), 30 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..bfb480c 100644
13+
--- a/vendor/github.com/form3tech-oss/jwt-go/parser.go
14+
+++ b/vendor/github.com/form3tech-oss/jwt-go/parser.go
15+
@@ -14,12 +14,21 @@ type Parser struct {
16+
}
17+
18+
// Parse, validate, and return a token.
19+
-// keyFunc will receive the parsed token and should return the key for validating.
20+
-// If everything is kosher, err will be nil
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+
@@ -56,12 +65,17 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
40+
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
41+
}
42+
43+
+ // Perform validation
44+
+ token.Signature = parts[2]
45+
+ if err := token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
46+
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorSignatureInvalid}
47+
+ }
48+
+
49+
vErr := &ValidationError{}
50+
51+
// Validate Claims
52+
if !p.SkipClaimsValidation {
53+
if err := token.Claims.Valid(); err != nil {
54+
-
55+
// If the Claims Valid returned an error, check if it is a validation error,
56+
// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
57+
if e, ok := err.(*ValidationError); !ok {
58+
@@ -69,22 +83,14 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
59+
} else {
60+
vErr = e
61+
}
62+
+ return token, vErr
63+
}
64+
}
65+
66+
- // Perform validation
67+
- token.Signature = parts[2]
68+
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
69+
- vErr.Inner = err
70+
- vErr.Errors |= ValidationErrorSignatureInvalid
71+
- }
72+
-
73+
- if vErr.valid() {
74+
- token.Valid = true
75+
- return token, nil
76+
- }
77+
+ // No errors so far, token is valid.
78+
+ token.Valid = true
79+
80+
- return token, vErr
81+
+ return token, nil
82+
}
83+
84+
// WARNING: Don't use this method unless you know what you're doing
85+
diff --git a/vendor/github.com/golang-jwt/jwt/parser.go b/vendor/github.com/golang-jwt/jwt/parser.go
86+
index d6901d9..bfb480c 100644
87+
--- a/vendor/github.com/golang-jwt/jwt/parser.go
88+
+++ b/vendor/github.com/golang-jwt/jwt/parser.go
89+
@@ -14,12 +14,21 @@ type Parser struct {
90+
}
91+
92+
// Parse, validate, and return a token.
93+
-// keyFunc will receive the parsed token and should return the key for validating.
94+
-// If everything is kosher, err will be nil
95+
+// Parse parses, validates, verifies the signature and returns the parsed token. keyFunc will
96+
+// receive the parsed token and should return the key for validating.
97+
func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
98+
return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
99+
}
100+
101+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object
102+
+// implementing the Claims interface. This provides default values which can be overridden and
103+
+// allows a caller to use their own type, rather than the default MapClaims implementation of
104+
+// Claims.
105+
+//
106+
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such
107+
+// as RegisteredClaims), make sure that a) you either embed a non-pointer version of the claims or
108+
+// b) if you are using a pointer, allocate the proper memory for it before passing in the overall
109+
+// claims, otherwise you might run into a panic.
110+
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
111+
token, parts, err := p.ParseUnverified(tokenString, claims)
112+
if err != nil {
113+
@@ -56,12 +65,17 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
114+
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
115+
}
116+
117+
+ // Perform validation
118+
+ token.Signature = parts[2]
119+
+ if err := token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
120+
+ return token, &ValidationError{Inner: err, Errors: ValidationErrorSignatureInvalid}
121+
+ }
122+
+
123+
vErr := &ValidationError{}
124+
125+
// Validate Claims
126+
if !p.SkipClaimsValidation {
127+
if err := token.Claims.Valid(); err != nil {
128+
-
129+
// If the Claims Valid returned an error, check if it is a validation error,
130+
// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
131+
if e, ok := err.(*ValidationError); !ok {
132+
@@ -69,22 +83,14 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
133+
} else {
134+
vErr = e
135+
}
136+
+ return token, vErr
137+
}
138+
}
139+
140+
- // Perform validation
141+
- token.Signature = parts[2]
142+
- if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
143+
- vErr.Inner = err
144+
- vErr.Errors |= ValidationErrorSignatureInvalid
145+
- }
146+
-
147+
- if vErr.valid() {
148+
- token.Valid = true
149+
- return token, nil
150+
- }
151+
+ // No errors so far, token is valid.
152+
+ token.Valid = true
153+
154+
- return token, vErr
155+
+ return token, nil
156+
}
157+
158+
// WARNING: Don't use this method unless you know what you're doing
159+
--
160+
2.45.2
161+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 828e979c77d6a1702ad07e4c2d2afd4e887b69fd Mon Sep 17 00:00:00 2001
2+
From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com>
3+
Date: Tue, 18 Mar 2025 14:36:41 -0500
4+
Subject: [PATCH] Address CVE-2025-22870
5+
6+
---
7+
vendor/golang.org/x/net/http/httpproxy/proxy.go | 10 ++++++++--
8+
1 file changed, 8 insertions(+), 2 deletions(-)
9+
10+
diff --git a/vendor/golang.org/x/net/http/httpproxy/proxy.go b/vendor/golang.org/x/net/http/httpproxy/proxy.go
11+
index 16994ac..0ce4f6b 100644
12+
--- a/vendor/golang.org/x/net/http/httpproxy/proxy.go
13+
+++ b/vendor/golang.org/x/net/http/httpproxy/proxy.go
14+
@@ -14,6 +14,7 @@ import (
15+
"errors"
16+
"fmt"
17+
"net"
18+
+ "net/netip"
19+
"net/url"
20+
"os"
21+
"strings"
22+
@@ -181,8 +182,10 @@ func (cfg *config) useProxy(addr string) bool {
23+
if host == "localhost" {
24+
return false
25+
}
26+
- ip := net.ParseIP(host)
27+
- if ip != nil {
28+
+ nip, err := netip.ParseAddr(host)
29+
+ var ip net.IP
30+
+ if err == nil {
31+
+ ip = net.IP(nip.AsSlice())
32+
if ip.IsLoopback() {
33+
return false
34+
}
35+
@@ -364,6 +367,9 @@ type domainMatch struct {
36+
}
37+
38+
func (m domainMatch) match(host, port string, ip net.IP) bool {
39+
+ if ip != nil {
40+
+ return false
41+
+ }
42+
if strings.HasSuffix(host, m.host) || (m.matchHost && host == m.host[1:]) {
43+
return m.port == "" || m.port == port
44+
}
45+
--
46+
2.45.2
47+

SPECS/influxdb/influxdb.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Summary: Scalable datastore for metrics, events, and real-time analytics
1919
Name: influxdb
2020
Version: 2.6.1
21-
Release: 21%{?dist}
21+
Release: 22%{?dist}
2222
License: MIT
2323
Vendor: Microsoft Corporation
2424
Distribution: Mariner
@@ -61,6 +61,8 @@ Patch2: CVE-2024-24786.patch
6161
Patch3: CVE-2024-45338.patch
6262
Patch4: CVE-2024-28180.patch
6363
Patch5: CVE-2025-27144.patch
64+
Patch6: CVE-2025-22870.patch
65+
Patch7: CVE-2024-51744.patch
6466
BuildRequires: clang
6567
BuildRequires: golang <= 1.18.8
6668
BuildRequires: kernel-headers
@@ -150,6 +152,9 @@ go test ./...
150152
%{_tmpfilesdir}/influxdb.conf
151153

152154
%changelog
155+
* Tue Mar 18 2025 Sreeniavsulu Malavathula <v-smalavathu@microsoft.com> - 2.6.1-22
156+
- Fix CVE-2025-22870, CVE-2024-51744 with an upstream patch
157+
153158
* Fri Feb 28 2025 Kanishk Bansal <kanbansal@microsoft.com> - 2.6.1-21
154159
- Fix CVE-2025-27144 with an upstream patch
155160

0 commit comments

Comments
 (0)