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

@@ -87,7 +87,7 @@ func TestMailSiteNameSafety(t *testing.T) {
t.Run("prose_names_saved", func(t *testing.T) {
// Text shaped like an event handler is text, also after the footer's
// "© <year> " (CR-01 residual, WR-02).
for _, name := range []string{"Big Data: Summit", "Metadata: Weekly", "Online=Shop", "onboarding=team"} {
for _, name := range []string{"Big Data: Summit", "Metadata: Weekly", "Online=Shop", "onboarding=team", "Data:Lab", "Big Data:Summit"} {
saved := env.expect(t, http.StatusOK, http.MethodPut, mailBrandPath, root, map[string]any{"site_name": name})
if got := dataOf(saved)["data"].(map[string]any)["site_name"]; got != name {
t.Errorf("response site_name = %#v, want %q", got, name)