feat: add check for hardened_malloc flatpak preload (#412)

* updated has_permission to use regex matching

* added flatpak check for hardened_malloc

* changed hasPermission to maintain old behavior for strings
This commit is contained in:
Rubiginosa
2024-09-10 13:33:14 -04:00
committed by GitHub
parent 8a0e957c8d
commit 8333bcf2f5

View File

@@ -356,7 +356,7 @@ audit-secureblue:
local line=$(grep "^${prefix}=" <<< "$permissions" | sed -e "s/^${prefix}=//" -e "s/#.*//") local line=$(grep "^${prefix}=" <<< "$permissions" | sed -e "s/^${prefix}=//" -e "s/#.*//")
IFS=';' read -r -a list <<< "$line" IFS=';' read -r -a list <<< "$line"
for p in ${list[@]}; do for p in ${list[@]}; do
if [[ "$p" == "$query" ]]; then if [[ "$p" =~ ^$query$ ]]; then
return return
fi fi
done done
@@ -572,6 +572,10 @@ audit-secureblue:
status="$STATUS_FAILURE" status="$STATUS_FAILURE"
warnings+=("> $f has x11 access!") warnings+=("> $f has x11 access!")
fi fi
if ! hasPermission "$permissions" "LD_PRELOAD" .*"/libhardened_malloc.so"; then
status="$STATUS_FAILURE"
warnings+=("> $f is not using hardened_malloc!")
fi
flatpak_test_string="Auditing $f" flatpak_test_string="Auditing $f"
print_status "$flatpak_test_string" "$status" print_status "$flatpak_test_string" "$status"
for warning in "${warnings[@]}"; do for warning in "${warnings[@]}"; do