Skip to content

Commit 54ddc3d

Browse files
[AUTO-CHERRYPICK] Fix CVE-2022-32149 in prometheus-adapter - branch main (#10338)
Co-authored-by: sindhu-karri <33163197+sindhu-karri@users.noreply.github.com>
1 parent 2cf83ec commit 54ddc3d

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 7ee36713a66401f828dfe476196ca290f7c23ffe Mon Sep 17 00:00:00 2001
2+
From: Sindhu Karri <lakarri@microsoft.com>
3+
Date: Wed, 28 Aug 2024 05:01:17 +0000
4+
Subject: [PATCH] Fix CVE-2022-32149
5+
6+
---
7+
vendor/golang.org/x/text/language/parse.go | 5 +++++
8+
1 file changed, 5 insertions(+)
9+
10+
diff --git a/vendor/golang.org/x/text/language/parse.go b/vendor/golang.org/x/text/language/parse.go
11+
index 11acfd8..11d11f4 100644
12+
--- a/vendor/golang.org/x/text/language/parse.go
13+
+++ b/vendor/golang.org/x/text/language/parse.go
14+
@@ -133,6 +133,7 @@ func update(b *language.Builder, part ...interface{}) (err error) {
15+
}
16+
17+
var errInvalidWeight = errors.New("ParseAcceptLanguage: invalid weight")
18+
+var errTagListTooLarge = errors.New("tag list exceeds max length")
19+
20+
// ParseAcceptLanguage parses the contents of an Accept-Language header as
21+
// defined in http://www.ietf.org/rfc/rfc2616.txt and returns a list of Tags and
22+
@@ -150,6 +151,10 @@ func ParseAcceptLanguage(s string) (tag []Tag, q []float32, err error) {
23+
24+
entry, weight := split(entry, ';')
25+
26+
+ if strings.Count(s, "-") > 1000 {
27+
+ return nil, nil, errTagListTooLarge
28+
+ }
29+
+
30+
// Scan the language.
31+
t, err := Parse(entry)
32+
if err != nil {
33+
--
34+
2.33.8
35+

SPECS/prometheus-adapter/prometheus-adapter.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Summary: Kubernetes Custom, Resource, and External Metric APIs implemented to work with Prometheus.
22
Name: prometheus-adapter
33
Version: 0.10.0
4-
Release: 13%{?dist}
4+
Release: 14%{?dist}
55
License: Apache-2.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
URL: https://github.com/kubernetes-sigs/prometheus-adapter
99
Source0: https://github.com/kubernetes-sigs/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
1010
Patch0: CVE-2024-24786.patch
11+
Patch1: CVE-2022-32149.patch
1112
BuildRequires: golang
1213

1314
%description
@@ -42,6 +43,9 @@ make test
4243
%doc README.md RELEASE.md
4344

4445
%changelog
46+
* Fri Aug 30 2024 Sindhu Karri <lakarri@microsoft.com> - 0.10.0-14
47+
- Fix CVE-2022-32149 in golang.org/x/text
48+
4549
* Thu Jun 06 2024 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 0.10.0-13
4650
- Bump release to rebuild with go 1.21.11
4751

@@ -81,4 +85,4 @@ make test
8185

8286
* Wed Feb 15 2023 Osama Esmail <osamaesmail@microsoft.com> - 0.10.0-1
8387
- Original version for CBL-Mariner
84-
- License verified.
88+
- License verified.

0 commit comments

Comments
 (0)