fix(35): CR-01 check the site name where the layouts print it

UnsafeText checked the escaped name on its own, so a name starting with
on<letters>= (Online=Shop, onboarding=team) passed, was saved, and then
failed every default/system-layout send once the footer printed it after
"© <year> ". The name is now checked in the footer, header span and alt
contexts, so such a name is dropped at render and refused on the Branding
form instead of stopping mail.
This commit is contained in:
Jakub Zych
2026-11-14 17:25:53 +01:00
parent 980ba48764
commit 2dbee30530
5 changed files with 67 additions and 20 deletions

View File

@@ -82,6 +82,15 @@ func TestMailSiteNameSafety(t *testing.T) {
if got := storedSiteName(t, env); got != "Acme Mail" {
t.Fatalf("the refused pl save stored site_name %q", got)
}
// A name unsafe only where the layouts print it, after the footer's
// "© <year> ", is refused as well (CR-01 residual).
for _, name := range []string{"Online=Shop", "onboarding=team"} {
env.expectFieldRefusal(t, http.StatusUnprocessableEntity, http.MethodPut, mailBrandPath, root, map[string]any{"site_name": name}, "site_name", "cannot be shown in mail", false)
if got := storedSiteName(t, env); got != "Acme Mail" {
t.Fatalf("the refused save of %q stored site_name %q", name, got)
}
}
})
t.Run("prose_names_saved", func(t *testing.T) {