Skip to content

Commit a594ce0

Browse files
authored
Remove bad regex to avoid anyone copying it
Thanks to [Jamie Davis](https://github.com/davisjam) for letting me know about the [ReDoS](https://www.regular-expressions.info/redos.html) exploit. Thankfully not found in the framework, only the test cases.
1 parent 97996a2 commit a594ce0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/directives/schema-validate.directive.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('schema-validate.directive.js', function() {
4141
tv4.defineError('EMAIL', 10001, 'Invalid email address');
4242
tv4.defineKeyword('email', function(data, value, schema) {
4343
if (schema.email) {
44-
if (/^\S+@\S+$/.test(data)) {
44+
if (/^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/.test(data)) {
4545
return null;
4646
}
4747
return {

0 commit comments

Comments
 (0)