Skip to content

Commit f81b52e

Browse files
authored
[MEDIUM] Patch dasel for CVE-2024-45338 & CVE-2025-22872 (#14091)
1 parent c70b1a3 commit f81b52e

3 files changed

Lines changed: 113 additions & 2 deletions

File tree

SPECS/dasel/CVE-2024-45338.patch

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From f5b552163cea9d792f8bdecb2bc5693891442be6 Mon Sep 17 00:00:00 2001
2+
From: archana25-ms <v-shettigara@microsoft.com>
3+
Date: Tue, 24 Jun 2025 12:26:02 +0000
4+
Subject: [PATCH] Address CVE-2024-45338
5+
Upstream Patch Reference: https://github.com/golang/net/commit/8e66b04771e35c4e4125e8c60334b34e2423effb
6+
7+
---
8+
vendor/golang.org/x/net/html/doctype.go | 2 +-
9+
vendor/golang.org/x/net/html/foreign.go | 3 +--
10+
vendor/golang.org/x/net/html/parse.go | 4 ++--
11+
3 files changed, 4 insertions(+), 5 deletions(-)
12+
13+
diff --git a/vendor/golang.org/x/net/html/doctype.go b/vendor/golang.org/x/net/html/doctype.go
14+
index c484e5a..bca3ae9 100644
15+
--- a/vendor/golang.org/x/net/html/doctype.go
16+
+++ b/vendor/golang.org/x/net/html/doctype.go
17+
@@ -87,7 +87,7 @@ func parseDoctype(s string) (n *Node, quirks bool) {
18+
}
19+
}
20+
if lastAttr := n.Attr[len(n.Attr)-1]; lastAttr.Key == "system" &&
21+
- strings.ToLower(lastAttr.Val) == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd" {
22+
+ strings.EqualFold(lastAttr.Val, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
23+
quirks = true
24+
}
25+
}
26+
diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go
27+
index 9da9e9d..e8515d8 100644
28+
--- a/vendor/golang.org/x/net/html/foreign.go
29+
+++ b/vendor/golang.org/x/net/html/foreign.go
30+
@@ -40,8 +40,7 @@ func htmlIntegrationPoint(n *Node) bool {
31+
if n.Data == "annotation-xml" {
32+
for _, a := range n.Attr {
33+
if a.Key == "encoding" {
34+
- val := strings.ToLower(a.Val)
35+
- if val == "text/html" || val == "application/xhtml+xml" {
36+
+ if strings.EqualFold(a.Val, "text/html") || strings.EqualFold(a.Val, "application/xhtml+xml") {
37+
return true
38+
}
39+
}
40+
diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go
41+
index 46a89ed..5b8374b 100644
42+
--- a/vendor/golang.org/x/net/html/parse.go
43+
+++ b/vendor/golang.org/x/net/html/parse.go
44+
@@ -1031,7 +1031,7 @@ func inBodyIM(p *parser) bool {
45+
if p.tok.DataAtom == a.Input {
46+
for _, t := range p.tok.Attr {
47+
if t.Key == "type" {
48+
- if strings.ToLower(t.Val) == "hidden" {
49+
+ if strings.EqualFold(t.Val, "hidden") {
50+
// Skip setting framesetOK = false
51+
return true
52+
}
53+
@@ -1459,7 +1459,7 @@ func inTableIM(p *parser) bool {
54+
return inHeadIM(p)
55+
case a.Input:
56+
for _, t := range p.tok.Attr {
57+
- if t.Key == "type" && strings.ToLower(t.Val) == "hidden" {
58+
+ if t.Key == "type" && strings.EqualFold(t.Val, "hidden") {
59+
p.addElement()
60+
p.oe.pop()
61+
return true
62+
--
63+
2.45.3
64+

SPECS/dasel/CVE-2025-22872.patch

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From df9962d449d529e4fb36db406acdbff44d894d5d Mon Sep 17 00:00:00 2001
2+
From: archana25-ms <v-shettigara@microsoft.com>
3+
Date: Tue, 24 Jun 2025 12:27:01 +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/dasel/dasel.spec

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
Summary: Dasel (short for data-selector) allows you to query and modify data structures using selector strings. Comparable to jq, yq, and xmlstarlet, but for any data format.
22
Name: dasel
33
Version: 2.8.1
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
88
Group: Applications/System
99
URL: https://github.com/TomWright/dasel
1010
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
1111
Source1: %{name}-%{version}-govendor-v1.tar.gz
12+
Patch1: CVE-2024-45338.patch
13+
Patch2: CVE-2025-22872.patch
1214
BuildRequires: golang >= 1.22
1315

1416
%description
@@ -42,7 +44,10 @@ go test ./...
4244
%{_bindir}/dasel
4345

4446
%changelog
45-
* Tue June 17 2025 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 2.8.1-1
47+
* Tue Jun 24 2025 Archana Shettigar <v-shettigara@microsoft.com> - 2.8.1-2
48+
- Patch CVE-2024-45338 & CVE-2025-22872
49+
50+
* Tue Jun 17 2025 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 2.8.1-1
4651
- Original version for Azure Linux (license: MIT)
4752
- License verified
4853

0 commit comments

Comments
 (0)