]> git.ipfire.org Git - thirdparty/patchwork.git/commit
templatetags: Do not mark output of msgid tag as safe
authorDaniel Axtens <dja@axtens.net>
Fri, 5 Jul 2019 01:30:28 +0000 (11:30 +1000)
committerDaniel Axtens <dja@axtens.net>
Fri, 5 Jul 2019 01:30:28 +0000 (11:30 +1000)
commitc400741bae2477d8329a24b3498d059c28ced0d6
tree2974b67e66049857d832b5df2cfb727736e8a60a
parent3e66958169c7e7ac20bf0cc316e1c2803606aa8e
templatetags: Do not mark output of msgid tag as safe

The msgid template tag exists to remove angle brackets from either side of
the Message-ID header.

It also marks its output as safe, meaning it does not get autoescaped by
Django templating.

Its output is not safe. A maliciously crafted email can include HTML tags
inside the Message-ID header, and as long as the angle brackets are not at
the start and end of the header, we will quite happily render them.

Rather than using mark_safe(), use escape() to explicitly escape the
Message-ID.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
(backported from 133a6c90e9826376be0f12f2ae6c2d7b076bdba0)
Signed-off-by: Daniel Axtens <dja@axtens.net>
patchwork/templatetags/patch.py