# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2021 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-network
profile gvfsd-network @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/dconf-write>

  #aa:dbus own bus=session name=org.gtk.vfs.mountpoint_@{int}

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

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

  dbus send bus=session path=/org/gtk/vfs/mounttracker
       interface=org.gtk.vfs.MountTracker
       member={MountLocation,LookupMount,RegisterMount}
       peer=(name=:*, label=gvfsd),

  dbus send bus=session path=/org/gtk/vfs/Daemon
       interface=org.gtk.vfs.Daemon
       member=GetConnection
       peer=(name=:*, label=gvfsd-dnssd),

  dbus receive bus=session path=/org/gtk/vfs/Daemon
       interface=org.gtk.vfs.Daemon
       member=GetConnection
       peer=(name=:*, label=gnome-control-center),

  @{exec_path} mr,

  /usr/share/glib-2.0/schemas/gschemas.compiled r,

  owner @{run}/user/@{uid}/gvfsd/ rw,
  owner @{run}/user/@{uid}/gvfsd/socket-@{rand8} rw,

  include if exists <local/gvfsd-network>
}

# vim:syntax=apparmor
