Class ApplicationCredentials

Class Documentation

class ApplicationCredentials

Public Functions

ApplicationCredentials(mir::frontend::SessionCredentials const &creds)
pid_t pid() const
uid_t uid() const
gid_t gid() const
std::expected<std::string, std::error_code> apparmor_label() const

The AppArmor label of the connecting process.

If Mir was built without AppArmor support this will return ENOTSUP. Otherwise, returns the label of the connecting process or the error.

bool from_application_sandbox() const

Is the client running within an application sandbox?

Processes running within application sandbox systems such as Snap or Flatpak can be meaningfully identified and their privileges limited.

Connections from processes running within an application sandbox should have more limited access to sensitive Wayland protocols — applications are expected to use Desktop Portals to acquire mediated access to any extra functionality they require.

Because of this, this check should only be used to restrict permissions; it cannot be safely used to provide extra permissions only to sandboxed processes.

Note

This check has false-positives — it is possible for unprivileged unconfined processes to impersonate running in an application sandbox.

std::optional<std::string> snap_name() const

The name of the Snap this client is from.

Note

The security guarantees of this are subtle. For any confined snap this will return the true name. However, any unconfined process — either outside of a snap, or from an unconfined snap — can impersonate any snap on the system.

std::optional<std::string> flatpak_id() const

The name of the Flatpak this client is from.