Commit c726a35e authored by Nina's avatar Nina

Merge branch 'paz/fix-attach-list-key-with-thunderbird' into 'master'

Fix using x-attach-listkey with emails from Thunderbird.

See merge request !311
parents 68a1bcfb dd05073f
Pipeline #32780 passed with stages
in 11 minutes and 43 seconds
......@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Allow Jenkins job notifications to reach lists. Before, such mails were rejected due to being "auto-submitted".
* Do not recognize sudo messages as automated message (#248)
* Fixed using x-attach-listkey with emails from Thunderbird that include protected headers.
## [3.4.1] / 2019-09-16
......
module Schleuder
module ListPlugins
def self.attach_listkey(arguments, list, mail)
filename = "#{list.fingerprint}.pgpkey"
# "Mail" only really converts to multipart if the content-type is blank.
mail.content_type = nil
mail.add_file({
filename: filename,
content: list.export_key
})
mail.attachments[filename].content_type = 'application/pgp-keys'
mail.attachments[filename].content_description = "OpenPGP public key of #{list.email}"
mail.attachments[filename].content_disposition = "attachment; filename=#{filename}"
new_part = Mail::Part.new
new_part.body = list.export_key
new_part.content_type = 'application/pgp-keys'
new_part.content_description = "OpenPGP public key of #{list.email}"
new_part.content_disposition = "attachment; filename=#{list.fingerprint}.pgpkey"
mail.add_part new_part
nil
end
end
......
From: user <user@example.net>
To: testlist@example.net
Message-ID: <6ce92946-85f0-075a-3577-ab5f6420d389@example.net>
Date: Sat, 4 Jan 2020 19:43:54 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.3.1
MIME-Version: 1.0
Subject: ...
Content-Type: multipart/encrypted;
protocol="application/pgp-encrypted";
boundary="1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c"
This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)
--1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c
Content-Type: application/pgp-encrypted
Content-Description: PGP/MIME version identification
Version: 1
--1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c
Content-Type: application/octet-stream; name="encrypted.asc"
Content-Description: OpenPGP encrypted message
Content-Disposition: inline; filename="encrypted.asc"
-----BEGIN PGP MESSAGE-----
hQIMA691X8Gl2MArARAAjAelAgkSnXUhWGyyFNcbAJTkz+q9ee0ZJCxrQVotehug
9xd441x9YGVow70wJgXSpGcdwK3fPG5cYnbPKYlIhQkyKj92tLHqdawQjKeXvUuK
9yOPYmL35QmT77g8Lirm0t/tNDgiVMky1bp9anQEqTNSyuLybpmA9TFS8Q+RO1w2
dw/RDGx+4t+SiumHtcSPIvSOjwg97f4GYEAL9T5imIRi/5RacIF8y4IoigOsU9A+
4FHtZMj5VbAsPSyXebvR70mDMW3nViFdjAJY7A1Apy3OFrC1SbixeYSu4PIRqyt2
55E1ycha1TmrJ7NAAddT9RQuh8QuXokuYDDb42AeGLyI5C60u4N1QQWBT/c047AJ
3m8XgNg4Vjc/ElcwEWdEO8L13l3l7fo1omo+jqLn9Uk5oRAzTDz2OQ3SR0I7Mdwk
imCJvFHjtj8Li3dQdJgo0opifS78mg57dRFW5fyaStRnwKjrkckJN4tkxxswp4vL
kzfd9/kNTIkbPuZChDp4OvRc21iq6stGtLHR4jcLsO9ygRq4eItAD6LG9oQEJHnD
J9smaT/AHkL83NPOW0mVtcCAKLCGltDxDR9AJKwELDowXK84PG+PAxSig7FTsbp8
e4EU3hFNlvAK29uNve8h/6/VLD68MWEFf1JlQSOZvSbafXn9hL0h1t3phH8iDpHS
6gE/+OI97UzLvtx/4st7ZjBmd9apIQF8OnU7JoISS4g5dmow+VMUt9wpuuPY+KPk
aCsb6jLqlKw4Jp5dgRJzgnRKPRdoaUbrTHG4zdBPoVCQawtbU7DwFcnQQh/J+TLo
ZjkdOMrEi3SuFZ1AGVa/4yfnJBcu1yC12uUcYi8+/R/ZUFX4pJHJHwHwmCnbiGyj
mEV+T0aUL+hVr8E4ELNQOBo0ZJyfTUUqPGNjpwTiA8HPeLOcEqU28ceVjCcNvRpV
vx15vt7pFzpPH+eAvTyXYXdTJAcjJLEH2+YTRq8secuVsMA50fz+EKuh1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bRKlqDnlVrIzLFod41s8e57kfyNn3PeYSrTIQx
XD6SYkHmbvF+/+IVQpWZvUdCCEIwUqpN+HlqBo1Y3XH+pLTH3KFKKa9Kx76EuYy4
hacJwP8inxBzoQrbQc2p9GzQepuI5f202RDdNGaneLP36vZ5gLr0eFQG+v9Px6ww
725O30U=
=2AyW
-----END PGP MESSAGE-----
--1JxyxqJLgO8VkVyQcZm0f2mqBg2sGa75c--
......@@ -2752,6 +2752,30 @@ EOS
teardown_list_and_mailer(list)
end
it 'x-attach-listkey from Thunderbird with protected headers' do
list = create(:list, email: 'testlist@example.net')
list.subscribe('schleuder@example.org', '59C71FB38AEE22E091C78259D06350440F759BD3', true)
encrypted_mail = File.read('spec/fixtures/mails/attach-list-key-thunderbird.eml')
res = nil
begin
res = 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.email, list).setup
expect(message.parts.length).to eql(2)
expect(message.parts.last.parts.length).to eql(2)
expect(message.parts.last.parts.first.decoded).to eql("Hallo\r\n\r\nkurz mal testen, wie ein resend mail, wo zusätzlich der listkey attached\r\nist bei euch so ankommt.\r\n\r\nich habe das gefühl hier ist as broken.\r\n\r\n\r\n\r\n\r\n")
expect(message.parts.last.parts.last.content_type.to_s).to eql('application/pgp-keys')
expect(message.parts.last.parts.last.body.decoded).to match(/pub 4096R\/59C71FB38AEE22E091C78259D06350440F759BD3 \d{4}-\d{2}-\d{2}/)
expect(message.parts.last.parts.last.body.decoded).to include('-----BEGIN PGP PUBLIC KEY BLOCK-----')
expect(message.parts.last.parts.last.body.decoded).to include('mQINBFhGvz0BEADXbbTWo/PStyTznAo/f1UobY0EiVPNKNERvYua2Pnq8BwOQ5bS')
teardown_list_and_mailer(list)
end
it "x-get-version" do
list = create(:list)
list.subscribe("schleuder@example.org", '59C71FB38AEE22E091C78259D06350440F759BD3', true)
......
......@@ -6,3 +6,5 @@ nto
keyserver
keyservers
fpr
files'
ist
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