Skip to content

[2.x] fix(core): set an explicit title on notification emails so it can't leak#4768

Merged
imorland merged 1 commit into
2.xfrom
im/notification-email-title-leak
Jul 7, 2026
Merged

[2.x] fix(core): set an explicit title on notification emails so it can't leak#4768
imorland merged 1 commit into
2.xfrom
im/notification-email-title-leak

Conversation

@imorland

Copy link
Copy Markdown
Member

Fixes #4767.

The notification email template renders {{ $title ?? trans('core.email.notification.default_title') }}. Because the view factory is a singleton, a title shared onto it by an earlier informational email (password reset, "send test email", account activation) persisted, and NotificationMailer rendered without its own title — so the notification body heading showed the previous email's title (e.g. "Reset Your Password" or "Flarum Email Test") instead of "Notification". Subject line and the rest of the body were correct; intermittent, depending on what ran earlier in the same worker process.

NotificationMailer now passes an explicit default title in its render data, overriding any stale shared value.

Tests:

  • Unit: NotificationMailer::send() provides an explicit title.
  • Integration: with a title left on the shared view factory, the rendered notification heading is still "Notification" (regression guard, using the real blade).

The notification email template renders `{{ $title ?? trans('...default_title') }}`.
The view factory is a singleton, so a `title` shared by an earlier informational
email (password reset, "send test email", account activation) lingered on it, and
NotificationMailer rendered without its own title — so the notification body heading
showed the previous email's title (e.g. "Reset Your Password") instead of "Notification".

NotificationMailer now passes an explicit default title in its render data, overriding
any stale shared value.

Fixes #4767
@imorland imorland changed the title fix(core): set an explicit title on notification emails so it can't leak [2.x] fix(core): set an explicit title on notification emails so it can't leak Jun 18, 2026
@imorland imorland added this to the 2.0.0-rc.5 milestone Jun 18, 2026
@imorland imorland marked this pull request as ready for review July 7, 2026 09:38
@imorland imorland requested a review from a team as a code owner July 7, 2026 09:38
@imorland imorland merged commit f0d3b21 into 2.x Jul 7, 2026
25 checks passed
@imorland imorland deleted the im/notification-email-title-leak branch July 7, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] Notification email body shows the wrong title (leaked from a previously-sent email)

1 participant