# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2018-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>

@{name} = opera{,-beta,-developer}
@{lib_dirs} = @{lib}/@{multiarch}/@{name}
@{config_dirs} = @{user_config_dirs}/@{name}

@{exec_path} = @{lib_dirs}/opera_crashreporter
@{att} = ""
profile opera-crashreporter /{,usr/}lib{,exec,32,64}/*-linux-gnu*/opera{,-beta,-developer}/opera_crashreporter flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/fontconfig-cache-read>
  include <abstractions/fonts>
  include <abstractions/freedesktop.org>
  include <abstractions/nameservice-strict>
  include <abstractions/ssl_certs>

  ptrace (trace, read) peer=opera,

  @{exec_path} mr,

  owner @{config_dirs}/crash_count.txt rwk,
  owner @{config_dirs}/GPUCache/data_* r,
  owner @{config_dirs}/GPUCache/index r,

  owner @{PROC}/@{pids}/cmdline r,
  owner @{PROC}/@{pids}/environ r,
  owner @{PROC}/@{pids}/task/ r,

  include if exists <local/opera-crashreporter>
}

# vim:syntax=apparmor
