# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2021-2022 Mikhail Morfikov
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{lib}/{,gvfs/}gvfsd
profile gvfsd @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/nameservice-strict>

  signal receive set=usr1 peer=pacman,

  #aa:dbus own bus=session name=org.gtk.vfs.Daemon
  #aa:dbus own bus=session name=org.gtk.vfs.MountTracker path=/org/gtk/vfs/mounttracker

  dbus send bus=session path=/org/gtk/vfs/mountable
       interface=org.gtk.vfs.Mountable
       member=Mount
       peer=(name=:*, label=gvfsd-*),

  dbus receive bus=session path=/org/gtk/gvfs/exec_spaw/@{int}
       interface=org.gtk.vfs.Spawner
       member=Spawned
       peer=(name=:*, label=gvfsd-*),

  dbus receive bus=session
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=:*, label=gnome-shell),

  @{exec_path} mr,

  @{sh_path}              rix,
  @{lib}/{,gvfs/}gvfsd-*  rpx,

  /usr/share/gvfs/{,**} r,

  owner @{run}/user/@{uid}/gvfs/ rw,
  owner @{run}/user/@{uid}/gvfsd/ rw,

  owner @{PROC}/@{pid}/fd/ r,

  include if exists <local/gvfsd>
}

# vim:syntax=apparmor
