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

abi <abi/4.0>,
include <tunables/global>

@{name} = vesktop
@{lib_dirs} = @{lib}/@{name}
@{config_dirs} = @{user_config_dirs}/@{name}
@{cache_dirs} = @{user_cache_dirs}/@{name}

@{exec_path} = @{bin}/vesktop
profile vesktop @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/audio-client>
  include <abstractions/common/electron>
  include <abstractions/nameservice-strict>
  include <abstractions/p11-kit>
  include <abstractions/user-download-strict>
  include <abstractions/video>

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

  @{exec_path} mr,

  @{bin}/speech-dispatcher rPx,
  @{open_path}             rPx -> child-open,

  owner /tmp/.org.chromium.Chromium.@{rand6} mr,
  owner @{run}/user/@{uid}/discord-ipc-@{int} rw,

  @{sys}/devices/@{pci}/usb@{int}/**/interface r,

        @{PROC}/@{pid}/cmdline r,
  owner @{PROC}/@{pid}/task/@{tid}/comm rw,

  owner /dev/ r,

  deny       /dev/tty rw,
  deny owner /dev/tty@{int} rw,

  include if exists <local/vesktop>
}

# vim:syntax=apparmor
