ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.11k stars 145 forks source link

Extra newlines inserted in outgoing plaintext messages ~every 965 characters, when signing turned on #455

Open benwr opened 6 months ago

benwr commented 6 months ago

Expected Behavior

Plaintext messages should be sent and signed unmodified.

Current Behavior

If PGP signing for external messages is turned on (PGP/MIME, 25519 key), extra newlines are added to outgoing messages, often in the middle of words. I've verified that the message reaches the bridge without the extra newlines. It's even reconstructed without those extra newlines when I send it to a ProtonMail address. But when I send it to anyone else (e.g. a mailing list, or to a GMail address), there are these random newlines.

The extra newlines are spaced about 965 characters apart, starting from the beginning of the message, with small variations (956 characters, 976 characters, 968 characters...).

Possible Solution

I don't have a good workaround except to disable signing for external messages, which seems to do the trick.

Steps to Reproduce

  1. Turn on "Signing for external messages" in the web UI
  2. Send a plaintext message with more than a few thousand characters in it, to an external address
  3. Observe the extra line breaks

You can see an SMTP transcript of a message I sent to my GMail address, and the mangled result, here: https://gist.github.com/benwr/aebe6cf6b4680bbc436612995aae7453

The first extra newline in the message occurs between where I expec and t it on

The second occurs between as may and be you.

You can verify that this happens at the same place in the message and with multiple recipients by viewing the copy of that message that I sent to the Guix mailing list here: https://lists.gnu.org/archive/html/help-guix/2024-01/msg00000.html

Version Information

build="2023-11-20T12:06:15+0100" revision=3210709810 runtime=darwin tag=br-183 version=3.7.1

Context (Environment)

I'm trying to send PGP-signed messages to mailing lists, e.g. including patches. This issue will of course break patches.

Detailed Description

I'd like it if whatever code path is causing this could be fixed to not insert extra newlines.

LBeernaertProton commented 6 months ago

Thanks for the report, we have tracked the issue internally as GODT-3192.