-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Username contains invalid characters #25
Comments
The rule giving you issues is controlled at: Linux Distributions have a mixed bag of allowable usernames. I wouldn't object to a config that controlled which of the 3 regex patterns validated usernames. |
@russell-lewis I have a use case where I want to be able to provide certain characters, e.g. '@' or '.' (I want to pass an email address as bastion_user to BLESS). Currently, that is not possible. I was thinking about introducing the flag to turn the username validation on/off. However, I am not sure if such functionality would be accepted nor how to tackle it. I can easily introduce new directive in the configuration file, but bless_request.py does not touch the config file. I can introduce it and do something like: VALIDATE_USER = config.get(VALIDATE_USER) def validate_user(user): if VALIDATE_USER: if len(user) > 32: raise ValidationError('Username is too long.') if USERNAME_PATTERN.match(user) is None: raise ValidationError('Username contains invalid characters.') However, I don't consider this to be a good solution. I have looked at marshallow documentation on how to extend the schema with new attributes (https://marshmallow.readthedocs.io/en/latest/extending.html) and maybe that would be acceptable. What would you suggest? |
@russell-lewis ping |
@xen0l it looks like @diasjorge has gone ahead and taken an approach along the lines of what you were trying to avoid. I agree with you that using schema.context to control the validation would be more desirable. Next week I should have some time to take a pass at enhancing #43 accordingly. |
It looks like there are use cases for the following validations: |
This issue should now be resolved in master. |
My user convention is first.last but the lambda function doesn't seem to accept it:
While first.last is accepted by AD and Linux distros
The text was updated successfully, but these errors were encountered: