# 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} = torbrowser "tor browser"
@{lib_dirs} = @{user_share_dirs}/torbrowser/tbb/@{arch}/tor-browser/Browser/ @{HOME}/.tb/tor-browser/Browser/
@{data_dirs} = @{lib_dirs}/TorBrowser/Data/
@{config_dirs} = @{data_dirs}/Browser/profile.default/
@{cache_dirs} = @{data_dirs}/Browser/Caches

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

  network netlink raw,

  @{exec_path} mr,

  deny @{lib_dirs}/{,browser/}omni.ja r,
  deny @{cache_dirs}/profile.default/startupCache/* r,
  deny @{config_dirs}/.parentlock rw,
  deny @{config_dirs}/extensions/*.xpi r,

  include if exists <local/torbrowser-vaapitest>
}

# vim:syntax=apparmor
