This is a historical bug that mailcheck library (the one we're replacing) has had since the beginning.
mailcheck encoded the email to prevent XSS, but kept some characters unencoded to be compliant with RFC 5322. However, their function to replace characters only replaced the first character, since they forgot to run the spaces globally.
I noticed this while performing some tests of this library in our main application for ZooTools, an email with spaces like jorge@test.com was returned encoded
![Uploading Screen Shot 2022-10-22 at 4.47.38 PM.png…]()
Description of change
I updated the regex to be run glob ally across every character. This will take a bit longer to validate the email, but it's blazing fast anyways and it's only run once when the email is being passed.
Pull-Request Checklist
[x] Code is up-to-date with the main branch
[x] npm run lint passes with this change
[x] npm run test passes with this change
[x] This pull request links relevant issues as Fixes #0000
[x] There are new or updated unit tests validating the change
[x] Documentation has been updated to reflect this change
Bug description
This is a historical bug that mailcheck library (the one we're replacing) has had since the beginning.
mailcheck encoded the email to prevent XSS, but kept some characters unencoded to be compliant with
RFC 5322
. However, their function to replace characters only replaced the first character, since they forgot to run the spaces globally.I noticed this while performing some tests of this library in our main application for ZooTools, an email with spaces like
jorge@test.com
was returned encoded![Uploading Screen Shot 2022-10-22 at 4.47.38 PM.png…]()
Description of change
I updated the regex to be run glob ally across every character. This will take a bit longer to validate the email, but it's blazing fast anyways and it's only run once when the email is being passed.
Pull-Request Checklist
main
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000