From a63b23ffb2eebc9ca3a14c369b615ca623bb20f7 Mon Sep 17 00:00:00 2001 From: Neal Patel Date: Mon, 27 Apr 2026 17:34:58 -0400 Subject: [PATCH] html/template: fix escaper bypass by treating empty script type as JavaScript Thank you to Mundur (https://github.com/M0nd0R) for reporting this issue. Fixes #78981 Fixes CVE-2026-39826 Change-Id: I3f2e06496020ece655d156fb099ff556af8cc836 Reviewed-on: https://go-review.googlesource.com/c/go/+/771180 Reviewed-by: Roland Shoemaker LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com --- src/html/template/escape_test.go | 15 +++++++++++++++ src/html/template/js.go | 1 + 2 files changed, 16 insertions(+) diff --git a/src/html/template/escape_test.go b/src/html/template/escape_test.go index a39d696c42..aef5e01957 100644 --- a/src/html/template/escape_test.go +++ b/src/html/template/escape_test.go @@ -232,6 +232,21 @@ func TestEscape(t *testing.T) { "", ``, }, + { + "scriptTypeSpace", + "", + "", + }, + { + "scriptTypeTab", + "", + "", + }, + { + "scriptTypeEmpty", + "", + "", + }, { "jsObjValueNotOverEscaped", "