revert one
This commit is contained in:
2025-09-20 13:26:52 +00:00
parent c74f28caa7
commit a2271529a8
2539 changed files with 0 additions and 365006 deletions

View File

@@ -1,2 +0,0 @@
# Set default behavior to automatically convert line endings
* text=auto eol=lf

View File

@@ -1,13 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10

View File

@@ -1,21 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 15
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- "discussion"
- "feature request"
- "bug"
- "help wanted"
- "plugin suggestion"
- "good first issue"
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -1,25 +0,0 @@
name: CI
on:
push:
branches:
- main
- next
- 'v*'
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
test:
permissions:
contents: write
pull-requests: write
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5
with:
license-check: true
lint: true

18
node_modules/safe-regex2/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.

59
node_modules/safe-regex2/README.md generated vendored
View File

@@ -1,59 +0,0 @@
# safe-regex2
[![CI](https://github.com/fastify/safe-regex2/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/safe-regex2/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/safe-regex2.svg?style=flat)](https://www.npmjs.com/package/safe-regex2)
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
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.
This is a fork of https://github.com/substack/safe-regex at 1.1.0.
WARNING: This module has both false positives and false negatives.
It is not meant as a full checker, but it detects basic cases.
## Install
```
npm i safe-regex2
```
## Example
``` js
const safe = require('safe-regex2');
const 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
const safe = require('safe-regex')
```
### const ok = safe(re, opts={})
Returns a boolean indicating whether the regex `re` is safe
and not possibly catastrophic.
`re` can be a `RegExp` object or just a string.
If `re` is a string and is an invalid regex, it returns `false`.
* `opts.limit` - maximum number of allowed repetitions in the entire regex.
Default: `25`.
## License
Licensed under [MIT](./LICENSE).

View File

@@ -1,6 +0,0 @@
'use strict'
module.exports = require('neostandard')({
ignores: require('neostandard').resolveIgnoresFromGitignore(),
ts: true
})

View File

@@ -1,5 +0,0 @@
'use strict'
const safe = require('../')
const regex = process.argv.slice(2).join(' ')
console.log(safe(regex))

54
node_modules/safe-regex2/index.js generated vendored
View File

@@ -1,54 +0,0 @@
'use strict'
const parse = require('ret')
const types = parse.types
function safeRegex (re, opts) {
if (!opts) opts = {}
/* c8 ignore next */
const replimit = opts.limit === undefined ? 25 : opts.limit
/* c8 ignore next 2 */
if (isRegExp(re)) re = re.source
else if (typeof re !== 'string') re = String(re)
try { re = parse(re) } catch { return false }
let reps = 0
return (function walk (node, starHeight) {
let i
let ok
let len
if (node.type === types.REPETITION) {
starHeight++
reps++
if (starHeight > 1) return false
if (reps > replimit) return false
}
if (node.options) {
for (i = 0, len = node.options.length; i < len; i++) {
ok = walk({ stack: node.options[i] }, starHeight)
if (!ok) return false
}
}
const stack = node.stack || node.value?.stack
if (!stack) return true
for (i = 0; i < stack.length; i++) {
ok = walk(stack[i], starHeight)
if (!ok) return false
}
return true
})(re, 0)
}
function isRegExp (x) {
return {}.toString.call(x) === '[object RegExp]'
}
module.exports = safeRegex
module.exports.default = safeRegex
module.exports.safeRegex = safeRegex

View File

@@ -1,77 +0,0 @@
{
"name": "safe-regex2",
"version": "5.0.0",
"description": "detect possibly catastrophic, exponential-time regular expressions",
"main": "index.js",
"type": "commonjs",
"types": "types/index.d.ts",
"dependencies": {
"ret": "~0.5.0"
},
"devDependencies": {
"@fastify/pre-commit": "^2.1.0",
"c8": "^10.1.3",
"eslint": "^9.17.0",
"neostandard": "^0.12.0",
"tape": "^5.7.5",
"tsd": "^0.31.0"
},
"scripts": {
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:typescript": "tsd",
"test:unit": "c8 tape test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/fastify/safe-regex2.git"
},
"bugs": {
"url": "https://github.com/fastify/safe-regex2/issues"
},
"homepage": "https://github.com/fastify/safe-regex2",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"keywords": [
"catastrophic",
"exponential",
"regex",
"safe",
"sandbox"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"contributors": [
{
"name": "Matteo Collina",
"email": "hello@matteocollina.com"
},
{
"name": "Gürgün Dayıoğlu",
"email": "hey@gurgun.day",
"url": "https://heyhey.to/G"
},
{
"name": "James Sumners",
"url": "https://james.sumners.info"
},
{
"name": "Frazer Smith",
"email": "frazer.dev@icloud.com",
"url": "https://github.com/fdawgs"
}
],
"license": "MIT"
}

View File

@@ -1,51 +0,0 @@
'use strict'
const safe = require('../')
const test = require('tape')
const 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)
})
})
const 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)
})
})
const 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)
})
})

View File

@@ -1,9 +0,0 @@
type SafeRegex2 = (re: string | RegExp, opts?: { limit?: number }) => boolean
declare namespace safeRegex {
export const safeRegex: SafeRegex2
export { safeRegex as default }
}
declare function safeRegex (...params: Parameters<SafeRegex2>): ReturnType<SafeRegex2>
export = safeRegex

View File

@@ -1,12 +0,0 @@
import safeRegex, { safeRegex as safeRegexNamed } from '..'
import { expectType } from 'tsd'
expectType<boolean>(safeRegex('regex'))
expectType<boolean>(safeRegex(/regex/))
expectType<boolean>(safeRegex('^([a-zA-Z0-9]+\\s?)+$'))
expectType<boolean>(safeRegex(/^([a-zA-Z0-9]+\s?)+$/g))
expectType<boolean>(safeRegexNamed('regex'))
expectType<boolean>(safeRegexNamed(/regex/))
expectType<boolean>(safeRegexNamed('^([a-zA-Z0-9]+\\s?)+$'))
expectType<boolean>(safeRegexNamed(/^([a-zA-Z0-9]+\s?)+$/g))