[2.x] fix(core): set an explicit title on notification emails so it can't leak#4768
Draft
imorland wants to merge 1 commit into
Draft
[2.x] fix(core): set an explicit title on notification emails so it can't leak#4768imorland wants to merge 1 commit into
imorland wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4767.
The notification email template renders
{{ $title ?? trans('core.email.notification.default_title') }}. Because the view factory is a singleton, atitleshared onto it by an earlier informational email (password reset, "send test email", account activation) persisted, andNotificationMailerrendered without its owntitle— 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.NotificationMailernow passes an explicit default title in its render data, overriding any stale shared value.Tests:
NotificationMailer::send()provides an explicittitle.titleleft on the shared view factory, the rendered notification heading is still "Notification" (regression guard, using the real blade).