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

# Minimal set of rules for all gnome based UI application.

# !!! warning
#
#     In the future, this abstraction could be generalized and renamed to `gui`
#

  abi <abi/4.0>,

  include <abstractions/dconf-write>
  include <abstractions/gnome-strict>
  include <abstractions/graphics>

  /usr/share/@{profile_name}/{,**} r,

  owner @{user_cache_dirs}/@{profile_name}/ rw,
  owner @{user_cache_dirs}/@{profile_name}/** rwlk,

  owner @{user_config_dirs}/@{profile_name}/ rw,
  owner @{user_config_dirs}/@{profile_name}/** rwlk,

  owner @{user_share_dirs}/@{profile_name}/ rw,
  owner @{user_share_dirs}/@{profile_name}/** rwlk,

  owner @{user_state_dirs}/@{profile_name}/ rw,
  owner @{user_state_dirs}/@{profile_name}/** rwlk,

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

  # Provide statistical information about our own process
  owner @{PROC}/@{pid}/stat r,

  # Per man(5) proc, the kernel enforces that a thread may only modify its comm
  # value or those in its thread group.
  owner @{PROC}/@{pid}/task/@{tid}/comm rw,

  include if exists <abstractions/common/gnome.d>

# vim:syntax=apparmor
