[PATCH v3 2/2] emacs: quote MML tags in replies
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 1 Feb 2012 02:49:41 +0000 (06:49 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:51 +0000 (09:43 -0800)
e2/50be95666209a7b1890d97d3991728efbc77e0 [new file with mode: 0644]

diff --git a/e2/50be95666209a7b1890d97d3991728efbc77e0 b/e2/50be95666209a7b1890d97d3991728efbc77e0
new file mode 100644 (file)
index 0000000..c70aab5
--- /dev/null
@@ -0,0 +1,138 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 6C9A740EC26\r
+       for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 18:51:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id N2SqEZkRi1zm for <notmuch@notmuchmail.org>;\r
+       Tue, 31 Jan 2012 18:51:12 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 78521421192\r
+       for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 18:51:09 -0800 (PST)\r
+Received: by mail-bk0-f53.google.com with SMTP id 11so662809bke.26\r
+       for <notmuch@notmuchmail.org>; Tue, 31 Jan 2012 18:51:09 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :mime-version:content-type:content-transfer-encoding;\r
+       bh=hiV9zUliHIQKq7pJL2Eq5wF/JeOLuAxM1VvSBS69DWA=;\r
+       b=HGxMI9kDKbcKj71IilSETOW1arxa18a/MPV4OVAsNScb9QN2tJWcbUKeV83YZqH8l8\r
+       VyGHvgOcuDgz8QBitgS2gsowNESMzlJODtJ+3z2PMm7awvw2mQG5y9ntxOLGckJ3xINU\r
+       CWUN8qltM4Ef3P1BjdR8ZRu/VXVMh0fP6S7Us=\r
+Received: by 10.204.152.141 with SMTP id g13mr9622984bkw.48.1328064669152;\r
+       Tue, 31 Jan 2012 18:51:09 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id ew13sm50144418bkb.1.2012.01.31.18.51.08\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 31 Jan 2012 18:51:08 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 2/2] emacs: quote MML tags in replies\r
+Date: Wed,  1 Feb 2012 06:49:41 +0400\r
+Message-Id: <1328064581-13949-3-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.9\r
+In-Reply-To: <1328064581-13949-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1326998589-37187-1-git-send-email-aaronecay@gmail.com>\r
+       <1328064581-13949-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 01 Feb 2012 02:51:14 -0000\r
+\r
+From: Aaron Ecay <aaronecay@gmail.com>\r
+\r
+Emacs message-mode uses certain text strings to indicate how to attach\r
+files to outgoing mail.  If these are present in the text of an email,\r
+and a user is tricked into replying to the message, the user’s files\r
+could be exposed.\r
+---\r
+ NEWS                 |   12 ++++++++++++\r
+ emacs/notmuch-mua.el |    7 ++++++-\r
+ test/emacs           |    1 -\r
+ 3 files changed, 18 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/NEWS b/NEWS\r
+index 2acdce5..ef26b8c 100644\r
+--- a/NEWS\r
++++ b/NEWS\r
+@@ -39,6 +39,17 @@ Reply to sender\r
+   and search modes, 'r' has been bound to reply to sender, replacing\r
+   reply to all, which now has key binding 'R'.\r
+ \r
++Quote MML tags in replies\r
++\r
++  MML tags are text codes that Emacs uses to indicate attachments\r
++  (among other things) in messages being composed.  The Emacs\r
++  interface did not quote MML tags in the quoted text of a reply.\r
++  User could be tricked into replying to a maliciously formatted\r
++  message and not editing out the MML tags from the quoted text.  This\r
++  could lead to files from the user's machine being attached to the\r
++  outgoing message.  The Emacs interface now quotes these tags in\r
++  reply text, so that they do not effect outgoing messages.\r
++\r
+ Library changes\r
+ ---------------\r
+ \r
+@@ -56,6 +67,7 @@ Compatibility with GMime 2.6\r
+   However, a bug in current GMime 2.6 causes notmuch not to report\r
+   signatures where the signer key is unavailable (GNOME bug 668085).\r
+ \r
++\r
+ Notmuch 0.11 (2012-01-13)\r
+ =========================\r
+ \r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 023645e..4be7c13 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -116,7 +116,12 @@ list."\r
+     (push-mark))\r
+   (set-buffer-modified-p nil)\r
+ \r
+-  (message-goto-body))\r
++  (message-goto-body)\r
++  ;; Original message may contain (malicious) MML tags.  We must\r
++  ;; properly quote them in the reply.  Note that using `point-max'\r
++  ;; instead of `mark' here is wrong.  The buffer may include user's\r
++  ;; signature which should not be MML-quoted.\r
++  (mml-quote-region (point) (mark)))\r
+ \r
+ (defun notmuch-mua-forward-message ()\r
+   (message-forward)\r
+diff --git a/test/emacs b/test/emacs\r
+index a3f4893..b9f7d15 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -274,7 +274,6 @@ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "Quote MML tags in reply"\r
+-test_subtest_known_broken\r
+ message_id='test-emacs-mml-quoting@message.id'\r
+ add_message [id]="$message_id" \\r
+           "[subject]='$test_subtest_name'" \\r
+-- \r
+1.7.9\r
+\r