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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/pipewire-pulse
profile pipewire-pulse @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/audio-client>
  include <abstractions/nameservice-strict>

  capability sys_ptrace,

  ptrace (read),

  @{exec_path} mr,

  @{bin}/pactl rix,

  /usr/share/pipewire/{,**} r,

  /etc/pipewire/{,**} r,

  /var/lib/dbus/machine-id r,
  /etc/machine-id r,

  / r,
  /.flatpak-info r,

  owner @{run}/user/@{uid}/pulse/pid w,
  owner @{tmp}/librnnoise-@{int}.so rm,

  @{sys}/devices/virtual/dmi/id/product_name r,
  @{sys}/devices/virtual/dmi/id/sys_vendor r,
  @{sys}/devices/virtual/dmi/id/board_vendor r,
  @{sys}/devices/virtual/dmi/id/bios_vendor r,

  include if exists <local/pipewire-pulse>
}
