Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce XDP_APP_INFO_KIND_CONTAINERS1 which gets all information from D-Bus #1268

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Commits on Jan 23, 2024

  1. device: Removes the Device portal

    A shell of its former self remains which informs any potential user
    about the removal.
    
    The Device portal is, to the best of our knowledge, not used by any
    component. It's also weird because it's not a portal expoed to clients
    which caused confusion.
    
    The service it provides is also provided by the permission store, minus
    the ability to map from arbitrary PID to an app id. This PID to app id
    mapping isn't something that can be done in general and is most likely
    broken when the PID is not of the xdg-dbus-proxy.
    swick committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    8549bc8 View commit details
    Browse the repository at this point in the history
  2. utils: Make unused functions private

    One was a left-over and for the other we just removed the last users.
    swick committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    b18b893 View commit details
    Browse the repository at this point in the history
  3. utils: Add xdp_app_info_is_flatpak

    This will become useful once we support the dbus Containers1 interface
    and a new XDP_APP_INFO kind can still refer to a flatpak.
    swick committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    bd33109 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b9ad755 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    fa954ce View commit details
    Browse the repository at this point in the history
  6. utils: Move xdp_get_app_info_from_pid to xdp_connection_lookup_app_in…

    …fo_sync
    
    This will make it easier to follow which method of identiying an app
    will be used under what conditions.
    swick committed Jan 23, 2024
    Configuration menu
    Copy the full SHA
    0793641 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2024

  1. utils: Get rid of tri-state app info creation

    Instead of returning either NULL with error, NULL without error and
    non-NULL without error, adhere to GLib convention and return either TRUE
    with an out param set or FALSE with an error set.
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    6bb06d7 View commit details
    Browse the repository at this point in the history
  2. utils: Use GetConnectionCredentials to fetch the PID and pidfd

    The org.fdo.DBus.GetConnectionCredentials method gives us both a PID
    (ProcessID) and a pidfd (ProcessFD) in one roundtrip. It fails when the
    PID can't be retrieved but allows the pidfd to be -1.
    
    The pidfd will become useful for host and Containers1 clients later.
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    4e5eb41 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    df88e79 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1537fd5 View commit details
    Browse the repository at this point in the history
  5. utils: Fetch Containers1 metadata

    Returns a GVariant containign all the metadata that a container engine
    like flatpak has set on the socket for this app instance. This contains
    the container type, app id, instance id and additional arbitrary
    metadata such as the desktop file name.
    
    If the D-Bus broker doesn't support the Containers1 interface or the app
    using the portal is not running in a container, we fall back to the
    other ways of identifying apps.
    
    This specifically means it's safe to run a D-Bus broker which supports
    Containers1 while flatpak doesn't. Eventually we want to remove the
    flatpak and snap specific paths at which point it's a requirement to
    have a Containers1 capable flatpak.
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    4d1243e View commit details
    Browse the repository at this point in the history
  6. utils: Make pid mappings via pidns more generic

    Both host apps and Containers1 apps can do pid mappings via pidfd. This
    is some prep work for that.
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    7315913 View commit details
    Browse the repository at this point in the history
  7. utils: Support pid/tid mapping for host apps

    Do some best effort pid remapping for host apps. This will only work
    when the D-Bus broker supports pidfd (ProcessFD).
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    ca85d7e View commit details
    Browse the repository at this point in the history
  8. utils: Introduce XDP_APP_INFO_KIND_CONTAINERS1

    This new app kind is authenticated by D-Bus and x-d-p gets all the
    information about the app from D-Bus which itself get the information
    from the sandbox engine which set up the sandbox of the app.
    
    Currently only flatpak and dbus (dbus-daemon) supports this mechanism
    but it can be supported by any other sandbox engine, such as snap and
    firejail.
    
    This also means that an app with XDP_APP_INFO_KIND_CONTAINERS1 can still
    be a flatpak or a snap app.
    
    The goal is to make as many paths in x-d-p agnostic to the actual
    sandbox engine and handle all XDP_APP_INFO_KIND_CONTAINERS1 apps the
    same. Eventually we can then remove any other XDP_APP_INFO_KIND
    variants.
    
    This commit sets up a XdpAppInfo object with all the metadata x-d-p will
    need. The follow up commit implements various XdpAppInfo
    functionalities.
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    ba4ab57 View commit details
    Browse the repository at this point in the history
  9. utils: Implement XdpAppInfo utils for KIND_CONTAINERS1

    Uses some of the metadata from Containers1 directly and falls back to
    the flatpak path in some cases.
    
    Some of the fallbacks can be removed once the D-Bus broker supports ACL
    and we can get rid of xdg-dbus-proxy.
    
    The path remapping and tryexec functionalities are not implemented right
    now.
    swick committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    b342409 View commit details
    Browse the repository at this point in the history