diff options
| -rw-r--r-- | meta/recipes-devtools/go/go-1.17.13.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/go/go-1.18/CVE-2023-29400.patch | 99 |
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 | " |
| 39 | SRC_URI[main.sha256sum] = "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd" | 40 | SRC_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 @@ | |||
| 1 | From 9db0e74f606b8afb28cc71d4b1c8b4ed24cabbf5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Roland Shoemaker <bracewell@google.com> | ||
| 3 | Date: Thu, 13 Apr 2023 14:01:50 -0700 | ||
| 4 | Subject: [PATCH] [release-branch.go1.19] html/template: emit filterFailsafe | ||
| 5 | for empty unquoted attr value | ||
| 6 | |||
| 7 | An unquoted action used as an attribute value can result in unsafe | ||
| 8 | behavior if it is empty, as HTML normalization will result in unexpected | ||
| 9 | attributes, and may allow attribute injection. If executing a template | ||
| 10 | results in a empty unquoted attribute value, emit filterFailsafe | ||
| 11 | instead. | ||
| 12 | |||
| 13 | Thanks to Juho Nurminen of Mattermost for reporting this issue. | ||
| 14 | |||
| 15 | For #59722 | ||
| 16 | Fixes #59815 | ||
| 17 | Fixes CVE-2023-29400 | ||
| 18 | |||
| 19 | Change-Id: Ia38d1b536ae2b4af5323a6c6d861e3c057c2570a | ||
| 20 | Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1826631 | ||
| 21 | Reviewed-by: Julie Qiu <julieqiu@google.com> | ||
| 22 | Run-TryBot: Roland Shoemaker <bracewell@google.com> | ||
| 23 | Reviewed-by: Damien Neil <dneil@google.com> | ||
| 24 | Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1851498 | ||
| 25 | Reviewed-by: Roland Shoemaker <bracewell@google.com> | ||
| 26 | Run-TryBot: Damien Neil <dneil@google.com> | ||
| 27 | Reviewed-on: https://go-review.googlesource.com/c/go/+/491357 | ||
| 28 | Run-TryBot: Carlos Amedee <carlos@golang.org> | ||
| 29 | TryBot-Result: Gopher Robot <gobot@golang.org> | ||
| 30 | Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> | ||
| 31 | |||
| 32 | Upstream-Status: Backport [https://github.com/golang/go/commit/9db0e74f606b8afb28cc71d4b1c8b4ed24cabbf5] | ||
| 33 | CVE: CVE-2023-29400 | ||
| 34 | Signed-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 | |||
| 41 | diff --git a/src/html/template/escape.go b/src/html/template/escape.go | ||
| 42 | index 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, | ||
| 57 | diff --git a/src/html/template/escape_test.go b/src/html/template/escape_test.go | ||
| 58 | index 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 { | ||
| 83 | diff --git a/src/html/template/html.go b/src/html/template/html.go | ||
| 84 | index 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 | -- | ||
| 98 | 2.25.1 | ||
| 99 | |||
