]> git.ipfire.org Git - thirdparty/patchwork.git/commit
templatetags: Do not mark output of msgid tag as safe
authorAndrew Donnellan <ajd@linux.ibm.com>
Mon, 1 Jul 2019 05:28:03 +0000 (15:28 +1000)
committerDaniel Axtens <dja@axtens.net>
Fri, 5 Jul 2019 01:09:02 +0000 (11:09 +1000)
commit133a6c90e9826376be0f12f2ae6c2d7b076bdba0
treedb6e908a3740942ccfe858e4104e37bd41b63b1a
parenta790f0390eb4d41db1032d0d6c3d103dda86ccea
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>
Signed-off-by: Daniel Axtens <dja@axtens.net>
patchwork/templatetags/patch.py