Skip to content

Commit a3ae661

Browse files
[AUTO-CHERRYPICK] Patch keda for CVE-2025-22872 [Medium] - branch 3.0-dev (#13595)
Co-authored-by: Kanishk Bansal <103916909+Kanishk-Bansal@users.noreply.github.com>
1 parent 339d8c2 commit a3ae661

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

SPECS/keda/CVE-2025-22872.patch

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From a8476aabe877b168950f4c9a0b68d2e784e621ad Mon Sep 17 00:00:00 2001
2+
From: Kanishk-Bansal <kbkanishk975@gmail.com>
3+
Date: Fri, 25 Apr 2025 08:16:15 +0000
4+
Subject: [PATCH] Address CVE-2025-22872
5+
6+
Upstream Reference Link : https://github.com/golang/net/commit/e1fcd82abba34df74614020343be8eb1fe85f0d9.patch
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.2
42+

SPECS/keda/keda.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Kubernetes-based Event Driven Autoscaling
22
Name: keda
33
Version: 2.14.1
4-
Release: 6%{?dist}
4+
Release: 7%{?dist}
55
License: ASL 2.0
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -31,6 +31,7 @@ Patch5: CVE-2025-30204.patch
3131
Patch6: CVE-2025-29923.patch
3232
Patch7: CVE-2025-22870.patch
3333
Patch8: CVE-2024-51744.patch
34+
Patch9: CVE-2025-22872.patch
3435
BuildRequires: golang >= 1.15
3536

3637
%description
@@ -66,6 +67,9 @@ cp ./bin/keda-admission-webhooks %{buildroot}%{_bindir}
6667
%{_bindir}/%{name}-admission-webhooks
6768

6869
%changelog
70+
* Fri Apr 25 2025 Kanishk Bansal <kanbansal@microsoft.com> - 2.14.1-7
71+
- Patch CVE-2025-22872
72+
6973
* Thu Apr 17 2025 Sudipta Pandit <sudpandit@microsoft.com> - 2.14.1-6
7074
- Fixes an incorrect patch introduced with the patch for CVE-2025-29923
7175
- Fixes patches being overridden during the build step

0 commit comments

Comments
 (0)