Skip to content

Usage with sandboxed NM hosts #9

@PhrozenByte

Description

@PhrozenByte

When I was thinking about how the new XDG Native Messaging Proxy could be used with KeePassXC, I had some difficulty understanding how it would work with sandboxed Native Messaging (NM) hosts (such as a sandboxed KeePassXC communicating with a sandboxed Firefox browser). Also see keepassxreboot/keepassxc#12327

Since documentation is currently limited, let me recap what I understood about how XDG Native Messaging Proxy works. Please correct me if I'm wrong - I might absolutely be wrong since I'm neither a Flatpak dev, nor a browser dev, not even a C dev in general:

From my understanding the new approach basically means that a xdg-native-messaging-proxy service runs on the host system that implements NM just as if the browser isn't sandboxed. One service handles NM for both Firefox and Chromium at the same time. For non-sandboxed NM hosts basically nothing changes: Applications just have to copy their NM manifest to one of the NM search paths (see service implementation; distributions might force different search paths with the XNMP_HOST_LOCATIONS env variable) as before, xdg-native-messaging-proxy then invokes the NM host binary specified in the NM manifest (just as a non-sandboxed browser would do) and proxies communication to the sandboxed browser via the new org.freedesktop.NativeMessagingProxy DBus interface. In general, nothing needs to be changed code-wise for non-sandboxed NM hosts.

What I don't really understand yet is how xdg-native-messaging-proxy works with NM hosts running within a sandbox:

Is the sandboxed NM host supposed to talk to the xdg-native-messaging-proxy service running on the host system? If yes, how is this accomplished? I neither see how a sandboxed NM host could add NM manifests to the NM search path on the host system, nor methods within the DBus interface to allow sandboxed NM hosts to talk to xdg-native-messaging-proxy via DBus.

Or is the sandboxed NM host supposed to talk directly to the sandboxed browser via the org.freedesktop.NativeMessagingProxy DBus interface (possibly not directly, but using a second xdg-native-messaging-proxy service running within the application's sandbox)? Is it even possible that browsers connect to multiple xdg-native-messaging-proxy instances (e.g. the first running on the host system and the second running within KeePassXC's sandbox) at the same time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions