Page MenuHome GnuPG

Treat any .p7m files without other file extensions as S/MIME mail first
Testing, NormalPublic

Description

The customer gets from his system random hexadecimal filenmames which end with .p7m when exporing their mails.

Since usually when a file is encrypted with CMS it gets the .p7m extension added normal files should not be affected. But at least we should have some kind of error detection if what we receive after decryption does not look like a mail at all but some random binary data.

Makes sense to me because with normal kleo decrypting an foo.p7m would leave you with just a file named "foo" and then windows will not know what to do with it since there is no MIME Database / File style inspection of the contents happening

Event Timeline

aheinecke triaged this task as Normal priority.Nov 3 2023, 12:06 PM
aheinecke created this task.

Done in https://invent.kde.org/pim/libkleo/-/merge_requests/52 but requires a way to fallback in mimetreeparser when we detect that the file is actually not an email file or make this behavior optional

aheinecke changed the task status from Open to Testing.Nov 13 2023, 9:55 AM
aheinecke claimed this task.

I want to test how this behaves with some random data which is not a mail. Otherwise I think this is resolved.

I want to test how this behaves with some random data which is not a mail. Otherwise I think this is resolved.

The current handling is not great :( I had a local branch that tried to mark this sort of files as attachment instead of trying to treat the content as plain text but this was breaking other things.

It's a not so easy problem to solve as then we decrypt the files and can finally see the content, we are already inside the mime tree parser and it's a bit too late to go back to Kleopatra normal handling.

Something I want to try is to decrypt the smime file here: https://invent.kde.org/pim/mimetreeparser/-/blob/master/src/core/fileopener.cpp?ref_type=heads#L19 which would make it easier for the mime tree parser to abort early and give back control to Kleopatra.