Skip to content
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

Any option to specify the Symbols? #5

Open
swalahamani opened this issue Mar 3, 2022 · 6 comments
Open

Any option to specify the Symbols? #5

swalahamani opened this issue Mar 3, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@swalahamani
Copy link

Hi,

Any option to specify which "Symbols" or "Special Characters" to be allowed?

@knicola
Copy link
Owner

knicola commented Mar 3, 2022

Hello, there is no option to specify which special characters should be allowed at the moment.

@knicola knicola added the enhancement New feature or request label Mar 3, 2022
@swalahamani
Copy link
Author

Okay, thanks for the prompt response @knicola 🚀

@knicola
Copy link
Owner

knicola commented Jun 14, 2022

I can't think of a valid reason why limit which symbols one can pick for their password so I'll be closing this ticket for now.

@knicola knicola closed this as completed Jun 14, 2022
@ada-cienciala
Copy link

ada-cienciala commented Jul 20, 2023

Commenting cause I've found a reason that might be valid enough to consider 😄 @knicola

The regex in yup-password for special symbols allows for more than popular identity providers like AWS Cognito do. I've encountered a problem when trying to pass £ as a symbol. yup-password indicated that yes, everything is fine. Cognito threw an error, breaking my app.

Cognito uses the same subset as OWASP proposes (^ $ * . [ ] { } ( ) ? - " ! @ # % & / \ , > < ' : ; | _ ~ ` + = and spaces). If there was a way to pass a regex or subset of symbols, it could be used with applications using AWS services on the backend.

Of course, I can always use regex with .matches but something to consider

@knicola
Copy link
Owner

knicola commented Jul 20, 2023

Thank you for reporting this @ada-cienciala !

That is indeed good enough reason to reconsider my decision. I'll look into it once I find a free moment. Feel free to suggest ideas on what should the API look like and/or provide a PR if interested.

@knicola knicola reopened this Jul 20, 2023
@knicola
Copy link
Owner

knicola commented Mar 31, 2024

Sorry for the delay, I'm slowly getting to this.

Just wanted to drop a note here for anyone wanting to limit input to OWASP-friendly symbols, such as Cognito users:

I think limiting input to ASCII (non-control) characters should be enough, ie [\x20-\x7E]*. see ref table.

I could perhaps add a helper method to limit input to ascii only, ie .password().onlyASCII().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants