diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-10-01 19:34:34 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-10-01 19:34:34 +0000 |
commit | 314e93b4cb943125cb5d477df8887706aaedce54 (patch) | |
tree | ce2d3df0b192478f90da72d9f99522277e26d053 /kiss | |
parent | 6f0a78a965760e1507bc19434d2a2fe7f4245503 (diff) | |
download | cpt-314e93b4cb943125cb5d477df8887706aaedce54.tar.gz |
kiss: sanitize user input when needed
FossilOrigin-Name: 92f8cf9a72b3b512d1d68a418bb2d6eecbca62287a344dae0d746ebd50eacd11
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -845,6 +845,17 @@ args() { # arguments despite trapping the error ('|| :'). shift "$(($# > 0 ? 1 : 0))" + # 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. + [ "$action" != search ] && [ "$action" != s ] && + case $* in + *[!a-zA-Z0-9_-]*) + log kiss "$action $*" + die "Arguments contain invalid characters" + ;; + esac + # Parse some arguments earlier to remove the need to duplicate code. case $action in c|checksum|s|search) |