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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/gitg
profile gitg @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/bus/org.freedesktop.secrets>
  include <abstractions/dconf-write>
  include <abstractions/desktop>
  include <abstractions/nameservice-strict>
  include <abstractions/ssl_certs>

  network inet dgram,
  network inet6 dgram,
  network inet stream,
  network inet6 stream,
  network netlink raw,

  @{exec_path} mr,

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

  owner @{user_projects_dirs}/   rw,
  owner @{user_projects_dirs}/** rwkl -> @{user_projects_dirs}/**,
  owner @{user_projects_dirs}/**/.git/hooks/* rix,

  owner @{user_config_dirs}/git/{,*} rw,

  owner @{user_share_dirs}/gitg/{,**} rw,

  @{run}/mount/utab r,

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

  include if exists <local/gitg>
}

# vim:syntax=apparmor
