Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DKIM fails: loading MimeMessage changes message #227

Closed
breedbekkikker opened this issue Feb 5, 2016 · 2 comments
Closed

DKIM fails: loading MimeMessage changes message #227

breedbekkikker opened this issue Feb 5, 2016 · 2 comments
Labels
bug Something isn't working

Comments

@breedbekkikker
Copy link

DKIM Sign and Verify functions lead to incorrect results because MimeKit changes the headers and body in several cases. (The examples are taken from the jwz.mbox.txt file.)

1. CRLF is added

For example: an email message with Content-Type multipart/report with a message/rfc822 mimepart:

Original:

--A41C7.838631588=_/mm1[CRLF]
Content-Type: message/rfc822[CRLF]
[CRLF]
[headers][CRLF]
[CRLF]
unsubscribe[CRLF]
--A41C7.838631588=_/mm1--[CRLF]

After loading:

--A41C7.838631588=_/mm1[CRLF]
Content-Type: message/rfc822[CRLF]
[CRLF]
[headers][CRLF]
[CRLF]
unsubscribe[CRLF]
[CRLF]
--A41C7.838631588=_/mm1--[CRLF]

BTW, this also occurs in a message like this (even though DKIM is not affected due to body canonicalization):

Original message:

From: test@test.test[CRLF]
[CRLF]
test

After loading:

From: test@test.test[CRLF]
[CRLF]
test[CRLF]

2. MIME-Version value changes

Original message header:

MIME-Version: RFC-XXXX[CRLF]

After loading:

MIME-Version: 1.0[CRLF]

3. MIME-Version header is added

Original mimemessage part:

--Alternative.Boundary.keAvi9O0M2U=8U4XMt[CRLF]
Content-type: message/external-body;[CRLF]
    access-type="X-HTTP";[CRLF]
    host="info.cern.ch";[CRLF]
    port="2784";[CRLF]
    path="/hypertext/WWW/TheProject.html"[CRLF]
Content-Description: Object of type 'message/external-body;[CRLF]
[CRLF]
Content-type: text/X-HTML[CRLF]
[CRLF]
[CRLF]
[CRLF]
[CRLF]
--Alternative.Boundary.keAvi9O0M2U=8U4XMt[CRLF]

After loading:

--Alternative.Boundary.keAvi9O0M2U=8U4XMt[CRLF]
Content-type: message/external-body;[CRLF]
    access-type="X-HTTP";[CRLF]
    host="info.cern.ch";[CRLF]
    port="2784";[CRLF]
    path="/hypertext/WWW/TheProject.html"[CRLF]
Content-Description: Object of type 'message/external-body;[CRLF]
[CRLF]
Content-type: text/X-HTML[CRLF]
MIME-Version: 1.0[CRLF]
[CRLF]
[CRLF]
[CRLF]
[CRLF]
--Alternative.Boundary.keAvi9O0M2U=8U4XMt[CRLF]

This also occurs in the email message headers:

Original email message headers:

From: nsb@thumper.bellcore.com[CRLF]
Date: Fri, 29 Nov 91 07:13:39 EST[CRLF]
Subject: GIF image (1/3)[CRLF]
Content-type:  message/partial; number=1; total=3; id=foobar[CRLF]

After loading:

From: nsb@thumper.bellcore.com[CRLF]
Date: Fri, 29 Nov 91 07:13:39 EST[CRLF]
Subject: GIF image (1/3)[CRLF]
Content-type:  message/partial; number=1; total=3; id=foobar[CRLF]
MIME-Version: 1.0
@jstedfast
Copy link
Owner

FWIW, I'd prefer separate issue reports per bug so that it is easier to track. In my experience, reporting multiple bugs in the same report ends up causing confusion.

That said, these should all be fixed now.

@breedbekkikker
Copy link
Author

Thanks a lot!

@jstedfast jstedfast added the bug Something isn't working label Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants