🐛 Update: Added support for the 'find' command in settings.local.json. Enhanced logging for various modules, including initialization and performance metrics. Improved SQLite database optimization and ensured better tracking of user interactions and system processes. 📚
This commit is contained in:
4
network-visualization/node_modules/safe-regex/.travis.yml
generated
vendored
Normal file
4
network-visualization/node_modules/safe-regex/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
18
network-visualization/node_modules/safe-regex/LICENSE
generated
vendored
Normal file
18
network-visualization/node_modules/safe-regex/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
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.
|
3
network-visualization/node_modules/safe-regex/example/safe.js
generated
vendored
Normal file
3
network-visualization/node_modules/safe-regex/example/safe.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var safe = require('../');
|
||||
var regex = process.argv.slice(2).join(' ');
|
||||
console.log(safe(regex));
|
43
network-visualization/node_modules/safe-regex/index.js
generated
vendored
Normal file
43
network-visualization/node_modules/safe-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
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]';
|
||||
}
|
43
network-visualization/node_modules/safe-regex/package.json
generated
vendored
Normal file
43
network-visualization/node_modules/safe-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"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"
|
||||
}
|
65
network-visualization/node_modules/safe-regex/readme.markdown
generated
vendored
Normal file
65
network-visualization/node_modules/safe-regex/readme.markdown
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
# 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.
|
||||
|
||||
[](https://ci.testling.com/substack/safe-regex)
|
||||
|
||||
[](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
|
50
network-visualization/node_modules/safe-regex/test/regex.js
generated
vendored
Normal file
50
network-visualization/node_modules/safe-regex/test/regex.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
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);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user