mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
mk: hardened PWD check (deny symlinks)
we check if the first argument is "./mk" and bail if not, which forces you to be in the xbmk work directory. however, this check is flawed because symlinks were still possible. this patch prevents a same-named symlink "mk" pointing to the real mk from being used. this hardening is necessary, due to several built-in assumptions inherent within the design of xbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -5,7 +5,10 @@
|
|||||||
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
if [ "$0" != "./mk" ]; then
|
ispwd="true"
|
||||||
|
[ "$0" = "./mk" ] || ispwd="false"
|
||||||
|
[ "$ispwd" = "true" ] && [ -L "mk" ] && ispwd="false"
|
||||||
|
if [ "$ispwd" = "false" ]; then
|
||||||
printf "You must run this in the proper work directory.\n" 1>&2
|
printf "You must run this in the proper work directory.\n" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user