You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: we are using the gem in GitLab, one of the use cases is S/MIME signing with an interceptor. The gem was recently updated to 2.8.1 in GitLab, so we gave this another try.
Sadly there's still some cases that introduce extra newlines when re-encoding an existing message object. Particularly, when using a multipart message. Below a repro case:
require'mail'email=Mail.newdoto'jane.doe@example.com'from'John Dóe <john.doe@example.com>'subject'Encoding tést'endtext_part=Mail::Part.newdocontent_type'text/plain; charset=UTF-8'content_transfer_encoding'quoted-printable'body"\r\n\r\n@john.doe, now known as John Dóe has accepted your invitation to join the Administrator / htmltest project.\r\n\r\nhttp://169.254.169.254:3000/root/htmltest\r\n\r\n-- \r\nYou're receiving this email because of your account on 169.254.169.254.\r\n\r\n\r\n\r\n"endhtml_part=Mail::Part.newdocontent_type'text/html; charset=UTF-8'content_transfer_encoding'quoted-printable'body"\r\n\r\n@john.doe, now known as John Dóe has accepted your invitation to join the Administrator / htmltest project.\r\n\r\nhttp://169.254.169.254:3000/root/htmltest\r\n\r\n-- \r\nYou're receiving this email because of your account on 169.254.169.254.\r\n\r\n\r\n\r\n"endemail.text_part=text_partemail.html_part=html_partnew_email=Mail.new(email)new_email.encoded == email.encoded
This breaks S/MIME because the signature is calculated taking the original message, but when encoding the final message, it is modified by the new object, so the signature does not match.
Hello, this is a follow-up of #1190 (comment).
Context: we are using the gem in GitLab, one of the use cases is S/MIME signing with an interceptor. The gem was recently updated to 2.8.1 in GitLab, so we gave this another try.
Sadly there's still some cases that introduce extra newlines when re-encoding an existing message object. Particularly, when using a multipart message. Below a repro case:
This breaks S/MIME because the signature is calculated taking the original message, but when encoding the final message, it is modified by the new object, so the signature does not match.
We are currently monkey-patching the gem to fix the issue with this: https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/initializers/mail_encoding_patch.rb.
You can also take a look at the test suite: https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/initializers/mail_encoding_patch_spec.rb
Thanks!
/cc @stanhu @jeremy
The text was updated successfully, but these errors were encountered: