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