From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 37C43431FAF for ; Wed, 14 Mar 2012 23:33:29 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[HTML_MESSAGE=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 lnl6v3IwCgsF for ; Wed, 14 Mar 2012 23:33:23 -0700 (PDT) Received: from mail-pz0-f46.google.com (mail-pz0-f46.google.com [209.85.210.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id DB239431FAE for ; Wed, 14 Mar 2012 23:33:22 -0700 (PDT) Received: by dajr28 with SMTP id r28so3974725daj.19 for ; Wed, 14 Mar 2012 23:33:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=nGmn7Y/yzsuBr57ku0+wEEAcwAbfNm5EHzhdB7bdU/s=; b=p5XenMw4/G3539hXH5MWNj2eFuOLpVMIGRNWQW7DSpCb1uA+CglBLc5A5i2rj/GkU2 tKKXx7JT08Y1QI45BDazvinN/qpwjdFCKIVbU5ijnxK/hPGdHn4hOAEIJRGJsj33xOsB lXUlom6D6IrJVYSk57RLsTuc21wULzql9E7ga/nECF/LDJ0QwLp37rYV08TLxY+E0kgV SEbvK60TXk+rlYkvWYr2DeLEWD2/DE3KvS3CpIz26UINSmMAjAjyI1c/9jL8A7OftZva 0cp/iahUhQvXJh9CcjmUrva/QRldQ78isRF0Mf39/e1j0idCwvoV6nqP+XZGCeFy+oQf /DJA== MIME-Version: 1.0 Received: by 10.68.225.73 with SMTP id ri9mr2505847pbc.70.1331793201890; Wed, 14 Mar 2012 23:33:21 -0700 (PDT) Received: by 10.68.136.227 with HTTP; Wed, 14 Mar 2012 23:33:21 -0700 (PDT) Received: by 10.68.136.227 with HTTP; Wed, 14 Mar 2012 23:33:21 -0700 (PDT) In-Reply-To: <87k42momyi.fsf@awakening.csail.mit.edu> References: <87fwdptbir.fsf@dehydrator.spatula.rdu.redhat.com> <1330849538-24558-1-git-send-email-jani@nikula.org> <87k42momyi.fsf@awakening.csail.mit.edu> Date: Thu, 15 Mar 2012 08:33:21 +0200 Message-ID: Subject: Re: [PATCH] emacs: fix MML quoting in replies From: Jani Nikula To: Austin Clements Content-Type: multipart/alternative; boundary=e89a8ff2437db686d604bb424428 X-Gm-Message-State: ALoCoQkJgMZ7Uh1agFGN90xNIYEopUa+r4JUHtxGuOJPOGy5/LxgV5vO407G9OJ7mJwZZHqpRFaU Cc: notmuch@notmuchmail.org 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: Thu, 15 Mar 2012 06:33:29 -0000 --e89a8ff2437db686d604bb424428 Content-Type: text/plain; charset=UTF-8 On Mar 15, 2012 12:08 AM, "Austin Clements" wrote: > > On Sun, 4 Mar 2012 10:25:38 +0200, Jani Nikula wrote: > > The reply MML quoting added in commit ae438cc unintentionally MML > > quotes also the signature/encryption MML tags added via > > message-setup-hook, causing the reply not to be signed/encrypted. > > > > MML quote just the original message in the temp buffer before > > inserting it to the message buffer, to not interfere with message mode > > hooks or message construction in general. > > > > See [1] and [2] for bug reports. > > > > Thanks to Tim Bielawa for testing. > > > > [1] id:"87hay78x6l.fsf@wyzanski.jamesvasile.com" > > [2] id:"1330812262-28272-1-git-send-email-tbielawa@redhat.com". > > > > Signed-off-by: Jani Nikula > > --- > > emacs/notmuch-mua.el | 10 ++++------ > > 1 files changed, 4 insertions(+), 6 deletions(-) > > > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > > index 4be7c13..13244eb 100644 > > --- a/emacs/notmuch-mua.el > > +++ b/emacs/notmuch-mua.el > > @@ -95,6 +95,9 @@ list." > > (goto-char (point-min)) > > (setq headers (mail-header-extract))))) > > (forward-line 1) > > + ;; Original message may contain (malicious) MML tags. We must > > + ;; properly quote them in the reply. > > + (mml-quote-region (point) (point-max)) > > Under what circumstances can the (re-search-forward "^$" nil t) above > this code fail? If it does fail, is it possible for the (forward-line 1) > to move past an adversary-controlled line of text and fail to quote that > line? It doesn't matter. The quoting is done between point and point-max, and the message body to cite is extracted right after quoting using: (setq body (buffer-substring (point) (point-max)))). BR, Jani. --e89a8ff2437db686d604bb424428 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Mar 15, 2012 12:08 AM, "Austin Clements" <amdragon@mit.edu> wrote:
>
> On Sun, =C2=A04 Mar 2012 10:25:38 +0200, Jani Nikula <jani@nikula.org> wrote:
> > The reply MML quoting added in commit ae438cc unintentionally MML=
> > quotes also the signature/encryption MML tags added via
> > message-setup-hook, causing the reply not to be signed/encrypted.=
> >
> > MML quote just the original message in the temp buffer before
> > inserting it to the message buffer, to not interfere with message= mode
> > hooks or message construction in general.
> >
> > See [1] and [2] for bug reports.
> >
> > Thanks to Tim Bielawa <= tbielawa@redhat.com> for testing.
> >
> > [1] id:"87hay78x6l.fsf@wyzanski.jamesvasile.com"
> > [2] id:"1330812262-28272-1-git-send-email-tbielawa@redhat.com<= /a>".
> >
> > Signed-off-by: Jani Nikula <
jani@nikula.org>
> > ---
> > =C2=A0emacs/notmuch-mua.el | =C2=A0 10 ++++------
> > =C2=A01 files changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> > index 4be7c13..13244eb 100644
> > --- a/emacs/notmuch-mua.el
> > +++ b/emacs/notmuch-mua.el
> > @@ -95,6 +95,9 @@ list."
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char (point-min))=
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq headers (mail-hea= der-extract)))))
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0(forward-line 1)
> > + =C2=A0 =C2=A0 =C2=A0;; Original message may contain (malicious)= MML tags. We must
> > + =C2=A0 =C2=A0 =C2=A0;; properly quote them in the reply.
> > + =C2=A0 =C2=A0 =C2=A0(mml-quote-region (point) (point-max))
>
> Under what circumstances can the (re-search-forward "^$" nil= t) above
> this code fail? =C2=A0If it does fail, is it possible for the (forward= -line 1)
> to move past an adversary-controlled line of text and fail to quote th= at
> line?

It doesn't matter. The quoting is done between point and point-max, = and the message body to cite is extracted right after quoting using: (setq = body (buffer-substring (point) (point-max)))).

BR,
Jani.

--e89a8ff2437db686d604bb424428--