fix(35): WR-03 treat data: in a site name as a data URL only with ; or ,

scriptURLText took data: followed by any non-space character as a data
URL, so names such as Data:Lab, Big Data:Summit and data:Science were
refused on the Branding form and dropped from mail, contrary to the docs.
A data URL now needs its optional MIME type and the ; or , every data URL
has. javascript: and vbscript: keep matching with whitespace after the
colon, since such a URL still runs.
This commit is contained in:
Jakub Zych
2026-11-14 17:40:13 +01:00
parent 31de2ff90f
commit 8deb56ff0b
6 changed files with 24 additions and 12 deletions

View File

@@ -292,6 +292,11 @@ func TestUnsafeText(t *testing.T) {
"Big Data: Summit",
"Metadata: Weekly",
"Metadata:Weekly",
// data: without a MIME type and ";" or "," is no data URL (WR-03).
"Data:Lab",
"Big Data:Summit",
"data:Science",
"Shop data:x",
"Data: Summit",
"Acme <Studio>",
"*Acme*",
@@ -313,7 +318,10 @@ func TestUnsafeText(t *testing.T) {
"JAVASCRIPT:x",
"Go vbscript:msgbox(1)",
"data:text/html,x",
"Shop data:x",
"data:,x",
"data:;base64,AAAA",
"Shop data:image/png;base64,AAAA",
"data: text/html,x",
} {
if !UnsafeText(s) {
t.Errorf("UnsafeText(%q) = false, want true", s)