From ccde29dd0626d870bf61fc9c04c845017060711d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BA=D0=BE=D0=B2=D0=BE=D1=80=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=90=D0=BD=D0=B4=D1=80?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Mon, 29 Jun 2020 20:47:40 +0300 Subject: [PATCH] Fix a ReDoS in 'style' format As there are no `^` or `$` anchors in the regex, this should be equivalent. Patch deliberately does not change the behavior. --- formats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formats.js b/formats.js index 5808330..f2118c2 100644 --- a/formats.js +++ b/formats.js @@ -28,7 +28,7 @@ exports['hostname'] = function (input) { } exports['alpha'] = /^[a-zA-Z]+$/ exports['alphanumeric'] = /^[a-zA-Z0-9]+$/ -exports['style'] = /\s*(.+?):\s*([^;]+);?/g +exports['style'] = /.:\s*[^;]/g exports['phone'] = function (input) { if (!(rePhoneFirstPass.test(input))) return false if (rePhoneDoubleSpace.test(input)) return false