fabric8-services / fabric8-wit

wit stands for Work Item Tracker
http://devdoc.almighty.io/
Apache License 2.0
45 stars 86 forks source link

Space name validation #1693

Open corinnekrych opened 7 years ago

corinnekrych commented 7 years ago

When creating a space through the WIP api (outside fabric8-ui), a space name like corinne@sth.com is seen valid but will cause Forge service to fail. Forge service reuse the space to label its pipeline in OSO. the bug was discovered while writing APi test in https://github.com/fabric8io/fabric8-test/pull/221

baijum commented 7 years ago

What are the acceptable characters? Any issue with underscore and hyphen?

Add these constraints to DB?

alter table spaces drop constraint "spaces_name_check";
alter table spaces add constraint "spaces_name_check" CHECK (name ~ '^[a-zA-Z][a-zA-Z0-9_-]+');