makepkg: drop sudo permissions after use

Add the -k parameter to the sudo call to prevent caching of credientials.
This would (potentailly) stop a rogue sudo use within a PKGBUILD.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2024-05-05 14:27:20 +10:00
parent 6d85d9ae08
commit e1df19ee6f

View file

@ -241,7 +241,7 @@ run_pacman() {
cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}") cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}")
fi fi
elif type -p sudo >/dev/null; then elif type -p sudo >/dev/null; then
cmd=(sudo "${cmd[@]}") cmd=(sudo -k "${cmd[@]}")
else else
cmd=(su root -c "$cmdescape") cmd=(su root -c "$cmdescape")
fi fi