Products › lamco-dbus-tools › Docs
D-Bus in sandboxes: Flatpak, Snap and Firejail grants
D-Bus in sandboxes: How Flatpak, Snap and Firejail grants work, how lamco-dbus-tools reads them and tests them against the real proxy, and what it reports.
Describes version 0.4.1, with checks made on 2026-11-28 and 29 on Fedora 45 with Flatpak 1.18.4. The commands are in listing what applications may reach, testing a grant and looking from inside a sandbox.
A sandboxed application doesn't see the whole bus. What it's let through is a grant, and a grant can be read, tested and audited.
How the grants work
Flatpak puts a filtering proxy between the application and each bus. The application's metadata names what it may talk to and own, and Flatpak adds its own: The application's own name prefix, and the portals. Users and administrators can widen or narrow a grant with overrides.
Snap has no proxy. A connection between a snap's plug and a slot becomes rules in a security profile, and the bus daemon asks the kernel's security module whether each message is allowed.
Firejail wraps the same proxy Flatpak uses. Bare bubblewrap and containers that mount a bus socket have no filter at all, and leave no application identity on the bus beyond a process.
Reading a grant
From files, with nothing running: The application's metadata, the overrides in their order, and the portal's permission store.
From a running instance: Flatpak records each instance in a directory, and starts the proxy with the grant as its arguments. Those arguments can be read back by another process of the same user. Checked on a running text editor:
--filter
--own=org.gnome.TextEditor.*
--own=org.mpris.MediaPlayer2.org.gnome.TextEditor.*
--talk=org.gtk.vfs.*
--talk=org.freedesktop.FileManager1
--call=org.freedesktop.portal.*=*
--broadcast=org.freedesktop.portal.*=@/org/freedesktop/portal/*
The application's metadata named two of those. Flatpak added the rest. A second set followed for the accessibility bus.
Testing a grant
Two ways, which check each other.
- By reading the rules. The proxy's filter is small enough to evaluate: Three levels (see, talk, own), call and broadcast rules, a wildcard suffix, and one subtlety, that a connection inherits the policy of every name it ever owned.
- By running the real proxy. The host's own proxy is started with the application's exact arguments in front of a bus, and probes are sent through it. Checked with the grant above: Owning a name under the application's prefix was allowed, and every other name was hidden. This asks the filter that's installed, whatever its version.
The two agreed on every probe of every run: 385 of a Fedora application's grant and 390 of its running
proxy, against Fedora's proxy, and up to 765 here against Debian's (docs/measurements/stage-7/README.md).
The second way matters because a proxy's version number can't say whether it has a given fix. Distributions patch without changing it. Three flaws in the filter were fixed in 2026 (CVE-2026-34080, CVE-2026-93676 and CVE-2026-94422), and one Debian package reporting version 0.1.6 carries all three fixes.
Looking from inside
The static build runs inside a sandbox from the application's own data directory. Checked: From inside, the text editor saw 11 names where the session bus had 134, and a call to the service manager answered that no such service exists.
What an exposure audit reports
- A grant that amounts to leaving the sandbox: The session bus socket itself, the service manager, the service that runs commands on the host, the permission store, the desktop shell, settings storage, the file-access services.
- A grant wider than what the application was seen to use.
- A proxy that fails a behavior probe for a known flaw.
Flathub publishes how many applications hold which grants. On 2026-11-28, of 3,433 applications, 154 could talk to the host-command service and 182 to the keyring.
Limits
A monitor on the host sees one connection for a sandboxed application, the proxy's. See
what it can't see. The toolkit ties that connection back to the application by the proxy's process.
A Snap and a Firejail profile were examined live once, on 2026-11-30 on Ubuntu 24.04
(docs/measurements/snap-firejail/). Firejail was run with one profile, and a Snap with one test snap.