At the moment we are implementing a WSO2 Identity Server and I am checking the configs. My goal was to enable spaces in usernames. Those are not allowed by default and protected by some regexes. I do not understand why there is a difference in the regexes for Frontend and Backend.
Here is the snippet taken from repository/conf/user-mgt.xml
:
<Property name="UsernameJavaRegEx">[a-zA-Z0-9._\-|//]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="RolenameJavaRegEx">[a-zA-Z0-9._\-|//]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
First thing is that I do not get it why those regexes for username/rolename are different for frontend/backend While the ones for the passwords are equal ? Shouldnt they all use the same regexes for backend/frontend? The current examples and documentation are a little strange. For example the frontend accepts a username containing a ":" while the backend doesnt accept it?
Second thing is I am not sure if I am breaking up things by just allowing an empty space as part of those regexes (bad practice?).
[a-zA-Z0-9._\-|//]{3,30}$ ==> [a-zA-Z0-9 ._\-|//]{3,30}$
^[\S]{3,30}$ ==> ^[\S ]{3,30}$
Is there some kind of OWASP best practice for username validation? I did not found anything so far...
Any help or information is welcome.