From 83daced7c1794313f12de26276bc31a903c25ce9 Mon Sep 17 00:00:00 2001 From: jwestbrook Date: Tue, 19 Jan 2021 09:02:42 -0800 Subject: [PATCH 1/2] Update regex for striptags method to prevent regex dos --- src/prototype/lang/string.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prototype/lang/string.js b/src/prototype/lang/string.js index 433a1c0b1..43f9f3da0 100644 --- a/src/prototype/lang/string.js +++ b/src/prototype/lang/string.js @@ -280,7 +280,7 @@ Object.extend(String.prototype, (function() { * // -> 'a link' **/ function stripTags() { - return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi, ''); + return this.replace(/<\w+(?:\s+(?:"[^"]*"|'[^']*'|[^>])+)?(?:\/)?>|<\/\w+>/gi, ''); } /** From 37a4ac2bbf2b3914e0e9f1af98b6335eda15aa51 Mon Sep 17 00:00:00 2001 From: jwestbrook Date: Tue, 19 Jan 2021 10:23:38 -0800 Subject: [PATCH 2/2] re-push the regex pattern cause my local branch was out of date --- src/prototype/lang/string.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prototype/lang/string.js b/src/prototype/lang/string.js index 43f9f3da0..b4785fe3b 100644 --- a/src/prototype/lang/string.js +++ b/src/prototype/lang/string.js @@ -280,7 +280,7 @@ Object.extend(String.prototype, (function() { * // -> 'a link' **/ function stripTags() { - return this.replace(/<\w+(?:\s+(?:"[^"]*"|'[^']*'|[^>])+)?(?:\/)?>|<\/\w+>/gi, ''); + return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>'"])+)?\s*("[^">]*|'[^'>])?(\/)?>|<\/\w+>/gi, ''); } /**