On 2010-03-24 14:34, Martin Gregorie wrote:

It's named MimeMagic and is available at
<http://whatever.frukt.org/spamassassin.text.shtml>

Thanks, Jonas. That looks very useful. I've replaced my old
IMAGE_MISMATCH rule with an equivalent based on MimeMagic that uses:

Please make sure to evaluate the results. As stated on the web page, still consider the plugin to be somewhat experimental, and I haven't had a lot of fedback on it.

header IMAGE_MISMATCH eval:mimemagic_mismatch_contenttype('jpg', 'gif',
'png', 'bmp', 'svg')

That will miss parts with MIME types image/jpeg or image/x-jpeg. Replacing jpg with jpe?g would be better.

It will also miss anything where those substrings are not in the declared MIME type for the part. So a JPEG image with a .gif extensiuon and a application/octet-stream MIME type will not be catched.

It will include parts where any of those strings happens to me substrings of any other MIME type, including non image ones. Not sure if that will ever matter though.

A rule that should quite a lot of image types might be (just of the top of my head, utested):
header IMAGE_MISMATCH eval:mimemagic_mismatch_datatype('image/')

This should do a magic check on all parts, and see if any parts identified (by the freedesktop database) as image/* has a mismatched MIME type or file name extension.

I don't think MimeMagic is overkill. It is probably only a matter of
time before non-image files turn up with equivalent lying content types
and/or extensions and adding rules to catch them will be trivial.

That's what I thought when I wrote it. :-)

At that time I wanted to catch some stuff that where a RAR atchment had a ZIP MIME type (or maybe it was the other way round).

Regards
/Jonas
--
Jonas Eckerman
Fruktträdet & Förbundet Sveriges Dövblinda
http://www.fsdb.org/
http://www.frukt.org/
http://whatever.frukt.org/

Reply via email to