feat(profile): various security/linter improvement

- Ignore some rule from the linter
- Move some bin to subprofile
This commit is contained in:
Alexandre Pujol 2025-08-15 18:03:36 +02:00
parent aafcd1c861
commit c29b4ba536
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
10 changed files with 18 additions and 18 deletions

View file

@ -48,6 +48,7 @@ profile dpkg-scripts @{exec_path} {
@{sbin}/ldconfig.real Cx -> ldconfig, @{sbin}/ldconfig.real Cx -> ldconfig,
@{sbin}/update-rc.d Cx -> rc, @{sbin}/update-rc.d Cx -> rc,
#aa:lint ignore=too-wide
# Maintainer scripts can legitimately start/restart anything # Maintainer scripts can legitimately start/restart anything
# PU is only used as a safety fallback. # PU is only used as a safety fallback.
@{bin}/** PUx, @{bin}/** PUx,

View file

@ -61,8 +61,8 @@ profile reportbug @{exec_path} {
/usr/share/bug/*/{control,presubj} r, /usr/share/bug/*/{control,presubj} r,
#aa:lint ignore=too-wide
/etc/** r, /etc/** r,
/etc/reportbug.conf r,
owner @{HOME}/ r, # For shell pwd owner @{HOME}/ r, # For shell pwd
owner @{HOME}/.reportbugrc{,~} rw, owner @{HOME}/.reportbugrc{,~} rw,

View file

@ -9,6 +9,7 @@ include <tunables/global>
@{exec_path} = @{bin}/pacdiff @{exec_path} = @{bin}/pacdiff
profile pacdiff @{exec_path} flags=(attach_disconnected) { profile pacdiff @{exec_path} flags=(attach_disconnected) {
include <abstractions/base> include <abstractions/base>
include <abstractions/app/editor>
capability dac_read_search, capability dac_read_search,
capability mknod, capability mknod,
@ -30,11 +31,6 @@ profile pacdiff @{exec_path} flags=(attach_disconnected) {
@{bin}/rm rix, @{bin}/rm rix,
@{bin}/sed rix, @{bin}/sed rix,
@{bin}/tput rix, @{bin}/tput rix,
@{bin}/vim rix,
owner @{HOME}/.viminfo{,.tmp} rw,
owner @{user_cache_dirs}/vim/{,**} rw,
# packages files # packages files
/ r, / r,

View file

@ -19,6 +19,7 @@ profile baobab @{exec_path} {
@{open_path} rPx -> child-open-help, @{open_path} rPx -> child-open-help,
#aa:lint ignore=too-wide
# As a directory tree analyzer it needs full access to the filesystem # As a directory tree analyzer it needs full access to the filesystem
/ r, / r,
/** r, /** r,

View file

@ -28,6 +28,7 @@ profile file-roller @{exec_path} {
# Archivers # Archivers
@{archive_path} rix, @{archive_path} rix,
#aa:lint ignore=too-wide
# Full access to user's data # Full access to user's data
@{MOUNTS}/** rw, @{MOUNTS}/** rw,
owner @{HOME}/** rw, owner @{HOME}/** rw,

View file

@ -19,14 +19,14 @@ profile mimetype @{exec_path} {
/usr/share/mime/aliases r, /usr/share/mime/aliases r,
/usr/share/mime/magic r, /usr/share/mime/magic r,
# To read files
owner /** r, #aa:lint ignore=too-wide
owner @{user_share_dirs}/mime/**.xml r, owner @{user_share_dirs}/mime/**.xml r,
owner @{user_share_dirs}/mime/globs r, owner @{user_share_dirs}/mime/globs r,
owner @{user_share_dirs}/mime/aliases r, owner @{user_share_dirs}/mime/aliases r,
owner @{user_share_dirs}/mime/magic r, owner @{user_share_dirs}/mime/magic r,
# To read files
/** r,
include if exists <local/mimetype> include if exists <local/mimetype>
} }

View file

@ -67,7 +67,7 @@ profile tomb @{exec_path} {
@{sbin}/btrfs rPx, @{sbin}/btrfs rPx,
@{sbin}/cryptsetup rPUx, @{sbin}/cryptsetup rPUx,
@{bin}/e2fsc rPUx, @{sbin}/e2fsck rPx,
@{sbin}/fsck rPx, @{sbin}/fsck rPx,
@{bin}/gpg{,2} rPx, @{bin}/gpg{,2} rPx,
@{bin}/lsblk rPx, @{bin}/lsblk rPx,

View file

@ -40,13 +40,10 @@ profile xarchiver @{exec_path} {
owner @{HOME}/.bz2 rw, owner @{HOME}/.bz2 rw,
/ r, #aa:lint ignore=too-wide
/home/ r, # Full access to user's data
#owner @{HOME}/ r, @{MOUNTS}/** rw,
#owner @{HOME}/** rw, owner @{HOME}/** rw,
@{MOUNTS}/ r,
@{MOUNTS}/** rw,
/tmp/ r,
owner @{tmp}/** rw, owner @{tmp}/** rw,
@{PROC}/@{pid}/mountinfo r, @{PROC}/@{pid}/mountinfo r,

View file

@ -171,6 +171,9 @@ _check_abstractions() {
_err abstractions "$file:$line_number" "deprecated abstraction '<$ABS/$absname>', use '<$ABS/${ABS_DEPRECATED[$absname]}>' instead" _err abstractions "$file:$line_number" "deprecated abstraction '<$ABS/$absname>', use '<$ABS/${ABS_DEPRECATED[$absname]}>' instead"
fi fi
done done
if [[ "$line" == *"<$ABS/ubuntu-"*">"* ]]; then
_err abstractions "$file:$line_number" "deprecated, ubuntu only abstraction '<$ABS/$absname>'"
fi
} }
readonly DIRECTORIES=('@{HOME}' '@{MOUNTS}' '@{bin}' '@{sbin}' '@{lib}' '@{tmp}' '_dirs}' '_DIR}') readonly DIRECTORIES=('@{HOME}' '@{MOUNTS}' '@{bin}' '@{sbin}' '@{lib}' '@{tmp}' '_dirs}' '_DIR}')
@ -222,7 +225,7 @@ readonly TRANSITION_MUST_PC=( # Must transition to 'Px'
ischroot who ischroot who
) )
readonly TRANSITION_MUST_C=( # Must transition to 'Cx' readonly TRANSITION_MUST_C=( # Must transition to 'Cx'
sysctl kmod pgrep pkexec sudo systemctl udevadm sysctl kmod pgrep pkill pkexec sudo systemctl udevadm
fusermount fusermount3 fusermount{,3} fusermount fusermount3 fusermount{,3}
nvim vim sensible-editor nvim vim sensible-editor
) )

View file

@ -761,6 +761,7 @@ ugc
umount.nfs umount.nfs
umount.nfs4 umount.nfs4
umount.udisks2 umount.udisks2
unbound
unconfined unconfined
undump.bt undump.bt
unix_chkpwd unix_chkpwd