Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] RubyMail cannot handle multipart/signed messages
@ 2010-04-19  7:43 Michael Stapelberg
  2010-04-19 12:55 ` Sam Hall
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Stapelberg @ 2010-04-19  7:43 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

Hi,

yesterday I got a PGP/MIME message which had multiple attachments. Turns out
RubyMail cannot do multipart/signed (sup says RubyMail failed to decode the
document for some bizarre reason, when you try it in irb, you’ll see it
actually decodes the message parts as headers). I also tried 'mail' by the
same author which he claims can do multipart and is better in general, but
it seems it also cannot do multipart/signed (RFC 1847).

So, what are the plans in regard to RubyMail? Switching to something different
altogether? If so, to which library? I would then fix parsing of
multipart/signed messages for this library…

Best regards,
Michael

PS: I attached a minimum working example of a problematic message (decrypted
body only)

[-- Attachment #2: mwe --]
[-- Type: application/octet-stream, Size: 2099 bytes --]

Content-Type: multipart/signed; micalg=PGP-SHA1;
 boundary="Sig_//bFY=D0OKHxcuPQV_U6beli"; protocol="application/pgp-signature"

--Sig_//bFY=D0OKHxcuPQV_U6beli
Content-Type: multipart/mixed; boundary="MP_/+kacMkT=yx+FKvl3YUds1sR"

--MP_/+kacMkT=yx+FKvl3YUds1sR
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline



--=20
ceterum censeo microsoftem esse delendam.

--MP_/+kacMkT=yx+FKvl3YUds1sR
Content-Type: text/plain; charset=US_ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="text1.txt"

/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsK
CwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQU

--MP_/+kacMkT=yx+FKvl3YUds1sR
Content-Type: text/plain; charset=US_ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="text2.txt"

/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsK
CwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQU

--MP_/+kacMkT=yx+FKvl3YUds1sR
Content-Type: text/plain; charset=US_ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="text3.txt"

/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsK
CwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQU

--MP_/+kacMkT=yx+FKvl3YUds1sR
Content-Type: text/plain; charset=US_ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="text4.txt"

/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsK
d1awmU5G4oSBya92lg6cKcLGbqvaPQ//2Q==

--MP_/+kacMkT=yx+FKvl3YUds1sR--

--Sig_//bFY=D0OKHxcuPQV_U6beli
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

xIQAoI9H0qgqosPpYu96x/mMr6MO/5WA
-----END PGP SIGNATURE-----

--Sig_//bFY=D0OKHxcuPQV_U6beli--

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [sup-devel] RubyMail cannot handle multipart/signed messages
  2010-04-19  7:43 [sup-devel] RubyMail cannot handle multipart/signed messages Michael Stapelberg
@ 2010-04-19 12:55 ` Sam Hall
  2010-04-19 15:57   ` Michael Stapelberg
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Hall @ 2010-04-19 12:55 UTC (permalink / raw)
  To: Sup developer discussion

Hi,

On Mon, Apr 19, 2010 at 09:43 (+0200), Michael Stapelberg wrote:
> I also tried 'mail' by the same author which he claims can do
> multipart and is better in general, but it seems it also cannot do
> multipart/signed (RFC 1847).

'rmail' is significantly broken since a whole while IMHO, but 'mail'
works for me:

~> irb -r mail      
irb(main):001:0> pp Mail.read('mwe').parts
[#<Mail::Part:16136008, Multipart: true, Headers: <Content-Type: multipart/mixed; boundary="MP_/+kacMkT=yx+FKvl3YUds1sR">>,
 #<Mail::Part:19934460, Multipart: false, Headers: <Content-Type: application/pgp-signature; name=signature.asc>, <Content-Disposition: attachment; filename=signature.asc>>]
=> nil

What's the problem on your side?


Best wishes, Sam
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [sup-devel] RubyMail cannot handle multipart/signed messages
  2010-04-19 12:55 ` Sam Hall
@ 2010-04-19 15:57   ` Michael Stapelberg
  2010-04-20  6:26     ` Sam Hall
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Stapelberg @ 2010-04-19 15:57 UTC (permalink / raw)
  To: sup-devel

Hi Sam,

