feat: prohibit non-dns names for apps and process types

This is necessary for ensuring ssl certificates can be auto-retrieved for apps, and also easing integration into schedulers that use names and process types as part of DNS records.

As well, this fixes an issue where we may potentially have invalid DNS entries when adding apps to custom networks.

Closes #4102
Closes #4114
This commit is contained in:
Jose Diaz-Gonzalez
2020-09-09 20:06:53 -04:00
parent 017cfef6a2
commit 0f514f300e
6 changed files with 40 additions and 4 deletions

View File

@@ -185,13 +185,13 @@ is_valid_app_name() {
local APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "APP must not be null"
if [[ "$APP" =~ ^[a-z].* ]] || [[ "$APP" =~ ^[0-9].* ]]; then
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]]; then
if [[ ! $APP =~ [A-Z] ]] && [[ ! $APP =~ [:] ]] && [[ ! $APP =~ [_] ]]; then
return 0
fi
fi
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "${DOKKU_ROOT:?}/$APP"
dokku_log_fail "App name must begin with lowercase alphanumeric character"
dokku_log_fail "App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores"
}
verify_app_name() {