Skip to content

Fix SMIME signed email sending, do not overwrite Content-Disposition

What does this MR do and why?

This MR removes content_disposition overwrite within smime_signature_interceptor hook. Otherwise using Amazon SES does not work when signed email sending is enabled.

Testing this using rails console shows that the Content-Disposition header is empty:

irb(main):001:0> Notify.test_email('info@example.com', 'Message Subject', 'Message Body').deliver_now
Delivered mail 61af4dd24b27a_705a65a50164f0@example.com.mail (104.2ms)

=> #<Mail::Message:154760,Multipart: true, Headers: <Date: Tue, 07 Dec 2021 12:04:34 +0000>, <From: "GitLab" <gitlab@example.com>>, <Reply-To: "GitLab" <noreply@example.com>>, <To: info@example.com>, <Message-ID: <61af4dd24b27a_705a65a50164f0@example.com.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: multipart/signed; boundary=----E6CF76AC5B35F2D6A6BAD9702E480AA4; micalg=sha-256; protocol="application/x-pkcs7-signature">, <Content-Transfer-Encoding: 7bit>, <Content-Disposition: >, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>

Response from SES:

554 Transaction failed: Expected disposition, got null (in reply to end of DATA command))

With this patch there is no empty Content-Disposition header anymore and SES accepts the mail:

irb(main):001:0> Notify.test_email('info@example.com', 'Message Subject', 'Message Body').deliver_now
Delivered mail 61af5a1272caf_d0a5a504255c@example.com.mail (72.7ms)
=> #<Mail::Message:154760, Multipart: true, Headers: <Date: Tue, 07 Dec 2021 12:56:50 +0000>, <From: "GitLab" <gitlab@example.com>>, <Reply-To: "GitLab" <noreply@example.com>>, <To: info@example.com>, <Message-ID: <61af5a1272caf_d0a5a504255c@example.com.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: multipart/signed; boundary=----BE07D25544FBCFE168AE754FC6702C70; micalg=sha-256; protocol="application/x-pkcs7-signature">, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>

🛠 with at Siemens

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Roger Meier

Merge request reports