This commit is contained in:
eric sciple 2020-01-24 12:22:34 -05:00
parent 9fff29ba6c
commit 00c3b50fca
7278 changed files with 0 additions and 1778943 deletions

View file

@ -1,4 +0,0 @@
language: node_js
node_js:
- "0.8"
- "0.10"

18
node_modules/safe-regex/LICENSE generated vendored
View file

@ -1,18 +0,0 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,3 +0,0 @@
var safe = require('../');
var regex = process.argv.slice(2).join(' ');
console.log(safe(regex));

43
node_modules/safe-regex/index.js generated vendored
View file

@ -1,43 +0,0 @@
var parse = require('ret');
var types = parse.types;
module.exports = function (re, opts) {
if (!opts) opts = {};
var replimit = opts.limit === undefined ? 25 : opts.limit;
if (isRegExp(re)) re = re.source;
else if (typeof re !== 'string') re = String(re);
try { re = parse(re) }
catch (err) { return false }
var reps = 0;
return (function walk (node, starHeight) {
if (node.type === types.REPETITION) {
starHeight ++;
reps ++;
if (starHeight > 1) return false;
if (reps > replimit) return false;
}
if (node.options) {
for (var i = 0, len = node.options.length; i < len; i++) {
var ok = walk({ stack: node.options[i] }, starHeight);
if (!ok) return false;
}
}
var stack = node.stack || (node.value && node.value.stack);
if (!stack) return true;
for (var i = 0; i < stack.length; i++) {
var ok = walk(stack[i], starHeight);
if (!ok) return false;
}
return true;
})(re, 0);
};
function isRegExp (x) {
return {}.toString.call(x) === '[object RegExp]';
}

47
node_modules/safe-regex/package.json generated vendored
View file

@ -1,47 +0,0 @@
{
"name": "safe-regex",
"version": "1.1.0",
"description": "detect possibly catastrophic, exponential-time regular expressions",
"main": "index.js",
"dependencies": {
"ret": "~0.1.10"
},
"devDependencies": {
"tape": "^3.5.0"
},
"scripts": {
"test": "tape test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/8", "ie/9", "ie/10",
"firefox/latest",
"chrome/latest",
"opera/latest",
"safari/latest"
]
},
"repository": {
"type": "git",
"url": "git://github.com/substack/safe-regex.git"
},
"homepage": "https://github.com/substack/safe-regex",
"keywords": [
"catastrophic",
"exponential",
"regex",
"safe",
"sandbox"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT"
,"_resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz"
,"_integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4="
,"_from": "safe-regex@1.1.0"
}

View file

@ -1,65 +0,0 @@
# safe-regex
detect potentially
[catastrophic](http://regular-expressions.mobi/catastrophic.html)
[exponential-time](http://perlgeek.de/blog-en/perl-tips/in-search-of-an-exponetial-regexp.html)
regular expressions by limiting the
[star height](https://en.wikipedia.org/wiki/Star_height) to 1
WARNING: This module merely *seems* to work given all the catastrophic regular
expressions I could find scouring the internet, but I don't have enough of a
background in automata to be absolutely sure that this module will catch all
exponential-time cases.
[![browser support](https://ci.testling.com/substack/safe-regex.png)](https://ci.testling.com/substack/safe-regex)
[![build status](https://secure.travis-ci.org/substack/safe-regex.png)](http://travis-ci.org/substack/safe-regex)
# example
``` js
var safe = require('safe-regex');
var regex = process.argv.slice(2).join(' ');
console.log(safe(regex));
```
```
$ node safe.js '(x+x+)+y'
false
$ node safe.js '(beep|boop)*'
true
$ node safe.js '(a+){10}'
false
$ node safe.js '\blocation\s*:[^:\n]+\b(Oakland|San Francisco)\b'
true
```
# methods
``` js
var safe = require('safe-regex')
```
## var ok = safe(re, opts={})
Return a boolean `ok` whether or not the regex `re` is safe and not possibly
catastrophic.
`re` can be a `RegExp` object or just a string.
If the `re` is a string and is an invalid regex, returns `false`.
* `opts.limit` - maximum number of allowed repetitions in the entire regex.
Default: `25`.
# install
With [npm](https://npmjs.org) do:
```
npm install safe-regex
```
# license
MIT

View file

@ -1,50 +0,0 @@
var safe = require('../');
var test = require('tape');
var good = [
/\bOakland\b/,
/\b(Oakland|San Francisco)\b/i,
/^\d+1337\d+$/i,
/^\d+(1337|404)\d+$/i,
/^\d+(1337|404)*\d+$/i,
RegExp(Array(26).join('a?') + Array(26).join('a')),
];
test('safe regex', function (t) {
t.plan(good.length);
good.forEach(function (re) {
t.equal(safe(re), true);
});
});
var bad = [
/^(a?){25}(a){25}$/,
RegExp(Array(27).join('a?') + Array(27).join('a')),
/(x+x+)+y/,
/foo|(x+x+)+y/,
/(a+){10}y/,
/(a+){2}y/,
/(.*){1,32000}[bc]/
];
test('unsafe regex', function (t) {
t.plan(bad.length);
bad.forEach(function (re) {
t.equal(safe(re), false);
});
});
var invalid = [
'*Oakland*',
'hey(yoo))',
'abcde(?>hellow)',
'[abc'
];
test('invalid regex', function (t) {
t.plan(invalid.length);
invalid.forEach(function (re) {
t.equal(safe(re), false);
});
});