summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/go/go-1.17.13.inc1
-rw-r--r--meta/recipes-devtools/go/go-1.18/CVE-2023-29400.patch99
2 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.17.13.inc b/meta/recipes-devtools/go/go-1.17.13.inc
index 3365075fe5..73921852fc 100644
--- a/meta/recipes-devtools/go/go-1.17.13.inc
+++ b/meta/recipes-devtools/go/go-1.17.13.inc
@@ -35,6 +35,7 @@ SRC_URI += "\
35 file://CVE-2023-29404.patch \ 35 file://CVE-2023-29404.patch \
36 file://CVE-2023-29405.patch \ 36 file://CVE-2023-29405.patch \
37 file://CVE-2023-29402.patch \ 37 file://CVE-2023-29402.patch \
38 file://CVE-2023-29400.patch \
38" 39"
39SRC_URI[main.sha256sum] = "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd" 40SRC_URI[main.sha256sum] = "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd"
40 41
diff --git a/meta/recipes-devtools/go/go-1.18/CVE-2023-29400.patch b/meta/recipes-devtools/go/go-1.18/CVE-2023-29400.patch
new file mode 100644
index 0000000000..04bd1f5fec
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.18/CVE-2023-29400.patch
@@ -0,0 +1,99 @@
1From 9db0e74f606b8afb28cc71d4b1c8b4ed24cabbf5 Mon Sep 17 00:00:00 2001
2From: Roland Shoemaker <bracewell@google.com>
3Date: Thu, 13 Apr 2023 14:01:50 -0700
4Subject: [PATCH] [release-branch.go1.19] html/template: emit filterFailsafe
5 for empty unquoted attr value
6
7An unquoted action used as an attribute value can result in unsafe
8behavior if it is empty, as HTML normalization will result in unexpected
9attributes, and may allow attribute injection. If executing a template
10results in a empty unquoted attribute value, emit filterFailsafe
11instead.
12
13Thanks to Juho Nurminen of Mattermost for reporting this issue.
14
15For #59722
16Fixes #59815
17Fixes CVE-2023-29400
18
19Change-Id: Ia38d1b536ae2b4af5323a6c6d861e3c057c2570a
20Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1826631
21Reviewed-by: Julie Qiu <julieqiu@google.com>
22Run-TryBot: Roland Shoemaker <bracewell@google.com>
23Reviewed-by: Damien Neil <dneil@google.com>
24Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1851498
25Reviewed-by: Roland Shoemaker <bracewell@google.com>
26Run-TryBot: Damien Neil <dneil@google.com>
27Reviewed-on: https://go-review.googlesource.com/c/go/+/491357
28Run-TryBot: Carlos Amedee <carlos@golang.org>
29TryBot-Result: Gopher Robot <gobot@golang.org>
30Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
31
32Upstream-Status: Backport [https://github.com/golang/go/commit/9db0e74f606b8afb28cc71d4b1c8b4ed24cabbf5]
33CVE: CVE-2023-29400
34Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
35---
36 src/html/template/escape.go | 5 ++---
37 src/html/template/escape_test.go | 15 +++++++++++++++
38 src/html/template/html.go | 3 +++
39 3 files changed, 20 insertions(+), 3 deletions(-)
40
41diff --git a/src/html/template/escape.go b/src/html/template/escape.go
42index ca078f4..bdccc65 100644
43--- a/src/html/template/escape.go
44+++ b/src/html/template/escape.go
45@@ -362,9 +362,8 @@ func normalizeEscFn(e string) string {
46 // for all x.
47 var redundantFuncs = map[string]map[string]bool{
48 "_html_template_commentescaper": {
49- "_html_template_attrescaper": true,
50- "_html_template_nospaceescaper": true,
51- "_html_template_htmlescaper": true,
52+ "_html_template_attrescaper": true,
53+ "_html_template_htmlescaper": true,
54 },
55 "_html_template_cssescaper": {
56 "_html_template_attrescaper": true,
57diff --git a/src/html/template/escape_test.go b/src/html/template/escape_test.go
58index fbc84a7..4f48afe 100644
59--- a/src/html/template/escape_test.go
60+++ b/src/html/template/escape_test.go
61@@ -678,6 +678,21 @@ func TestEscape(t *testing.T) {
62 `<img srcset={{",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"}}>`,
63 `<img srcset=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>`,
64 },
65+ {
66+ "unquoted empty attribute value (plaintext)",
67+ "<p name={{.U}}>",
68+ "<p name=ZgotmplZ>",
69+ },
70+ {
71+ "unquoted empty attribute value (url)",
72+ "<p href={{.U}}>",
73+ "<p href=ZgotmplZ>",
74+ },
75+ {
76+ "quoted empty attribute value",
77+ "<p name=\"{{.U}}\">",
78+ "<p name=\"\">",
79+ },
80 }
81
82 for _, test := range tests {
83diff --git a/src/html/template/html.go b/src/html/template/html.go
84index 356b829..636bc21 100644
85--- a/src/html/template/html.go
86+++ b/src/html/template/html.go
87@@ -14,6 +14,9 @@ import (
88 // htmlNospaceEscaper escapes for inclusion in unquoted attribute values.
89 func htmlNospaceEscaper(args ...interface{}) string {
90 s, t := stringify(args...)
91+ if s == "" {
92+ return filterFailsafe
93+ }
94 if t == contentTypeHTML {
95 return htmlReplacer(stripTags(s), htmlNospaceNormReplacementTable, false)
96 }
97--
982.25.1
99