fix: restrict domain names to alphanumeric characters (#4104)

* fix: restrict domain names to alphanumeric characters

* improve error message
This commit is contained in:
Livio Spring
2022-08-03 09:25:25 +02:00
committed by GitHub
parent b4d948cc75
commit 6b30be77e6
6 changed files with 57 additions and 0 deletions

View File

@@ -52,6 +52,51 @@ func TestCommandSide_AddInstanceDomain(t *testing.T) {
err: caos_errs.IsErrorInvalidArgument,
},
},
{
name: "invalid domain ', error",
fields: fields{
eventstore: eventstoreExpect(
t,
),
},
args: args{
ctx: context.Background(),
domain: "hodor's-org.localhost",
},
res: res{
err: caos_errs.IsErrorInvalidArgument,
},
},
{
name: "invalid domain umlaut, error",
fields: fields{
eventstore: eventstoreExpect(
t,
),
},
args: args{
ctx: context.Background(),
domain: "bücher.ch",
},
res: res{
err: caos_errs.IsErrorInvalidArgument,
},
},
{
name: "invalid domain other unicode, error",
fields: fields{
eventstore: eventstoreExpect(
t,
),
},
args: args{
ctx: context.Background(),
domain: "🦒.ch",
},
res: res{
err: caos_errs.IsErrorInvalidArgument,
},
},
{
name: "domain already exists, precondition error",
fields: fields{