Repository navigation
A patch release: the default HTML layout now escapes the subject, the preheader and the unsubscribe URL. No migration, no configuration change.
Why
An invoicing app on the fleet puts a merchant's own name into email subjects. A name such as A&B "Shop" <Tienda> broke the <title>, the hidden preheader and the <meta itemprop="name"> attribute, and could add markup to the message. A subject cannot carry HTML entities of its own, so the fix belongs in the layout. The app had stripped <, > and " from subjects as a workaround; it deleted that workaround on upgrading.
What changed
Fixed
- The layout escapes the subject, the preheader and the unsubscribe URL. The default layout wrote the subject into
<title>, the hidden preheader and<meta itemprop="name" content="…">, and the unsubscribe URL intohref="…", without HTML escaping. A subject that holds a customer's own words (Invoice from A&B "Shop" <Tienda>) then broke the attribute or added markup, and a subject cannot carry entities of its own. All four values are now escaped withERB::Util.html_escape. The body stays as the Builder made it. A custom layout (layout_path:) must escape these values itself.
Upgrading
bundle update goodmail.- If you strip characters from subjects to protect the layout, remove that code: the layout escapes.
- If you ship a custom layout (
layout_path:), escape these four values yourself; the gem cannot reach into your template.
Review
The change was reviewed in an adversarial pass before merge (PR #4), with tests for the four escaped places and for a body that stays as the Builder made it.
Automatically generated notes
What's Changed
Full Changelog: v0.4.0...v0.4.1