Files are getting attached with zero size in Mail Application even files are blocked by Endpoint Client

Hi,

I am trying to create a system extension and with the help of that I need to block certain file types(pdf etc.) to get attached in Mail application while composing email.

For this, I have created endpoint client and subscribed
Code Block
ES_EVENT_TYPE_AUTH_OPEN
event and in handler, I am checking the certain file types and trying to block those files in attaching into Mail application by providing the verdict using
Code Block
es_respond_flags_result
.

However I can see that file types are blocked(because its sending as 0 bytes file size) but at the same time file is getting attached in Mail application and I can send email with the file attached but once I received the email and trying to open the attachment, Its not able to open the file. It says “The file “SamplePdf.pdf” could not be opened because it is empty.”

Need your help to know whether I am following correct steps to block those file types in Mail application or there is any other way to achieve the desired functionality or its bug in Mail application as it’s not working with Endpoint security API's verdict.

Your early help will be appreciated.

Thanks & Regards,
Mohmad Vasim
I have the same problem.
I cannot block file creation events. So there are files always created with zero size.

Need your help to know whether … its bug in Mail application

I’m going to recommend that you file a bug against Mail here. Please post your bug number, just for the record.

It’s pretty easy to see how this bug might come about. When the user attaches an item Mail doesn’t need to open it, and thus your ES client isn’t involved. Later on, when the user goes to send it, Mail is deep in its sending code and isn’t expecting to handle errors from the file system.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Files are getting attached with zero size in Mail Application even files are blocked by Endpoint Client
 
 
Q