Skip to content

Commit 1e18b57

Browse files
[AutoPR- Security] Patch gh for CVE-2026-5160 [MEDIUM] (#16756)
1 parent 4c95610 commit 1e18b57

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

SPECS/gh/CVE-2026-5160.patch

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
From d4695cce7a4de71d63de06829674fffb6551142c 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 7bf2ab8..616b005 100644
15+
--- a/vendor/github.com/yuin/goldmark/renderer/html/html.go
16+
+++ b/vendor/github.com/yuin/goldmark/renderer/html/html.go
17+
@@ -479,12 +479,14 @@ func (r *Renderer) renderAutoLink(w util.BufWriter, source []byte, node ast.Node
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+
@@ -553,8 +555,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+
@@ -596,8 +599,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/gh/gh.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: GitHub official command line tool
22
Name: gh
33
Version: 2.62.0
4-
Release: 14%{?dist}
4+
Release: 15%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -31,6 +31,7 @@ Patch15: CVE-2025-47911.patch
3131
Patch16: CVE-2025-58190.patch
3232
Patch17: CVE-2026-24117.patch
3333
Patch18: CVE-2026-32288.patch
34+
Patch19: CVE-2026-5160.patch
3435

3536
BuildRequires: golang < 1.24
3637
BuildRequires: git
@@ -75,6 +76,9 @@ make test
7576
%{_datadir}/zsh/site-functions/_gh
7677

7778
%changelog
79+
* Mon Apr 20 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 2.62.0-15
80+
- Patch for CVE-2026-5160
81+
7882
* Wed Apr 15 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 2.62.0-14
7983
- Patch for CVE-2026-32288
8084

0 commit comments

Comments
 (0)