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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/pinentry-qt
profile pinentry-qt @{exec_path} {
  include <abstractions/base>
  include <abstractions/dri-enumerate>
  include <abstractions/fontconfig-cache-read>
  include <abstractions/fonts>
  include <abstractions/freedesktop.org>
  include <abstractions/gtk>
  include <abstractions/mesa>
  include <abstractions/nameservice-strict>
  include <abstractions/qt5-compose-cache-write>
  include <abstractions/qt5>
  include <abstractions/vulkan>
  include <abstractions/X>

  @{exec_path} mr,

  /usr/share/hwdata/pnp.ids r,
  /usr/share/icu/@{int}.@{int}/*.dat r,

  /var/lib/dbus/machine-id r,
  /etc/machine-id r,
  /etc/xdg/kdeglobals r,
  /etc/xdg/kwinrc r,

  owner @{user_cache_dirs}/#@{int} rw,
  owner @{user_cache_dirs}/icon-cache.kcache rw,

  owner @{user_config_dirs}/kdeglobals r,
  owner @{user_config_dirs}/kwinrc r,

  owner @{tmp}/xauth_@{rand6} r,
  owner /dev/shm/#@{int} rw,

  @{sys}/devices/system/node/ r,
  @{sys}/devices/system/node/node@{int}/meminfo r,

  owner @{PROC}/@{pid}/cmdline r,

  include if exists <local/pinentry-qt>
}
