Harden cmd execution
This commit is contained in:
parent
063242f86c
commit
8ebad1735b
|
@ -4,6 +4,11 @@ APP_CMD="$(realpath "$(dirname "$BASH_SOURCE")/../app")"
|
|||
APP_DIR="$(dirname "$APP_CMD")"
|
||||
source "$APP_DIR/env"
|
||||
if [ -f "$APP_DIR/cmd/$1" ]; then
|
||||
if ! [[ "$(realpath "$APP_DIR/cmd/$1")" == "$APP_DIR/cmd/"* ]]; then
|
||||
echo "ERROR: Action \"$1\" not found, use: \"$0\" help" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$APP_DIR/cmd/$1"
|
||||
exit 0
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue