Commit bf47d39a authored by ng's avatar ng

Merge branch 'fix-mutt-header-430' into 'master'

fix #430 - do not fail on mutt protected headers

Closes #430

See merge request !290
parents e4a1bd90 0651daf5
Pipeline #25639 failed with stages
in 20 seconds
......@@ -3,6 +3,12 @@ Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## [3.4.1] / 2019-06-XX
### Fixed
* Do not crash on protected header emails generated by mutt (#430)
## [3.4.0] / 2019-02-14
### Fixed
......
......@@ -55,7 +55,7 @@ module Mail
new.protected_headers_subject = self.subject.dup
# Delete the protected headers which might leak information.
if new.parts.first.content_type == "text/rfc822-headers; protected-headers=v1"
if new.parts.first && new.parts.first.content_type == "text/rfc822-headers; protected-headers=v1"
new.parts.shift
end
end
......
From schleuder@example.org Thu Jun 13 15:19:33 2019
Received: from 127.0.0.1 (helo=localhost.localdomain)
by mail.example.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
(Exim 4.92)
id 1hbPdc-0007GN-6b
for schleuder@example.org; Thu, 13 Jun 2019 15:19:32 +0200
Date: Thu, 13 Jun 2019 15:19:30 +0200
From: dev <schleuder@example.org>
To: schleuder@example.org
Subject: ...
Message-ID: <20190613131930.ABC@xyz>
MIME-Version: 1.0
Content-Type: multipart/encrypted; protocol="application/pgp-encrypted";
boundary="z6Eq5LdranGa6ru8"
Content-Disposition: inline
--z6Eq5LdranGa6ru8
Content-Type: application/pgp-encrypted
Content-Disposition: attachment
Version: 1
--z6Eq5LdranGa6ru8
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="msg.asc"
-----BEGIN PGP MESSAGE-----
hQIMA691X8Gl2MArAQ//SFZyc/TD/9PYMddJcUIp4F85wsoCUZUaVLpKBzUZdrLv
rln9bgaou4MiUXF8ZTSqq2ET6A3X7+wpDjs79KiDJnILUmguGDT2KTkyD8lxP9nd
oIKtqKdf95AYGmItYkaQqdZf1No2q4ZBQNWXp8+LZgxINn5AW+9wuOo8F9w+tyZJ
8r9jlj5TJ0YnVp5FieKMMyxiSOCGX8lAaqi4TbML35OWrnL8Decsz5tTX4jfqr8L
cvNuIpa863WkbZxMxLEEn4/yC6upmOnU3eSZ9M/UoXiqgBsd01KEoOvmIIPOgGce
IaCxO4zuoPvtcQsuinlLCI2oX9mpex6iTMGmD1J0G9FNGI3OHkwZcahw+4/3dv9K
jfUjm6XwndtYi6ifAPAf8M8RT84hFlZKqR7IpGmpqWnLZx6BcFV0RDu8GCIPD6Fr
UeLu1hGLD3SMbKy9zSR4lDSkMRvCUumXAebtEvfp7dfQ9Z8I866J5/9EZIDH88M1
Rb9agaBlwwr8Oy0hzC3rwvLyqXi1KD79f+YmGL0yatYPTm37qCE+QdfXCkesN6jg
SV3zjtpBalP0KMCtAhouFf6xDz615nWvC5NRh2yzYOhSVfmZEVrB9Zz7GZx8rsMi
2U0ALYJIc6EI0uc/sLZ9dYu6hBa72VmSe90zS5IE2ZYB24GnzXV95iMsvH35/4vS
igFWNQmHxWc9GfwgXN2/P2k4zokCxywLLhoa5xoy+SGmipz2pU8IS4chGT6H5edU
/CdBAAdHw7eNgXkuctH9eAM7WE/yu+1tmAPUvzr3ojFyXF+L8d8gcCbOJA4scHb6
/L8B0J+CZG/dkMDxU/xjyc7zz8not13HTr6xklMUIam/OzM95YFmleAN4g==
=l547
-----END PGP MESSAGE-----
--z6Eq5LdranGa6ru8--
......@@ -85,4 +85,26 @@ describe "protected subject" do
teardown_list_and_mailer(list)
end
it "works with mutt protected headers" do
list = create(:list)
list.subscribe("schleuder@example.org", '59C71FB38AEE22E091C78259D06350440F759BD3', true)
mail = Mail.read("spec/fixtures/mutt_protected_headers.txt")
mail.deliver
encrypted_mail = Mail::TestMailer.deliveries.first
Mail::TestMailer.deliveries.clear
begin
Schleuder::Runner.new().run(encrypted_mail.to_s, list.email)
rescue SystemExit
end
raw = Mail::TestMailer.deliveries.first
message = Mail.create_message_to_list(raw.to_s, list.request_address, list).setup
expect(message.parts[1].body.to_s).to eql("Subject: x\n")
expect(message.parts[2].body.to_s).to eql("test\n")
teardown_list_and_mailer(list)
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment