bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Daniel Kahn Gillmor-7
I've been using emacs as my MUA for years.

When I upgraded from emacs 26.3 to emacs 27.1, i noticed that
message-forward-as-mime now defaults to nil.  I prefer to forward as
MIME generally, so i set it back to t.

The only downside to forwarding as MIME is the inclusion of some headers
that the received message has accumulated in transit, which might have
privacy-sensitive implications. I've been using
message-forward-ignored-headers for a while now to trim out headers like
Received and Delivered-To when forwarding.

But as of 27.1, message-forward-ignored-headers doesn't work when
forwarding as MIME.  indeed, the help text for the variable now says

 >> This variable is only consulted when forwarding "normally", not when
 >> forwarding as MIME or the like.

But this is a regression from 26.3.  I'd expect it to keep working.

Please restore the functionality so that i can automatically strip
privacy-sensitive headers when forwarding.

Thanks,

     --dkg

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Robert Pluim
Daniel Kahn Gillmor <[hidden email]> writes:

> I've been using emacs as my MUA for years.
>
> When I upgraded from emacs 26.3 to emacs 27.1, i noticed that
> message-forward-as-mime now defaults to nil.  I prefer to forward as
> MIME generally, so i set it back to t.
>
> The only downside to forwarding as MIME is the inclusion of some headers
> that the received message has accumulated in transit, which might have
> privacy-sensitive implications. I've been using
> message-forward-ignored-headers for a while now to trim out headers like
> Received and Delivered-To when forwarding.
>
> But as of 27.1, message-forward-ignored-headers doesn't work when
> forwarding as MIME.  indeed, the help text for the variable now says
>
>  >> This variable is only consulted when forwarding "normally", not when
>  >> forwarding as MIME or the like.
>
> But this is a regression from 26.3.  I'd expect it to keep working.
>
> Please restore the functionality so that i can automatically strip
> privacy-sensitive headers when forwarding.

Iʼve compared emacs-26 and emacs-27, and the code is the same, which
leads me to suspect something different in your
configuration. 'message-forward-ignored-headers' is applied even when
forwarding as MIME (despite the docstring), except when
'message-forward-show-mml' is nil, or when itʼs 'best' and the
forwarded message is either signed or encrypted. Or maybe youʼre
forwarding from inside the *Article* buffer, I think Gnus behaves
differently then.

Robert



Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Daniel Kahn Gillmor-7
Hi Robert--

Thanks for taking a look into this!

On Tue 2021-01-05 14:06:54 +0100, Robert Pluim wrote:
> Iʼve compared emacs-26 and emacs-27, and the code is the same, which
> leads me to suspect something different in your
> configuration. 'message-forward-ignored-headers' is applied even when
> forwarding as MIME (despite the docstring)

hm, the docstring change was recent, apparently in response to #27715 :

https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=57fbf0cf7bd4a85f2ad6f14aa92494545106b887

that's why i assumed there had been a change.

> except when 'message-forward-show-mml' is nil, or when itʼs 'best' and
> the forwarded message is either signed or encrypted.

Hm, i'm using 'best' for message-forward-show-mml (as the default) and
yes, it looks like the issue is that i just noticed it happening when
i went to forward a signed message.  Maybe it wasn't an issue before
because i wasn't forwarding a signed message?  I no longer have emacs
26.3 installed so i can't check that handily right now.

The message headers (outside of the cryptographic envelope) do *not*
affect the digital signature, so they ought to be safe to trim out
without invalidating the digital signature.  These are the message
headers that i want to trim.

> Or maybe youʼre forwarding from inside the *Article* buffer, I think
> Gnus behaves differently then.

I'm using notmuch-emacs, not gnus, but it reuses a lot of the existing
emacs MUA codebase, which is why i'm reporting it here.

Do you have a suggestion for how i can apply
message-forward-ignored-headers to a signed message?  I only want it to
apply to headers that aren't covered by the digital signature anyway.

      --dkg

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Robert Pluim
Daniel Kahn Gillmor <[hidden email]> writes:

> Hi Robert--
>
> Thanks for taking a look into this!
>
> On Tue 2021-01-05 14:06:54 +0100, Robert Pluim wrote:
>> Iʼve compared emacs-26 and emacs-27, and the code is the same, which
>> leads me to suspect something different in your
>> configuration. 'message-forward-ignored-headers' is applied even when
>> forwarding as MIME (despite the docstring)
>
> hm, the docstring change was recent, apparently in response to #27715 :
>
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=57fbf0cf7bd4a85f2ad6f14aa92494545106b887
>
> that's why i assumed there had been a change.
>

Documentation lags implementation, as always :-)

>> except when 'message-forward-show-mml' is nil, or when itʼs 'best' and
>> the forwarded message is either signed or encrypted.
>
> Hm, i'm using 'best' for message-forward-show-mml (as the default) and
> yes, it looks like the issue is that i just noticed it happening when
> i went to forward a signed message.  Maybe it wasn't an issue before
> because i wasn't forwarding a signed message?  I no longer have emacs
> 26.3 installed so i can't check that handily right now.
>
> The message headers (outside of the cryptographic envelope) do *not*
> affect the digital signature, so they ought to be safe to trim out
> without invalidating the digital signature.  These are the message
> headers that i want to trim.
>
>> Or maybe youʼre forwarding from inside the *Article* buffer, I think
>> Gnus behaves differently then.
>
> I'm using notmuch-emacs, not gnus, but it reuses a lot of the existing
> emacs MUA codebase, which is why i'm reporting it here.
>
> Do you have a suggestion for how i can apply
> message-forward-ignored-headers to a signed message?  I only want it to
> apply to headers that aren't covered by the digital signature anyway.

