gauteh / lieer

Fast email-fetching, sending, and two-way tag synchronization between notmuch and GMail
http://lieer.gaute.vetsj.com
Other
536 stars 62 forks source link

OpenPGP encrypted e-mails have wrong Content-Type #197

Open wiktor-k opened 3 years ago

wiktor-k commented 3 years ago

Hi,

Thanks for this project!

I'm using gmi to sync folders (which works great) and to send e-mail which works mostly okay with one minor issue: PGP encrypted e-mails. (for the record I'm using these instructions).

The e-mail being sent has this header:

Content-Type: multipart/encrypted; boundary="=-=-="; protocol="application/pgp-encrypted"

But the receiving side gets something like this:

Content-Type: multipart/mixed; boundary="0000000000003a7d6005c015156b"

And this change confuses many e-mail clients (most notably Thunderbird) into thinking it's not encrypted (while it is).

Funnily enough it seems the original message is correctly stored in Gmail's Sent folder.

I think this may be a limitation of Gmail's API as I've heard rumors that this is the reason why Flowcrypt (that also uses Gmail API) doesn't send PGPMIME messages (but I'm not sure) but even if it is I think it'd be good to at least mention this limitation.

Using direct SMTP connection avoids this issue (at the expense of having a separate app password :( ).

gauteh commented 3 years ago

The message that is passed to gmi is correct presumably? You can check by adding a print(msg) statement at gmailieer.py:835. gmi does not change any of the read bytes before base64-encoding them and passing them to the Gmail API.

gauteh commented 3 years ago

It seems like this issue is not too old: https://issuetracker.google.com/issues/171715824, but old enough that I am worried about it ever getting fixed.. Signed messages that used to work "recently" stopped working.

wiktor-k commented 3 years ago

Thanks for keeping me in the loop @gauteh and adding a comment there. Much appreciated!

Yep, it may not getting fixed any time soon. Still I'd keep this ticket open (or add an item to Caveats) as a warning to others that may get weird results when using encrypted OpenPGP messages.

gauteh commented 3 years ago

Agreed, let's keep it open, for a while at least.

On Wed, Apr 21, 2021 at 9:38 AM Wiktor Kwapisiewicz < @.***> wrote:

Thanks for keeping me in the loop @gauteh https://github.com/gauteh and adding a comment there. Much appreciated!

Yep, it may not getting fixed any time soon. Still I'd keep this ticket open (or add an item to Caveats) as a warning to others that may get weird results when using encrypted OpenPGP messages.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gauteh/lieer/issues/197#issuecomment-823848657, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN363A2JMIWMW2JFIVE33TJZ6GTANCNFSM43BLZR4A .

tomholub commented 1 year ago

The rumors are correct, Gmail API mangles up PGP/MIME messages. I just saw some movement on the issue https://partnerissuetracker.corp.google.com/issues/171715824/resources - fingers crossed.