feat: add verify_app_name calls to all shell subcommands

Without this, folks could potentially run commands against invalid applications.
This commit is contained in:
Jose Diaz-Gonzalez committed 2020-12-27 15:14:11 -05:00
1 parent 03e80a76b6
commit fd162f8895
28 files changed
+17 -32

No files matched your search

+1
View File
@@ -112,5 +112,6 @@ cmd-nginx-validate-config() {
fi
declare APP="$1" FLAG="$2"
verify_app_name "$APP"
validate_nginx "$APP" "$FLAG"
}
+2 -2
View File
@@ -6,9 +6,9 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
cmd-nginx-logs() {
declare desc="display app nginx logs from command line"
declare cmd="$1"
declare cmd="$1" APP="$2"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$APP"
nginx_logs "$@"
}
@@ -8,9 +8,9 @@ cmd-nginx-build-config() {
declare cmd="nginx:build-config"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$APP"
dokku_log_warn "Deprecated: Please use proxy:build-config"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
local PROXY_APP_TYPE
PROXY_APP_TYPE="$(plugn trigger proxy-type "$APP")"
+1 -1
View File
@@ -10,8 +10,8 @@ cmd-nginx-set() {
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("access-log-format" "access-log-path" "bind-address-ipv4" "bind-address-ipv6" "disable-custom-config" "error-log-path" "hsts" "hsts-include-subdomains" "hsts-preload" "hsts-max-age" "proxy-read-timeout" "proxy-buffer-size" "proxy-buffering" "proxy-buffers" "proxy-busy-buffers-size")
verify_app_name "$APP"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then