fix(security): escape link URLs in activity email templates#2551
Open
karlitschek wants to merge 1 commit intomasterfrom
Open
fix(security): escape link URLs in activity email templates#2551karlitschek wants to merge 1 commit intomasterfrom
karlitschek wants to merge 1 commit intomasterfrom
Conversation
Activity
|
||||||||||||||||||||||||||||
| Project |
Activity
|
| Branch Review |
fix/digest-email-xss
|
| Run status |
|
| Run duration | 01m 59s |
| Commit |
|
| Committer | Frank Karlitschek |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
1
|
|
|
0
|
|
|
9
|
| View all changes introduced in this branch ↗︎ | |
Member
Is not needed in supported PHP versions. |
37b99bc to
6467d78
Compare
The activity-digest and queued-mail templates interpolate the `link`
attribute of rich-subject parameters and the home URL directly into
the `href` of an `<a>` tag without HTML-escaping. Activity providers
typically supply internal Nextcloud URLs, but defensive escaping
closes a potential `"`-breakout XSS vector should a provider ever
expose user-influenced link values.
Wrap the URLs in `htmlspecialchars(..., ENT_QUOTES, 'UTF-8')` in:
- DigestSender.php — "and N more" link, rich-subject link parameter
- MailQueueHandler.php — home link, rich-subject link parameter
Translation-string templates (`$l->t('...<a href="%s">...', ...)`) are
left as-is: their URLs come exclusively from `linkToRouteAbsolute()`,
and escaping inside the gettext source string would force translators
to handle escaping for every locale.
Signed-off-by: Frank Karlitschek <frank@nextcloud.com>
6467d78 to
00b5dd5
Compare
Collaborator
|
/backport to stable33 |
Collaborator
|
/backport to stable32 |
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.
The activity-digest and queued-mail templates interpolate the
linkattribute of rich-subject parameters and the home URL directly into thehrefof an<a>tag without HTML-escaping. Activity providers typically supply internal Nextcloud URLs, but defensive escaping closes a potential"-breakout XSS vector should a provider ever expose user-influenced link values.Wrap the URLs in
htmlspecialchars(..., ENT_QUOTES, 'UTF-8')in:Translation-string templates (
$l->t('...<a href="%s">...', ...)) are left as-is: their URLs come exclusively fromlinkToRouteAbsolute(), and escaping inside the gettext source string would force translators to handle escaping for every locale.