fix: validate status and some security

This commit is contained in:
Wathanyu Phromma
2022-03-20 14:01:35 +07:00
parent 31d4a5f24b
commit a2c408c63d
387 changed files with 33710 additions and 4612 deletions

22
node_modules/is-retry-allowed/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/**
Check whether a request can be retried based on the `error.code`.
@param error - The `.code` property, if it exists, will be used to determine whether retry is allowed.
@example
```
import isRetryAllowed = require('is-retry-allowed');
isRetryAllowed({code: 'ETIMEDOUT'});
//=> true
isRetryAllowed({code: 'ENOTFOUND'});
//=> false
isRetryAllowed({});
//=> true
```
*/
declare function isRetryAllowed(error?: Error | Record<string, unknown>): boolean;
export = isRetryAllowed;

39
node_modules/is-retry-allowed/index.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
'use strict';
const denyList = new Set([
'ENOTFOUND',
'ENETUNREACH',
// SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
'UNABLE_TO_GET_ISSUER_CERT',
'UNABLE_TO_GET_CRL',
'UNABLE_TO_DECRYPT_CERT_SIGNATURE',
'UNABLE_TO_DECRYPT_CRL_SIGNATURE',
'UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
'CERT_SIGNATURE_FAILURE',
'CRL_SIGNATURE_FAILURE',
'CERT_NOT_YET_VALID',
'CERT_HAS_EXPIRED',
'CRL_NOT_YET_VALID',
'CRL_HAS_EXPIRED',
'ERROR_IN_CERT_NOT_BEFORE_FIELD',
'ERROR_IN_CERT_NOT_AFTER_FIELD',
'ERROR_IN_CRL_LAST_UPDATE_FIELD',
'ERROR_IN_CRL_NEXT_UPDATE_FIELD',
'OUT_OF_MEM',
'DEPTH_ZERO_SELF_SIGNED_CERT',
'SELF_SIGNED_CERT_IN_CHAIN',
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
'CERT_CHAIN_TOO_LONG',
'CERT_REVOKED',
'INVALID_CA',
'PATH_LENGTH_EXCEEDED',
'INVALID_PURPOSE',
'CERT_UNTRUSTED',
'CERT_REJECTED',
'HOSTNAME_MISMATCH'
]);
// TODO: Use `error?.code` when targeting Node.js 14
module.exports = error => !denyList.has(error && error.code);

10
node_modules/is-retry-allowed/license generated vendored Normal file
View File

@@ -0,0 +1,10 @@
MIT License
Copyright (c) Vsevolod Strukchinsky <floatdrop@gmail.com> (github.com/floatdrop)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

40
node_modules/is-retry-allowed/package.json generated vendored Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "is-retry-allowed",
"version": "2.2.0",
"description": "Check whether a request can be retried based on the `error.code`",
"license": "MIT",
"repository": "sindresorhus/is-retry-allowed",
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"retry",
"retries",
"allowed",
"check",
"http",
"https",
"request",
"fetch"
],
"devDependencies": {
"ava": "^3.14.0",
"tsd": "^0.14.0",
"xo": "^0.36.1"
}
}

46
node_modules/is-retry-allowed/readme.md generated vendored Normal file
View File

@@ -0,0 +1,46 @@
# is-retry-allowed
> Check whether a request can be retried based on the `error.code`
## Install
```
$ npm install --save is-retry-allowed
```
## Usage
```js
const isRetryAllowed = require('is-retry-allowed');
isRetryAllowed({code: 'ETIMEDOUT'});
//=> true
isRetryAllowed({code: 'ENOTFOUND'});
//=> false
isRetryAllowed({});
//=> true
```
## API
### isRetryAllowed(error)
#### error
Type: `Error | object`
The `.code` property, if it exists, will be used to determine whether retry is allowed.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-is-retry-allowed?utm_source=npm-is-retry-allowed&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>