mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 05:14:44 +00:00
.
This commit is contained in:
parent
a004f0ae58
commit
fc725ba36b
7280 changed files with 19 additions and 1796407 deletions
4
node_modules/safe-regex/.travis.yml
generated
vendored
4
node_modules/safe-regex/.travis.yml
generated
vendored
|
@ -1,4 +0,0 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
18
node_modules/safe-regex/LICENSE
generated
vendored
18
node_modules/safe-regex/LICENSE
generated
vendored
|
@ -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.
|
3
node_modules/safe-regex/example/safe.js
generated
vendored
3
node_modules/safe-regex/example/safe.js
generated
vendored
|
@ -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
43
node_modules/safe-regex/index.js
generated
vendored
|
@ -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]';
|
||||
}
|
78
node_modules/safe-regex/package.json
generated
vendored
78
node_modules/safe-regex/package.json
generated
vendored
|
@ -1,78 +0,0 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"safe-regex@1.1.0",
|
||||
"/Users/eric/repos/actions/setup-node"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "safe-regex@1.1.0",
|
||||
"_id": "safe-regex@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
|
||||
"_location": "/safe-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "safe-regex@1.1.0",
|
||||
"name": "safe-regex",
|
||||
"escapedName": "safe-regex",
|
||||
"rawSpec": "1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/regex-not",
|
||||
"/to-regex"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
|
||||
"_spec": "1.1.0",
|
||||
"_where": "/Users/eric/repos/actions/setup-node",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/safe-regex/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"ret": "~0.1.10"
|
||||
},
|
||||
"description": "detect possibly catastrophic, exponential-time regular expressions",
|
||||
"devDependencies": {
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"homepage": "https://github.com/substack/safe-regex",
|
||||
"keywords": [
|
||||
"catastrophic",
|
||||
"exponential",
|
||||
"regex",
|
||||
"safe",
|
||||
"sandbox"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "safe-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/safe-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8",
|
||||
"ie/9",
|
||||
"ie/10",
|
||||
"firefox/latest",
|
||||
"chrome/latest",
|
||||
"opera/latest",
|
||||
"safari/latest"
|
||||
]
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
65
node_modules/safe-regex/readme.markdown
generated
vendored
65
node_modules/safe-regex/readme.markdown
generated
vendored
|
@ -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.
|
||||
|
||||
[](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
node_modules/safe-regex/test/regex.js
generated
vendored
50
node_modules/safe-regex/test/regex.js
generated
vendored
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue