Skip to content

Commit 3684214

Browse files
[AutoPR- Security] Patch telegraf for CVE-2026-5160 [MEDIUM] (#16757)
1 parent b470798 commit 3684214

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

SPECS/telegraf/CVE-2026-5160.patch

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
From 3898b6266943f5e1c4723ebab278674c2d70468d Mon Sep 17 00:00:00 2001
2+
From: yuin <yuin@inforno.net>
3+
Date: Thu, 19 Mar 2026 15:21:23 +0900
4+
Subject: [PATCH] fix: prevent XSS by escaping dangerous URLs in links and
5+
images
6+
7+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
8+
Upstream-reference: https://github.com/yuin/goldmark/commit/cb46bbc4eca29d55aa9721e04ad207c23ccc44f9.patch
9+
---
10+
.../yuin/goldmark/renderer/html/html.go | 16 ++++++++++------
11+
1 file changed, 10 insertions(+), 6 deletions(-)
12+
13+
diff --git a/vendor/github.com/yuin/goldmark/renderer/html/html.go b/vendor/github.com/yuin/goldmark/renderer/html/html.go
14+
index 8738c2a1..cfcd02ab 100644
15+
--- a/vendor/github.com/yuin/goldmark/renderer/html/html.go
16+
+++ b/vendor/github.com/yuin/goldmark/renderer/html/html.go
17+
@@ -558,12 +558,14 @@ func (r *Renderer) renderAutoLink(
18+
return ast.WalkContinue, nil
19+
}
20+
_, _ = w.WriteString(`<a href="`)
21+
- url := n.URL(source)
22+
+ url := util.URLEscape(n.URL(source), false)
23+
label := n.Label(source)
24+
if n.AutoLinkType == ast.AutoLinkEmail && !bytes.HasPrefix(bytes.ToLower(url), []byte("mailto:")) {
25+
_, _ = w.WriteString("mailto:")
26+
}
27+
- _, _ = w.Write(util.EscapeHTML(util.URLEscape(url, false)))
28+
+ if r.Unsafe || !IsDangerousURL(url) {
29+
+ _, _ = w.Write(util.EscapeHTML(url))
30+
+ }
31+
if n.Attributes() != nil {
32+
_ = w.WriteByte('"')
33+
RenderAttributes(w, n, LinkAttributeFilter)
34+
@@ -633,8 +635,9 @@ func (r *Renderer) renderLink(w util.BufWriter, source []byte, node ast.Node, en
35+
n := node.(*ast.Link)
36+
if entering {
37+
_, _ = w.WriteString("<a href=\"")
38+
- if r.Unsafe || !IsDangerousURL(n.Destination) {
39+
- _, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true)))
40+
+ dest := util.URLEscape(n.Destination, true)
41+
+ if r.Unsafe || !IsDangerousURL(dest) {
42+
+ _, _ = w.Write(util.EscapeHTML(dest))
43+
}
44+
_ = w.WriteByte('"')
45+
if n.Title != nil {
46+
@@ -676,8 +679,9 @@ func (r *Renderer) renderImage(w util.BufWriter, source []byte, node ast.Node, e
47+
}
48+
n := node.(*ast.Image)
49+
_, _ = w.WriteString("<img src=\"")
50+
- if r.Unsafe || !IsDangerousURL(n.Destination) {
51+
- _, _ = w.Write(util.EscapeHTML(util.URLEscape(n.Destination, true)))
52+
+ dest := util.URLEscape(n.Destination, true)
53+
+ if r.Unsafe || !IsDangerousURL(dest) {
54+
+ _, _ = w.Write(util.EscapeHTML(dest))
55+
}
56+
_, _ = w.WriteString(`" alt="`)
57+
_, _ = w.Write(nodeToHTMLText(n, source))
58+
--
59+
2.45.4
60+

SPECS/telegraf/telegraf.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: agent for collecting, processing, aggregating, and writing metrics.
22
Name: telegraf
33
Version: 1.31.0
4-
Release: 18%{?dist}
4+
Release: 19%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -37,6 +37,7 @@ Patch20: CVE-2026-4645.patch
3737
Patch21: cisco_telegraf_bug61041768.patch
3838
Patch22: CVE-2026-29785.patch
3939
Patch23: CVE-2026-33216.patch
40+
Patch24: CVE-2026-5160.patch
4041

4142
BuildRequires: golang
4243
BuildRequires: systemd-devel
@@ -101,6 +102,9 @@ fi
101102
%dir %{_sysconfdir}/%{name}/telegraf.d
102103

103104
%changelog
105+
* Mon Apr 20 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.31.0-19
106+
- Patch for CVE-2026-5160
107+
104108
* Thu Apr 02 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.31.0-18
105109
- Patch for CVE-2026-33216, CVE-2026-29785
106110

0 commit comments

Comments
 (0)