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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{lib}/gnome-control-center-goa-helper
profile gnome-control-center-goa-helper @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-accessibility>
  include <abstractions/bus-session>
  include <abstractions/bus-system>
  include <abstractions/bus/org.a11y>
  include <abstractions/bus/org.freedesktop.Avahi>
  include <abstractions/bus/org.gtk.vfs.MountTracker>
  include <abstractions/dconf-write>
  include <abstractions/gnome-strict>
  include <abstractions/graphics>
  include <abstractions/nameservice-strict>
  include <abstractions/p11-kit>
  include <abstractions/ssl_certs>

  network inet dgram,
  network inet6 dgram,
  network inet stream,
  network inet6 stream,
  network netlink raw,

  signal (send) set=(kill) peer=bwrap,

  #aa:dbus own bus=session name=org.gnome.Settings.GoaHelper

  dbus send bus=session path=/org/gnome/OnlineAccounts
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name=:*, label=goa-daemon),

  @{exec_path} mr,

  @{bin}/bwrap  rPUx,

  @{lib}/{,@{multiarch}/}webkit{2,}gtk-*/WebKitNetworkProcess rix,

  /usr/share/cracklib/* r,
  /usr/share/publicsuffix/public_suffix_list.dafsa r,

  owner @{user_config_dirs}/goa-1.0/accounts.conf r,

  owner @{user_cache_dirs}/gnome-control-center-goa-helper/{,**} rwl,

  owner @{user_share_dirs}/gnome-control-center-goa-helper/{,**} rwk,
  owner @{user_share_dirs}/webkitgtk/{,**} rw,
  owner @{user_share_dirs}/webkitgtk/localstorage/{,**} rwk,

  owner @{run}/user/@{uid}/webkitgtk/{,**} rw,

  owner @{sys}/fs/cgroup/user.slice/user-@{uid}.slice/user@@{uid}.service/app.slice/app-gnome-org.gnome.Settings-@{int}.scope/memory.* r,

        @{PROC}/sys/net/ipv6/conf/all/disable_ipv6 r,
        @{PROC}/zoneinfo r,
  owner @{PROC}/@{pid}/cgroup r,
  owner @{PROC}/@{pid}/cmdline r,

  include if exists <local/gnome-control-center-goa-helper>
}

# vim:syntax=apparmor