I think setting message-forward-show-mml to t will do what you want,
then message won't bother to check if the message is signed/encrypted,
and will thus apply message-forward-ignored-headers.

Robert



Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Eli Zaretskii
> From: Lars Ingebrigtsen <[hidden email]>
> Date: Sun, 10 Jan 2021 16:18:23 +0100
> Cc: [hidden email], Daniel Kahn Gillmor <[hidden email]>
>
> Robert Pluim <[hidden email]> writes:
>
> > I think setting message-forward-show-mml to t will do what you want,
> > then message won't bother to check if the message is signed/encrypted,
> > and will thus apply message-forward-ignored-headers.
>
> Looking over that mess again, I think my analysis of when that variable
> is used, and when it's supposed to be used, was wrong.  I've now make it
> respect that variable even if message-forward-show-mml is nil.

Should this be fixed on the emacs-27 branch?



Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Daniel Kahn Gillmor-7
In reply to this post by Robert Pluim
Hi Lars--

On Sun 2021-01-10 16:18:23 +0100, Lars Ingebrigtsen wrote:
> Looking over that mess again, I think my analysis of when that variable
> is used, and when it's supposed to be used, was wrong.  I've now make it
> respect that variable even if message-forward-show-mml is nil.  The only
> instance it won't be used is if message-forward-show-mml is `best', and
> we're forwarding an encrypted/signed message.

Thanks for taking a look at this.  I'm trying to understand the
rationale for *not* trimming headers when message-forward-show-mml is
`best' and we're forwarding an encrypted/signed message.

If the headers being trimmed are strictly in the header section of the
forwarded message, then they aren't in the cryptographic envelope [0],
which means that they aren't implicated in either a standard PGP/MIME or
S/MIME signature or encryption.

Is the expectation that headers of internal parts of the message are
being trimmed (in which case, they might be implicated in the signature
or encryption)?  or, is there some situation i'm missing where they
might have an impact on the cryptographic structure?

      --dkg

[0]
    https://www.ietf.org/archive/id/draft-dkg-lamps-e2e-mail-guidance-00.html
    has definitions of "cryptographic envelope" and other
    hopefully-useful concepts and terminology.

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Lars Ingebrigtsen
In reply to this post by Eli Zaretskii
Eli Zaretskii <[hidden email]> writes:

>> Looking over that mess again, I think my analysis of when that variable
>> is used, and when it's supposed to be used, was wrong.  I've now make it
>> respect that variable even if message-forward-show-mml is nil.
>
> Should this be fixed on the emacs-27 branch?

If it doesn't introduce any regressions, but my confidence here isn't
exactly 100%...  I think we should wait a few weeks before backporting,
at least.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Lars Ingebrigtsen
In reply to this post by Daniel Kahn Gillmor-7
Daniel Kahn Gillmor <[hidden email]> writes:

> Is the expectation that headers of internal parts of the message are
> being trimmed (in which case, they might be implicated in the signature
> or encryption)?  or, is there some situation i'm missing where they
> might have an impact on the cryptographic structure?

Well, we'd have to include the relevant headers at a minimum:

  Content-Type: multipart/signed; boundary="=-=-=";
        micalg=pgp-sha256; protocol="application/pgp-signature"

But this code is almost a couple of decades old, and I have no idea what
the thought process behind this was at this date.  Anybody know?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Daniel Kahn Gillmor-7
On Mon 2021-01-11 16:09:18 +0100, Lars Ingebrigtsen wrote:
> Well, we'd have to include the relevant headers at a minimum:
>
>   Content-Type: multipart/signed; boundary="=-=-=";
> micalg=pgp-sha256; protocol="application/pgp-signature"

I agree, but if the user is stripping the Content-Type header, i think
they're going to break a lot more than digital signatures or encryption
(imagine what that does to a multipart/alternative message).  I think
that stripping Content-Type is more of a case of "don't do that, then".
Maybe we even want to warn if the user tries to strip any of the
Content-* headers more generally.

> But this code is almost a couple of decades old, and I have no idea what
> the thought process behind this was at this date.  Anybody know?

As long as the code doesn't attempt to strip *internal* MIME headers
(that is, headers of subparts of the MIME structure) i think it should
be safe to apply it to the forwarded message.  

Note also that if we care about breakng cryptographic signatures more
generally, DKIM signatures are *more* likely to break if headers are
stripped than PGP/MIME or S/MIME, as DKIM is capable of covering headers
directly.  Even given that concern, i think the most we'd want the
"best" setting to do to constrain header stripping would be to compare
the stripped version of the file to the non-stripped version -- if the
non-stripped version passes DKIM validation, but the stripped does not,
then either produce a warning message about DKIM signature breakage or
(if in an interactive mode) prompt the user about whether they want to
apply the filter or not.

      --dkg

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#45631: 27.1; regression: message-forward-ignored-headers no longer applies when forwarding as MIME

Robert Pluim
Daniel Kahn Gillmor <[hidden email]> writes:

> generally, DKIM signatures are *more* likely to break if headers are
> stripped than PGP/MIME or S/MIME, as DKIM is capable of covering headers
> directly.  Even given that concern, i think the most we'd want the
> "best" setting to do to constrain header stripping would be to compare
> the stripped version of the file to the non-stripped version -- if the
> non-stripped version passes DKIM validation, but the stripped does not,
> then either produce a warning message about DKIM signature breakage or
> (if in an interactive mode) prompt the user about whether they want to
> apply the filter or not.

Adding unconditional checking of DKIM signatures to Emacs when
forwarding a message is a no-no. Think of people who work on email
when offline, or people who donʼt want to advertise the fact that
they've received email from a particular domain.

Robert