eslint-plugin-security
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "eslint-plugin-security", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Security rules for eslint", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var safe = require('safe-regex'); | ||
/** | ||
* Check if the regex is evil or not using the safe-regex module | ||
* @author Adam Baldwin | ||
* @author Adam Baldwin | ||
*/ | ||
@@ -14,5 +14,2 @@ | ||
"use strict"; | ||
var getSource = function(token) { | ||
return token.loc.start.line + ': ' + context.getSourceLines().slice(token.loc.start.line - 1, token.loc.end.line).join('\n\t'); | ||
} | ||
@@ -27,5 +24,12 @@ return { | ||
if (!safe(nodeValue)) { | ||
context.report(node, "Unsafe Regular Expression\n" + getSource(token)); | ||
context.report(node, "Unsafe Regular Expression"); | ||
} | ||
} | ||
}, | ||
"NewExpression": function(node) { | ||
if (node.callee.name == "RegExp" && node.arguments && node.arguments.length > 0 && node.arguments[0].type == "Literal") { | ||
if (!safe(node.arguments[0].value)) { | ||
context.report(node, "Unsafe Regular Expression (new RegExp)"); | ||
} | ||
} | ||
} | ||
@@ -32,0 +36,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32832
516