Skip to content

fix(mail): escape rich object links and skip unsendable digest users - #2907

Open
solracsf wants to merge 1 commit into
masterfrom
fix/mail-link-escaping-and-digest-guards
Open

fix(mail): escape rich object links and skip unsendable digest users#2907
solracsf wants to merge 1 commit into
masterfrom
fix/mail-link-escaping-and-digest-guards

Conversation

@solracsf

@solracsf solracsf commented Sep 7, 2026

Copy link
Copy Markdown
Member

Three unrelated faults in the mail path, all in the same area.

Unescaped link. The link of a rich object went straight into the href while the link text beside it was escaped. A parameter carrying a quote closes the attribute and injects markup into the mail body:

link: https://example.com/"><script>alert(1)</script>
-> Shared <a href="https://example.com/"><script>alert(1)</script>">secret.txt</a>

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 unparseable core/timezone preference 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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant