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

Regex copied from moment.js is vulnerable to ReDOS attack #216

Open
milkmanmatty opened this issue Apr 13, 2023 · 0 comments
Open

Regex copied from moment.js is vulnerable to ReDOS attack #216

milkmanmatty opened this issue Apr 13, 2023 · 0 comments

Comments

@milkmanmatty
Copy link

Was updating Moment.js for a project to remove the ability for certain ReDOS attacks. While searching, the isTimeSpan function from this repo came up and mentioned that it used some regex from Moment.js in comments:

//expressive.annotations.validate.js Line 491
isTimeSpan: function(value) {
    return /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/.test(value); // regex for recognition of .NET style timespan string, taken from moment.js v2.9.0
},

I checked and found that this line fails an automated ReDOS check. This is unsuprising due to the amount of ReDOS bugs that moment.js has fixed over the years.

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

No branches or pull requests

1 participant