diff --git a/LICENSE-3rdparty.csv b/LICENSE-3rdparty.csv index 9565bc3f553..eca2504caaa 100644 --- a/LICENSE-3rdparty.csv +++ b/LICENSE-3rdparty.csv @@ -12,17 +12,14 @@ require,dc-polyfill,MIT,Copyright 2023 Datadog Inc. require,ignore,MIT,Copyright 2013 Kael Zhang and contributors require,import-in-the-middle,Apache license 2.0,Copyright 2021 Datadog Inc. require,int64-buffer,MIT,Copyright 2015-2016 Yusuke Kawasaki -require,ipaddr.js,MIT,Copyright 2011-2017 whitequark require,istanbul-lib-coverage,BSD-3-Clause,Copyright 2012-2015 Yahoo! Inc. require,jest-docblock,MIT,Copyright Meta Platforms, Inc. and affiliates. require,koalas,MIT,Copyright 2013-2017 Brian Woodward require,limiter,MIT,Copyright 2011 John Hurliman require,lodash.sortby,MIT,Copyright JS Foundation and other contributors require,lru-cache,ISC,Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors -require,methods,MIT,Copyright 2013-2014 TJ Holowaychuk require,module-details-from-path,MIT,Copyright 2016 Thomas Watson Steen require,msgpack-lite,MIT,Copyright 2015 Yusuke Kawasaki -require,node-abort-controller,MIT,Copyright (c) 2019 Steve Faulkner require,opentracing,MIT,Copyright 2016 Resonance Labs Inc require,path-to-regexp,MIT,Copyright 2014 Blake Embrey require,pprof-format,MIT,Copyright 2022 Stephen Belanger diff --git a/package.json b/package.json index 39ff5019f94..5e23a8100c6 100644 --- a/package.json +++ b/package.json @@ -83,17 +83,14 @@ "ignore": "^5.2.4", "import-in-the-middle": "^1.7.4", "int64-buffer": "^0.1.9", - "ipaddr.js": "^2.1.0", "istanbul-lib-coverage": "3.2.0", "jest-docblock": "^29.7.0", "koalas": "^1.0.2", "limiter": "1.1.5", "lodash.sortby": "^4.7.0", "lru-cache": "^7.14.0", - "methods": "^1.1.2", "module-details-from-path": "^1.0.3", "msgpack-lite": "^0.1.26", - "node-abort-controller": "^3.1.1", "opentracing": ">=0.12.1", "path-to-regexp": "^0.1.2", "pprof-format": "^2.1.0", diff --git a/packages/datadog-instrumentations/src/apollo-server-core.js b/packages/datadog-instrumentations/src/apollo-server-core.js index 52db88973d7..3f075ab6938 100644 --- a/packages/datadog-instrumentations/src/apollo-server-core.js +++ b/packages/datadog-instrumentations/src/apollo-server-core.js @@ -1,6 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') const { addHook } = require('./helpers/instrument') const shimmer = require('../../datadog-shimmer') const dc = require('dc-polyfill') diff --git a/packages/datadog-instrumentations/src/apollo-server.js b/packages/datadog-instrumentations/src/apollo-server.js index 1278949372f..c92c4901cd6 100644 --- a/packages/datadog-instrumentations/src/apollo-server.js +++ b/packages/datadog-instrumentations/src/apollo-server.js @@ -1,6 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') const dc = require('dc-polyfill') const { addHook } = require('./helpers/instrument') diff --git a/packages/datadog-instrumentations/src/body-parser.js b/packages/datadog-instrumentations/src/body-parser.js index a73c377ba9a..3e3d7503231 100644 --- a/packages/datadog-instrumentations/src/body-parser.js +++ b/packages/datadog-instrumentations/src/body-parser.js @@ -1,6 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') // AbortController is not available in node <15 const shimmer = require('../../datadog-shimmer') const { channel, addHook } = require('./helpers/instrument') diff --git a/packages/datadog-instrumentations/src/cookie-parser.js b/packages/datadog-instrumentations/src/cookie-parser.js index 94a30818e23..7a13682e5b0 100644 --- a/packages/datadog-instrumentations/src/cookie-parser.js +++ b/packages/datadog-instrumentations/src/cookie-parser.js @@ -1,6 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') // AbortController is not available in node <15 const shimmer = require('../../datadog-shimmer') const { channel, addHook } = require('./helpers/instrument') diff --git a/packages/datadog-instrumentations/src/express.js b/packages/datadog-instrumentations/src/express.js index 4916bd92f1c..ea507b4e3b0 100644 --- a/packages/datadog-instrumentations/src/express.js +++ b/packages/datadog-instrumentations/src/express.js @@ -3,7 +3,6 @@ const { createWrapRouterMethod } = require('./router') const shimmer = require('../../datadog-shimmer') const { addHook, channel } = require('./helpers/instrument') -const { AbortController } = require('node-abort-controller') const handleChannel = channel('apm:express:request:handle') diff --git a/packages/datadog-instrumentations/src/graphql.js b/packages/datadog-instrumentations/src/graphql.js index 11e917a30a9..c776c4f4fa5 100644 --- a/packages/datadog-instrumentations/src/graphql.js +++ b/packages/datadog-instrumentations/src/graphql.js @@ -1,7 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') - const { addHook, channel, diff --git a/packages/datadog-instrumentations/src/http/server.js b/packages/datadog-instrumentations/src/http/server.js index 680e6b8dcbf..14bccd88994 100644 --- a/packages/datadog-instrumentations/src/http/server.js +++ b/packages/datadog-instrumentations/src/http/server.js @@ -1,6 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') // AbortController is not available in node <15 const { channel, addHook diff --git a/packages/datadog-instrumentations/src/router.js b/packages/datadog-instrumentations/src/router.js index 9ac38caf6c6..5768390e6cf 100644 --- a/packages/datadog-instrumentations/src/router.js +++ b/packages/datadog-instrumentations/src/router.js @@ -1,6 +1,6 @@ 'use strict' -const METHODS = require('methods').concat('all') +const METHODS = require('http').METHODS.map(v => v.toLowerCase()).concat('all') const pathToRegExp = require('path-to-regexp') const shimmer = require('../../datadog-shimmer') const { addHook, channel } = require('./helpers/instrument') diff --git a/packages/datadog-plugin-http/test/server.spec.js b/packages/datadog-plugin-http/test/server.spec.js index ba9873427fb..ee38d21789e 100644 --- a/packages/datadog-plugin-http/test/server.spec.js +++ b/packages/datadog-plugin-http/test/server.spec.js @@ -1,6 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') // AbortController is not available in node <15 const getPort = require('get-port') const agent = require('../../dd-trace/test/plugins/agent') const axios = require('axios') diff --git a/packages/dd-trace/src/config.js b/packages/dd-trace/src/config.js index 2f2e432dce6..ecc4c8b0355 100644 --- a/packages/dd-trace/src/config.js +++ b/packages/dd-trace/src/config.js @@ -2,7 +2,7 @@ const fs = require('fs') const os = require('os') -const uuid = require('crypto-randomuuid') +const uuid = require('crypto-randomuuid') // we need to keep the old uuid dep because of cypress const URL = require('url').URL const log = require('./log') const pkg = require('./pkg') diff --git a/packages/dd-trace/src/plugins/util/ip_blocklist.js b/packages/dd-trace/src/plugins/util/ip_blocklist.js deleted file mode 100644 index f346a1571b8..00000000000 --- a/packages/dd-trace/src/plugins/util/ip_blocklist.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict' - -const semver = require('semver') - -if (semver.satisfies(process.version, '>=14.18.0')) { - const net = require('net') - - module.exports = net.BlockList -} else { - const ipaddr = require('ipaddr.js') - - module.exports = class BlockList { - constructor () { - this.v4Ranges = [] - this.v6Ranges = [] - } - - addSubnet (net, prefix, type) { - this[type === 'ipv4' ? 'v4Ranges' : 'v6Ranges'].push(ipaddr.parseCIDR(`${net}/${prefix}`)) - } - - check (address, type) { - try { - let ip = ipaddr.parse(address) - - type = ip.kind() - - if (type === 'ipv6') { - for (const range of this.v6Ranges) { - if (ip.match(range)) return true - } - - if (ip.isIPv4MappedAddress()) { - ip = ip.toIPv4Address() - type = ip.kind() - } - } - - if (type === 'ipv4') { - for (const range of this.v4Ranges) { - if (ip.match(range)) return true - } - } - - return false - } catch { - return false - } - } - } -} diff --git a/packages/dd-trace/src/plugins/util/ip_extractor.js b/packages/dd-trace/src/plugins/util/ip_extractor.js index 14d87ec64c0..969b02746b5 100644 --- a/packages/dd-trace/src/plugins/util/ip_extractor.js +++ b/packages/dd-trace/src/plugins/util/ip_extractor.js @@ -1,6 +1,6 @@ 'use strict' -const BlockList = require('./ip_blocklist') +const { BlockList } = require('net') const net = require('net') const ipHeaderList = [ diff --git a/packages/dd-trace/test/appsec/blocking.spec.js b/packages/dd-trace/test/appsec/blocking.spec.js index 600ce92772c..981c1989f3e 100644 --- a/packages/dd-trace/test/appsec/blocking.spec.js +++ b/packages/dd-trace/test/appsec/blocking.spec.js @@ -1,7 +1,5 @@ 'use strict' -const { AbortController } = require('node-abort-controller') - describe('blocking', () => { const defaultBlockedTemplate = { html: 'block test', diff --git a/yarn.lock b/yarn.lock index 29daf95f359..a517aaa4497 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2919,11 +2919,6 @@ ipaddr.js@1.9.1: resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== -ipaddr.js@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz" - integrity sha512-LlbxQ7xKzfBusov6UMi4MFpEg0m+mAm9xyNGEduwXMEDuf4WfzB/RZwMVYEd7IKGvh4IUkEXYxtAVu9T3OelJQ== - is-arguments@^1.0.4, is-arguments@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" @@ -3506,7 +3501,7 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -methods@^1.1.2, methods@~1.1.2: +methods@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz" integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== @@ -3709,11 +3704,6 @@ nock@^11.3.3: mkdirp "^0.5.0" propagate "^2.0.0" -node-abort-controller@^3.1.1: - version "3.1.1" - resolved "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz" - integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== - node-addon-api@^6.1.0: version "6.1.0" resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz"