Merge pull request #4129 from dokku/4102-prohibit-non-dns-names
Prohibit non-dns names for apps and process types
This commit is contained in:
@@ -739,7 +739,7 @@ func IsValidAppName(appName string) error {
|
||||
return fmt.Errorf("APP must not be null")
|
||||
}
|
||||
|
||||
r, _ := regexp.Compile("^[a-z0-9][^/:A-Z]*$")
|
||||
r, _ := regexp.Compile("^[a-z0-9][^/:_A-Z]*$")
|
||||
if r.MatchString(appName) {
|
||||
return nil
|
||||
}
|
||||
@@ -749,7 +749,7 @@ func IsValidAppName(appName string) error {
|
||||
os.RemoveAll(appRoot)
|
||||
}
|
||||
|
||||
return errors.New("App name must begin with lowercase alphanumeric character, and cannot include uppercase characters or colons")
|
||||
return errors.New("App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores")
|
||||
}
|
||||
|
||||
// VerifyAppName verifies app name format and app existence"
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user