From 766bf4df7f71f47ea99f2a66ae4dd5db5f83f75b Mon Sep 17 00:00:00 2001 From: q-- Date: Mon, 21 Sep 2015 13:33:50 +0200 Subject: [PATCH] Check if patterns are valid regular expressions --- bin/wappalyzer-validate-regex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/wappalyzer-validate-regex b/bin/wappalyzer-validate-regex index 2f72564e1..e55e70648 100755 --- a/bin/wappalyzer-validate-regex +++ b/bin/wappalyzer-validate-regex @@ -27,6 +27,11 @@ for ( app in json.apps ) { attrs = pattern.split('\\;'), regex = '/' + attrs.shift().replace('/', '\/') + '/'; + //Check if the pattern is a valid RegExp + //Note: unlike when used in Wappalyzer, the modifier i isn't added here + new RegExp(regex); + + if ( /^\/(?:\^\$|\.\+|\.\*)\/$/.test(regex) ) { throw new Error('Pattern should be replaced with empty string.\n' + app + ': ' + type + ': ' + pattern); }