Sockets secure implementations

Rebased on `master`.
Add a TODO here to avoid this copy by creating a new PluginResult overload