fix: ban the sort -V command (#755)

This commit is contained in:
Trevor Brown 2020-07-08 01:37:52 -04:00 committed by GitHub
parent 0de5f56b45
commit aef4ae8b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,9 @@ banned_commands=(
# defined in POSIX # defined in POSIX
column column
# does not work on alpine and should be grep -i either way # does not work on alpine and should be grep -i either way
"grep -y" "grep.* -y"
# sort -V isn't supported everywhere
"sort.*-V"
) )
setup() { setup() {
@ -30,7 +32,7 @@ teardown() {
# or expect an explicit comment at end of line, allowing it. # or expect an explicit comment at end of line, allowing it.
run bash -c "grep -nHR '$cmd' lib bin | grep -v '# asdf_allow: $cmd'" run bash -c "grep -nHR '$cmd' lib bin | grep -v '# asdf_allow: $cmd'"
echo "banned command $cmd: $output" echo "banned command $cmd: $output"
[ "$status" -eq 1 ] [ "$status" -eq 1 ]
[ "" == "$output" ] [ "" == "$output" ]
done done
} }