fix(mail): escape rich object links and skip unsendable digest users - #2907
Open
solracsf wants to merge 1 commit into
Open
fix(mail): escape rich object links and skip unsendable digest users#2907solracsf wants to merge 1 commit into
solracsf wants to merge 1 commit into
Conversation
The `link` of a rich object was interpolated straight into the href of activity and digest mails while the link text beside it was escaped, so a parameter carrying a quote closed the attribute and injected markup into the mail body. Two digest problems alongside it: - `new DateTimeZone()` sat outside the per-user try/catch, so a single unparseable `core/timezone` preference threw out of the loop and nobody later in the batch received a digest. The verdict is now memoised, so a shared bad value is reported once instead of once per user. - Users without an email address were never skipped. The whole digest was built and handed to the mailer only for it to throw, once per user, on every run. Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
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.
Three unrelated faults in the mail path, all in the same area.
Unescaped link. The
linkof a rich object went straight into thehrefwhile the link text beside it was escaped. A parameter carrying a quote closes the attribute and injects markup into the mail body:Providers are server-side so nothing reachable today puts user input there, but escaping the text and trusting the URL is the kind of asymmetry a future provider walks into.
Broken timezone aborted the whole run.
new DateTimeZone()sat outside the per-user try/catch, so one unparseablecore/timezonepreference threw out of the loop and nobody after that user got a digest. Every hour, silently. The verdict is memoised so a shared bad value is logged once rather than once per user.Users without an address. Not skipped, so the entire digest was built and handed to the mailer only for it to throw into the catch-all, once per user per run. The last-sent marker still advances so adding an address later doesn't flood them with backlog.
Verified on Nextcloud 36 against MariaDB 11.4, PostgreSQL 16 and S3 primary storage. The three behavioural tests fail on the current code.