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

abi <abi/4.0>,

include <tunables/global>

@{name} = proton-mail "Proton Mail"
@{lib_dirs} = /opt/@{name}
@{config_dirs} = @{user_config_dirs}/@{name}
@{cache_dirs} = @{user_cache_dirs}/@{name}

@{exec_path} = @{bin}/proton-mail /opt/proton-mail/Proton*
profile protonmail @{exec_path} flags=(complain) {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/bus/org.freedesktop.secrets>
  include <abstractions/common/electron>

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

  ptrace read peer=xdg-settings,

  @{exec_path} mrix,

  @{bin}/xdg-settings Px,
  @{open_path}        Px -> child-open,

  owner @{user_config_dirs}/ibus/bus/ r,

  @{sys}/devices/@{pci}/boot_vga r,

  owner @{tmp}/gtkprint_ppd_@{rand6} rw,

  include if exists <local/protonmail>

}

# vim:syntax=apparmor
