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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user