# apparmor.d - Full set of apparmor profiles
# 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}/baloo_file @{lib}/{,kf6/}baloo_file
@{exec_path} += @{lib}/@{multiarch}/{,libexec/}baloo_file
profile baloo @{exec_path} {
  include <abstractions/base>
  include <abstractions/deny-sensitive-home>
  include <abstractions/disks-read>
  include <abstractions/fontconfig-cache-write> 
  include <abstractions/graphics>
  include <abstractions/kde-strict>
  include <abstractions/nameservice-strict>
  include <abstractions/private-files-strict>

  network netlink raw,

  @{exec_path} mr,

  @{lib}/{,kf6/}baloo_file_extractor rix,

  /usr/share/poppler/{,**} r,
  /usr/share/desktop-base/kf5-settings/baloofilerc r,

  /etc/fstab r,
  /etc/machine-id r,
  /etc/xdg/baloofilerc r,

  # Allow to search user files
  owner @{HOME}/{,**} r,
  owner @{MOUNTS}/{,**} r,
  owner @{tmp}/*/{,**} r,

  owner @{user_config_dirs}/#@{int} rw,
  owner @{user_config_dirs}/baloofilerc rwl,
  owner @{user_config_dirs}/baloofilerc.lock rwkl,

  owner @{user_share_dirs}/baloo/{,**} rwk,

  @{sys}/bus/ r,
  @{sys}/bus/*/devices/ r,

  owner @{PROC}/@{pid}/mounts r,
  owner @{PROC}/@{pid}/mountinfo r,

  /dev/tty r,

  include if exists <local/baloo>
}

# vim:syntax=apparmor
