Skip to content

Commit 8a29e28

Browse files
authored
[MEDIUM] Patch prometheus-adapter for CVE-2025-22872 (#13534)
1 parent a924b8a commit 8a29e28

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From c87c77a12e5554d376945bd488e56d4fc5b9e5ac Mon Sep 17 00:00:00 2001
2+
From: archana25-ms <[email protected]>
3+
Date: Tue, 22 Apr 2025 06:32:35 +0000
4+
Subject: [PATCH] Address CVE-2025-22872
5+
Upstream Patch Reference: https://github.com/golang/net/commit/e1fcd82abba34df74614020343be8eb1fe85f0d9
6+
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 3c57880..6598c1f 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.45.3
42+

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.12.0
4-
Release: 2%{?dist}
4+
Release: 3%{?dist}
55
License: Apache-2.0
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
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-45338.patch
11+
Patch1: CVE-2025-22872.patch
1112
BuildRequires: golang
1213

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

4445
%changelog
46+
* Tue Apr 22 2025 Archana Shettigar <[email protected]> - 0.12.0-3
47+
- Patch CVE-2025-22872
48+
4549
* Tue Dec 31 2024 Rohit Rawat <[email protected]> - 0.12.0-2
4650
- Patch CVE-2024-45338
4751

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

8286
* Wed Feb 15 2023 Osama Esmail <[email protected]> - 0.10.0-1
8387
- Original version for CBL-Mariner
84-
- License verified.
88+
- License verified.

0 commit comments

Comments
 (0)