# 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"
@{domain} = org.chromium.Chromium
@{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?Mail
@{att} = /att/protonmail/
profile protonmail /{{,usr/}bin/proton-mail,opt/proton-mail/Proton?Mail}  flags=(attach_disconnected,attach_disconnected.path=@{att},complain) {
  include <abstractions/attached/base>
  include <abstractions/common/electron>
  include <abstractions/secrets-service>

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

  # I need a proof for this, it is not common for such a program
  # io_uring sqpoll,

  @{exec_path} mrix,

  @{open_path}         rpx -> child-open-strict,

  include if exists <local/protonmail>
}

# vim:syntax=apparmor
