# 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>

@{name} = firefox{,.sh,-esr,-bin}
@{lib_dirs} = @{lib}/@{name} /opt/@{name}
@{config_dirs} = @{HOME}/.mozilla/

@{exec_path} = @{lib_dirs}/vaapitest
profile firefox-vaapitest @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/graphics>
  include <abstractions/nameservice-strict>

  network netlink raw,

  @{exec_path} mr,

  owner @{tmp}/@{name}/.parentlock rw,

  deny @{config_dirs}/firefox/*/.parentlock rw,
  deny @{config_dirs}/firefox/*/startupCache/** r,
  deny @{user_cache_dirs}/mozilla/firefox/*/startupCache/* r,
  deny @{user_share_dirs}/gnome-shell/session.gvdb rw,

  include if exists <local/firefox-vaapitest>
}

# vim:syntax=apparmor
