fix(postcard,cabana): unsafe site names never stop a send and are refused at save

- postcard.UnsafeText: a text a layout prints is unsafe when, escaped,
  it fails the rendered-HTML checks or holds a script or data URL at a
  scheme boundary ("Big Data: Summit" is safe)
- siteNameFrom/layoutSiteName: an unsafe Branding name falls back to the
  mail.from display name, an unsafe one of those gives no name; one
  rate-limited warning per source (site_name:branding, site_name:mail.from),
  never the value; file version, override, fallback and editor alike
- the Branding preview of an unsafe draft name renders without it
- MailBrandSetting.BeforeValidate: 422 on site_name with
  backend::lang.mail.brand.site_name_unsafe (en/pl)
- settings Put localizes a BeforeValidate refusal's phrase keys, as a
  controller save does
- TestMailSafetySmoke/unsafe_site_name, TestMailBrandSiteName/unsafe_name_refused
This commit is contained in:
Jakub Zych
2026-11-14 15:20:29 +01:00
parent 13ab905f8d
commit 3a725469c6
12 changed files with 180 additions and 16 deletions

View File

@@ -703,6 +703,7 @@ mail:
logo_comment: "The built-in layouts show the logo in their header. Your own layouts show it where they use {{ .logoUrl }}."
site_name: "Site name"
site_name_comment: "Shown in the header and footer of the built-in layouts. Leave it empty to use the sender name from mail.from."
site_name_unsafe: "This name cannot be shown in mail. Remove addresses that start with javascript:, vbscript: or data: and text such as onclick=."
body_bg: "Body background"
content_bg: "Content background"
header_color: "Header colour"

View File

@@ -741,6 +741,7 @@ mail:
logo_comment: "Wbudowane układy pokazują logo w nagłówku. Własne układy pokazują je tam, gdzie używają {{ .logoUrl }}."
site_name: "Nazwa witryny"
site_name_comment: "Wyświetlana w nagłówku i stopce wbudowanych układów. Zostaw puste, aby użyć nazwy nadawcy z mail.from."
site_name_unsafe: "Tej nazwy nie można pokazać w wiadomościach. Usuń adresy zaczynające się od javascript:, vbscript: lub data: oraz tekst w rodzaju onclick=."
body_bg: "Główne tło"
content_bg: "Tło treści"
header_color: "Kolor górnego nagłówka"