From bae681f84f701127275c9d48a74a640a7c89e0b6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 1 Oct 2019 22:48:30 +0300 Subject: [PATCH] kiss: more relaxed sanitization as per POSIX globbing spec. --- kiss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index a05a46a..88a758f 100755 --- a/kiss +++ b/kiss @@ -858,9 +858,12 @@ args() { # Unless this is a search, sanitize the user's input. The call to # 'pkg_find()' supports basic globbing, ensure input doesn't expand # 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 ] && case $* in - *[!a-zA-Z0-9_-]*) + *'*'*|*'!'*|*'['*|*']'*) log kiss "$action $*" die "Arguments contain invalid characters" ;;