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

abi <abi/4.0>,

include <tunables/global>

@{lib_dirs} = /opt/microsoft/msedge{,-beta,-dev}

@{exec_path} = @{lib_dirs}/microsoft-edge{,-beta,-dev}
@{att} = /att/msedge-wrapper/
profile msedge-wrapper /opt/microsoft/msedge{,-beta,-dev}/microsoft-edge{,-beta,-dev}  flags=(attach_disconnected,attach_disconnected.path=@{att},complain) {
  include <abstractions/attached/base>
  include <abstractions/attached/consoles>

  @{exec_path} r,

  @{sh_path}                   rix,
  @{bin}/cat                   rix,
  @{bin}/dirname               rix,
  @{bin}/mkdir                 rix,
  @{bin}/readlink              rix,
  @{bin}/touch                 rix,
  @{bin}/which{,.debianutils}  rix,

  @{lib_dirs}/msedge   rpx,

  owner @{user_config_dirs}/msedge-flags.conf r,

  owner @{PROC}/@{pid}/fd/* rw,

  # File Inherit
  owner @{HOME}/.xsession-errors w,

  # Silencer
  deny @{user_share_dirs}/gvfs-metadata/* r,

  include if exists <local/msedge-wrapper>
}

# vim:syntax=apparmor
