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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{lib}/epiphany-search-provider
profile epiphany-search-provider @{exec_path} {
  include <abstractions/base>
  include <abstractions/dconf-write>
  include <abstractions/enchant>
  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,

  @{exec_path} mr,

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

  owner @{user_cache_dirs}/epiphany/{,**} rwk,
  owner @{user_share_dirs}/epiphany/{,**} rwk,

  owner @{tmp}/ContentRuleList@{rand6} rw,
  owner @{tmp}/Serialized* rw,

        @{sys}/devices/virtual/dmi/id/chassis_type r,
        @{sys}/firmware/acpi/pm_profile r,
  owner @{sys}/fs/cgroup/user.slice/user-@{uid}.slice/user@@{uid}.service/app.slice/*org.gnome.Epiphany.SearchProvider.slice/*/memory.* r,
  owner @{sys}/fs/cgroup/user.slice/user-@{uid}.slice/user@@{uid}.service/session.slice/dbus.service/memory.* r,

        @{PROC}/driver/nvidia/params r,
        @{PROC}/modules r,
        @{PROC}/sys/dev/i915/perf_stream_paranoid r,
        @{PROC}/sys/net/ipv6/conf/all/disable_ipv6 r,
        @{PROC}/zoneinfo r,
  owner @{PROC}/@{pid}/cgroup r,
  owner @{PROC}/@{pid}/cmdline r,
  owner @{PROC}/@{pid}/smaps r,
  owner @{PROC}/@{pid}/statm r,

  deny @{user_share_dirs}/gvfs-metadata/* r,

  include if exists <local/epiphany-search-provider>
}

# vim:syntax=apparmor
