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:
@@ -325,7 +325,9 @@ func (e *Editor) renderBrand(d Draft, ov Overrides, opts renderOptions) (Rendere
|
||||
return RenderedMessage{}, err
|
||||
}
|
||||
opts.brandCSS, opts.logoURL = css, brand.LogoURL
|
||||
opts.siteName = siteName(&brand, e.m.opts.From)
|
||||
// An unsafe draft name is left out as a send would leave it out; the
|
||||
// Branding save is what refuses it.
|
||||
opts.siteName = e.m.layoutSiteName(&brand)
|
||||
opts.overrides = ov
|
||||
sample := sampleMessage()
|
||||
return e.m.catalog.renderFrom(Message{
|
||||
|
||||
Reference in New Issue
Block a user