Sample projects of NEFilterProvider use IPC but the documentation says that it blocks IPC

The sample project Filtering Network Traffic uses IPC (NSXPCConnection etc.) to send data from the network extension to the app, but the documentation for NEFilterProvider says

The sandbox prevents the Filter Data Provider extension from moving network content outside of its address space by blocking all network access, IPC, and disk write operations.

Since my network extension forwards all network traffic to the app so that the user can see it, I was wondering when the app isn’t running and the user shuts down the machine, if the network extension could write the flows it wasn’t able to forward to the app to disk, so that it could read them on the next successful connection to the app. Then almost by accident I read again the documentation and according to the quoted passage a network extension cannot write to disk, but it also cannot use IPC.

Is NSXPCConnection not considered IPC, or could the statement that it cannot write to disk be false as well?

Answered by DTS Engineer in 796833022

Your reference to that sample code suggests that you’re on macOS. If so, that quote from the documentation doesn’t apply.

On iOS there are separate filter data and control providers to meet a specific privacy goal. The entire intro section on the Content filter providers documentation page assumes that design.

macOS doesn’t support this split; there is just one filter provider. That filter provider runs in a sandbox, but it’s not the custom sandbox that you get an iOS but rather something much closer to macOS’s traditional App Sandbox. This allows for writing to disk, IPC communication with code that shares an app group, and so on.

One day I’ll get around to fixing that page in the docs, but it’s not something I’m prepared to tackle today. You should feel free to file a bug against the doc though. It’s possible that someone from DevPubs might pick it up.

If you do file a bug, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Your reference to that sample code suggests that you’re on macOS. If so, that quote from the documentation doesn’t apply.

On iOS there are separate filter data and control providers to meet a specific privacy goal. The entire intro section on the Content filter providers documentation page assumes that design.

macOS doesn’t support this split; there is just one filter provider. That filter provider runs in a sandbox, but it’s not the custom sandbox that you get an iOS but rather something much closer to macOS’s traditional App Sandbox. This allows for writing to disk, IPC communication with code that shares an app group, and so on.

One day I’ll get around to fixing that page in the docs, but it’s not something I’m prepared to tackle today. You should feel free to file a bug against the doc though. It’s possible that someone from DevPubs might pick it up.

If you do file a bug, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for your insights. I created FB14466634 regarding the documentation.

So does this mean that it would be impossible to port that sample project to iOS, since the network extension has no way of communicating with the app, i.e. it would be impossible to build an iOS app that shows network flows or allows to reject flows from real-time user input?

it would be impossible to build an iOS app that shows network flows or allows to reject flows from real-time user input?

Yes.

Content filters on iOS are primarily focused on enterprise users, where the user isn’t involved in that particular loop. That explains why they have such strict distribution limits, as discussed in TN3134 Network Extension provider deployment.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Sample projects of NEFilterProvider use IPC but the documentation says that it blocks IPC
 
 
Q