It's an old issue, but there are still some valid points as of 2022 ;)
Apple, by default, does not allow third-party keyboards to initiate network connections or access parent application's shared group container [1] - all that is protected by sandbox. Access to general pasteboard is also monitored - in iOS 14 user is informed every time an application tries to access general pasteboard, and now, in iOS 16 user must explicitly allow application to access general pasteboard. As for NamedPasteboard
s, keyboard cannot access it as well. In other words, iOS prevents basically all ways that keyboard could use to extract data.
However, when user explicitly grants OpenAccess [1] permissions to the keyboard (by clicking "Allow" in "Allow full access to (...) keyboard") TCC creates exceptions for networking, shared group container and named pasteboards - so now a malicious third party keyboard might be able to threaten user's privacy and security [2].
The main reason why most people might want to grant OpenAccess permission to third-party keyboard at all, is that it is basically the first thing any custom keyboard extensions will ask - without it there are no custom skins, no prediction, no nothing - which makes a custom keyboard "unattractive" and basically the same as default system keyboard.
- https://developer.apple.com/documentation/uikit/keyboards_and_input/creating_a_custom_keyboard/configuring_open_access_for_a_custom_keyboard
- https://www.securing.pl/en/third-party-iphone-keyboards-vs-your-ios-application-security/