Excerpts from Sam Hall's message of 2010-04-19 14:55:37 +0200:
> ~> irb -r mail      
> irb(main):001:0> pp Mail.read('mwe').parts
> [#<Mail::Part:16136008, Multipart: true, Headers: <Content-Type: multipart/mixed; boundary="MP_/+kacMkT=yx+FKvl3YUds1sR">>,
>  #<Mail::Part:19934460, Multipart: false, Headers: <Content-Type: application/pgp-signature; name=signature.asc>, <Content-Disposition: attachment; filename=signature.asc>>]
> => nil
> What's the problem on your side?
The problem arises as soon as you try to iterate over the content of the mail.
You will see that it only contains 2 parts (according to 'mail'), while there
are at least three text files, a signature and a text part:

irb(main):003:0> puts mail.parts.length
2
irb(main):006:0> pp mail.parts.map { |p| p.content_type }
["multipart/mixed; boundary=\"MP_/+kacMkT=yx+FKvl3YUds1sR\"",
 "application/pgp-signature; name=signature.asc"]
irb(main):007:0>

Best regards,
Michael
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [sup-devel] RubyMail cannot handle multipart/signed messages
  2010-04-19 15:57   ` Michael Stapelberg
@ 2010-04-20  6:26     ` Sam Hall
  2010-04-20  6:40       ` Michael Stapelberg
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Hall @ 2010-04-20  6:26 UTC (permalink / raw)
  To: Sup developer discussion

On Mon, Apr 19, 2010 at 17:57 (+0200), Michael Stapelberg wrote:
> The problem arises as soon as you try to iterate over the content of the mail.
> You will see that it only contains 2 parts (according to 'mail'), while there
> are at least three text files, a signature and a text part:

The first part is a multipart-message in itself, you have to recurse to get
hands on its parts:

irb(main):012:0> pp mail.parts.first.parts.map { |p| p.content_type }
["text/plain; charset=US-ASCII",
 "text/plain; charset=US_ASCII",
 "text/plain; charset=US_ASCII",
 "text/plain; charset=US_ASCII",
 "text/plain; charset=US_ASCII"]


This is not only legal, RFC 3156 even requires this (in 5.):

  The multipart/signed body MUST consist of exactly two parts.  The first part
  contains the signed data in MIME canonical format, including a set of
  appropriate content headers describing the data.

  The second body MUST contain the OpenPGP digital signature.  It MUST be
  labeled with a content type of "application/pgp-signature".


Best wishes, Sam

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [sup-devel] RubyMail cannot handle multipart/signed messages
  2010-04-20  6:26     ` Sam Hall
@ 2010-04-20  6:40       ` Michael Stapelberg
  2010-04-20 15:27         ` Rich Lane
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Stapelberg @ 2010-04-20  6:40 UTC (permalink / raw)
  To: sup-devel

Hi Sam,

Excerpts from Sam Hall's message of 2010-04-20 08:26:00 +0200:
> The first part is a multipart-message in itself, you have to recurse to get
> hands on its parts:
Ah, alright. I thought 'mail' would automatically flatten the parts. Nevermind,
then.

So, when do we switch to 'mail'?

Best regards,
Michael
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [sup-devel] RubyMail cannot handle multipart/signed messages
  2010-04-20  6:40       ` Michael Stapelberg
@ 2010-04-20 15:27         ` Rich Lane
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Lane @ 2010-04-20 15:27 UTC (permalink / raw)
  To: Michael Stapelberg; +Cc: sup-devel

Excerpts from Michael Stapelberg's message of 2010-04-20 02:40:36 -0400:
> So, when do we switch to 'mail'?

I'm all for it but we need to be careful about regressions. We'd need
to have a pretty extensive testsuite covering Message and Chunk before
switching, which is a bigger effort than the switch itself.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-20 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19  7:43 [sup-devel] RubyMail cannot handle multipart/signed messages Michael Stapelberg
2010-04-19 12:55 ` Sam Hall
2010-04-19 15:57   ` Michael Stapelberg
2010-04-20  6:26     ` Sam Hall
2010-04-20  6:40       ` Michael Stapelberg
2010-04-20 15:27         ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox