mirror of
https://git.mirrors.martin98.com/https://github.com/cyberman54/curl
synced 2026-04-16 19:08:05 +08:00
fix: validate status and some security
This commit is contained in:
39
node_modules/is-retry-allowed/index.js
generated
vendored
Normal file
39
node_modules/is-retry-allowed/index.js
generated
vendored
Normal 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);
|
||||
Reference in New Issue
Block a user