1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 16:40:07 -07:00

kiss: more relaxed sanitization as per POSIX globbing spec.

This commit is contained in:
Dylan Araps 2019-10-01 22:48:30 +03:00
parent 718b774f3c
commit bae681f84f

5
kiss
View File

@ -858,9 +858,12 @@ args() {
# Unless this is a search, sanitize the user's input. The call to # Unless this is a search, sanitize the user's input. The call to
# 'pkg_find()' supports basic globbing, ensure input doesn't expand # 'pkg_find()' supports basic globbing, ensure input doesn't expand
# to anything except for when this behavior is needed. # to anything except for when this behavior is needed.
#
# This handles the globbing characters '*', '!', '[' and ']' as per:
# https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
[ "$action" != search ] && [ "$action" != s ] && [ "$action" != search ] && [ "$action" != s ] &&
case $* in case $* in
*[!a-zA-Z0-9_-]*) *'*'*|*'!'*|*'['*|*']'*)
log kiss "$action $*" log kiss "$action $*"
die "Arguments contain invalid characters" die "Arguments contain invalid characters"
;; ;;