1 Return-Path: <wking@tremily.us>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 19A31431FBD
\r
6 for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 10:45:06 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
13 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id Rz07LLOJSNRT for <notmuch@notmuchmail.org>;
\r
18 Mon, 10 Feb 2014 10:45:00 -0800 (PST)
\r
19 Received: from qmta09.westchester.pa.mail.comcast.net
\r
20 (qmta09.westchester.pa.mail.comcast.net [76.96.62.96])
\r
21 by olra.theworths.org (Postfix) with ESMTP id 68578429E3F
\r
22 for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 10:44:02 -0800 (PST)
\r
23 Received: from omta04.westchester.pa.mail.comcast.net ([76.96.62.35])
\r
24 by qmta09.westchester.pa.mail.comcast.net with comcast
\r
25 id Qd6M1n0030ldTLk59ik2ML; Mon, 10 Feb 2014 18:44:02 +0000
\r
26 Received: from odin.tremily.us ([24.18.63.50])
\r
27 by omta04.westchester.pa.mail.comcast.net with comcast
\r
28 id Qii11n00F152l3L01ii1x1; Mon, 10 Feb 2014 18:42:02 +0000
\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])
\r
30 by odin.tremily.us (Postfix) with ESMTPS id 0234010167C7;
\r
31 Mon, 10 Feb 2014 10:42:01 -0800 (PST)
\r
32 Received: (nullmailer pid 1285 invoked by uid 1000);
\r
33 Mon, 10 Feb 2014 18:40:46 -0000
\r
34 From: "W. Trevor King" <wking@tremily.us>
\r
35 To: notmuch@notmuchmail.org
\r
36 Subject: [PATCH v2 19/20] nmbug-status: Escape &, <, and > in HTML display
\r
38 Date: Mon, 10 Feb 2014 10:40:40 -0800
\r
40 <12913effee843bd0edb90829f2a697fefc5715b1.1392056624.git.wking@tremily.us>
\r
41 X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1
\r
42 In-Reply-To: <cover.1392056624.git.wking@tremily.us>
\r
43 References: <cover.1392056624.git.wking@tremily.us>
\r
44 In-Reply-To: <cover.1392056624.git.wking@tremily.us>
\r
45 References: <cover.1392056624.git.wking@tremily.us>
\r
46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
\r
47 s=q20121106; t=1392057842;
\r
48 bh=JkclE6rFHN+/nSNV2UZNQWAAGqczyXMc3ejEIf4/27E=;
\r
49 h=Received:Received:Received:Received:From:To:Subject:Date:
\r
51 b=PhdcK6lIRhqN0lTREV4tUMt7lpT6PQrYy1DYlt6+4o7n6oMZVawOJH3nKKx5CrNPl
\r
52 j67IYaUzBT6JyHd6l6W44nwHj/ZJD581PGyDWK9kmrIkXEXpW/5WotcR3S8S5rMu1G
\r
53 0aKpKj7xVsWiw71Z2x8pqN7g8LQ+iEmnaIbkkPxsyyfz0eYrLknxoksD62I4SL2VD7
\r
54 i/S3+PuNrw0lFt5D/kMsfUYijmeSrM12tbQcLhvvIB6k4hJBgPlNtiXKLzhP8ip2CA
\r
55 W79znEpX5tQk1Vrs7F/BltvHJ0+MWIdT2w5kjNI9W7OcNWQKvdmiMbWk7hR7VzhiLa
\r
57 Cc: Tomi Ollila <tomi.ollila@iki.fi>
\r
58 X-BeenThere: notmuch@notmuchmail.org
\r
59 X-Mailman-Version: 2.1.13
\r
61 List-Id: "Use and development of the notmuch mail system."
\r
62 <notmuch.notmuchmail.org>
\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
66 List-Post: <mailto:notmuch@notmuchmail.org>
\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
70 X-List-Received-Date: Mon, 10 Feb 2014 18:45:06 -0000
\r
72 'message-id' and 'from' now have sensitive characters escaped using
\r
73 xml.sax.saxutils.escape [1]. The 'subject' data was already being
\r
74 converted to a link into Gmane; I've escape()d that too, so it doesn't
\r
75 need to be handled ain the same block as 'message-id' and 'from'.
\r
77 This prevents broken HTML by if subjects etc. contain characters that
\r
78 would otherwise be interpreted as HTML markup.
\r
80 [1]: http://docs.python.org/3/library/xml.sax.utils.html#xml.sax.saxutils.escape
\r
82 devel/nmbug/nmbug-status | 6 +++++-
\r
83 1 file changed, 5 insertions(+), 1 deletion(-)
\r
85 diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
\r
86 index 1f0873a..7209dd1 100755
\r
87 --- a/devel/nmbug/nmbug-status
\r
88 +++ b/devel/nmbug/nmbug-status
\r
89 @@ -24,6 +24,7 @@ import os
\r
93 +import xml.sax.saxutils
\r
96 _ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()
\r
97 @@ -229,11 +230,14 @@ class HtmlPage (Page):
\r
98 if 'subject' in display_data and 'message-id' in display_data:
\r
100 'message-id': quote(display_data['message-id']),
\r
101 - 'subject': display_data['subject'],
\r
102 + 'subject': xml.sax.saxutils.escape(display_data['subject']),
\r
104 display_data['subject'] = (
\r
105 '<a href="http://mid.gmane.org/{message-id}">{subject}</a>'
\r
107 + for key in ['message-id', 'from']:
\r
108 + if key in display_data:
\r
109 + display_data[key] = xml.sax.saxutils.escape(display_data[key])
\r
110 return (running_data, display_data)
\r
112 def _slug(self, string):
\r