fix: Strictly validate service names

We previously allowed a wide range of service names. As the service name is sometimes used to name databases, the name was actually more restricted than any character, resulting in services that wouldn't start. Going forward, only alphanumeric and underscore characters are allowed.

This only impacts service creation. Any services with invalid names should be migrated to a new service, with the data exported and imported as normal.

Closes dokku/dokku-redis#99
Closes dokku/dokku-mysql#47
Closes dokku/dokku-mongo#86
Closes dokku/dokku-redis#81
This commit is contained in:
Jose Diaz-Gonzalez
2019-03-09 00:17:30 -05:00
parent fe3d4d6329
commit 233a261a3f
3 changed files with 21 additions and 1 deletions

View File

@@ -10,3 +10,11 @@ load test_helper
run dokku "$PLUGIN_COMMAND_PREFIX:create"
assert_contains "${lines[*]}" "Please specify a name for the service"
}
@test "($PLUGIN_COMMAND_PREFIX:create) error when there is an invalid name specified" {
run dokku "$PLUGIN_COMMAND_PREFIX:create" d.erp
assert_failure
run dokku "$PLUGIN_COMMAND_PREFIX:create" d-erp
assert_failure
}