@contrast/agent-bundle 5.40.0 → 5.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/node_modules/@contrast/agent/package.json +12 -11
  2. package/node_modules/@contrast/agent-swc-plugin/index.js +9 -3
  3. package/node_modules/@contrast/agent-swc-plugin/methods.js +15 -1
  4. package/node_modules/@contrast/agent-swc-plugin/package.json +5 -8
  5. package/node_modules/@contrast/agent-swc-plugin/rewriter.wasm +0 -0
  6. package/node_modules/@contrast/agentify/lib/index.js +2 -2
  7. package/node_modules/@contrast/agentify/package.json +15 -14
  8. package/node_modules/@contrast/architecture-components/package.json +5 -5
  9. package/node_modules/@contrast/assess/lib/dataflow/propagation/install/util-format.js +44 -21
  10. package/node_modules/@contrast/assess/lib/dataflow/sources/install/body-parser.js +1 -1
  11. package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +3 -1
  12. package/node_modules/@contrast/assess/lib/dataflow/sources/install/qs6.js +5 -5
  13. package/node_modules/@contrast/assess/lib/dataflow/sources/install/querystring.js +2 -1
  14. package/node_modules/@contrast/assess/lib/index.d.ts +0 -1
  15. package/node_modules/@contrast/assess/lib/make-source-context.js +7 -37
  16. package/node_modules/@contrast/assess/lib/sampler/common.js +7 -11
  17. package/node_modules/@contrast/assess/package.json +12 -11
  18. package/node_modules/@contrast/common/lib/types.d.ts +7 -1
  19. package/node_modules/@contrast/common/package.json +1 -1
  20. package/node_modules/@contrast/config/lib/common.js +1 -1
  21. package/node_modules/@contrast/config/lib/config.js +49 -27
  22. package/node_modules/@contrast/config/lib/index.d.ts +2 -2
  23. package/node_modules/@contrast/config/lib/options.js +4 -4
  24. package/node_modules/@contrast/config/package.json +4 -3
  25. package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +15 -15
  26. package/node_modules/@contrast/core/package.json +6 -6
  27. package/node_modules/@contrast/deadzones/package.json +5 -5
  28. package/node_modules/@contrast/dep-hooks/package.json +3 -3
  29. package/node_modules/@contrast/esm-hooks/package.json +6 -6
  30. package/node_modules/@contrast/instrumentation/lib/index.js +0 -1
  31. package/node_modules/@contrast/instrumentation/package.json +5 -5
  32. package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +298 -148
  33. package/node_modules/@contrast/library-analysis/package.json +4 -4
  34. package/node_modules/@contrast/logger/lib/serializers.js +2 -2
  35. package/node_modules/@contrast/logger/package.json +3 -3
  36. package/node_modules/@contrast/metrics/package.json +6 -6
  37. package/node_modules/@contrast/patcher/package.json +2 -2
  38. package/node_modules/@contrast/protect/lib/get-source-context.js +3 -1
  39. package/node_modules/@contrast/protect/lib/index.js +6 -1
  40. package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +7 -9
  41. package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +18 -19
  42. package/node_modules/@contrast/protect/lib/input-analysis/install/qs6.js +18 -17
  43. package/node_modules/@contrast/protect/lib/input-analysis/install/universal-cookie4.js +2 -3
  44. package/node_modules/@contrast/protect/lib/make-source-context.js +22 -66
  45. package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +73 -72
  46. package/node_modules/@contrast/protect/package.json +11 -11
  47. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +7 -7
  48. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +3 -3
  49. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +24 -21
  50. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +11 -11
  51. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +76 -86
  52. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -2
  53. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +8 -2
  54. package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -2
  55. package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +22 -20
  56. package/node_modules/@contrast/reporter/package.json +7 -7
  57. package/node_modules/@contrast/rewriter/lib/index.js +2 -2
  58. package/node_modules/@contrast/rewriter/package.json +6 -6
  59. package/node_modules/@contrast/route-coverage/lib/index.js +1 -9
  60. package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +17 -19
  61. package/node_modules/@contrast/route-coverage/lib/install/hapi.js +9 -2
  62. package/node_modules/@contrast/route-coverage/package.json +8 -8
  63. package/node_modules/@contrast/scopes/package.json +5 -5
  64. package/node_modules/@contrast/sec-obs/lib/traces/http.js +2 -2
  65. package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +17 -0
  66. package/node_modules/@contrast/sec-obs/lib/traces/outbound-service-call.js +2 -2
  67. package/node_modules/@contrast/sec-obs/lib/traces/outbound-service-call.test.js +17 -0
  68. package/node_modules/@contrast/sec-obs/package.json +9 -9
  69. package/node_modules/@contrast/sources/lib/index.js +109 -0
  70. package/node_modules/@contrast/sources/lib/index.test.js +120 -0
  71. package/node_modules/@contrast/{route-coverage/lib/normalized-url-mapper.js → sources/lib/normalized-uri-mapper.js} +10 -3
  72. package/node_modules/@contrast/sources/lib/normalized-uri-mapper.test.js +59 -0
  73. package/node_modules/@contrast/{sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/constants.js → sources/lib/req-data.js} +0 -6
  74. package/node_modules/@contrast/sources/lib/source-info.js +183 -0
  75. package/node_modules/@contrast/sources/lib/source-info.test.js +68 -0
  76. package/node_modules/@contrast/sources/package.json +16 -0
  77. package/node_modules/@contrast/telemetry/package.json +6 -6
  78. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +2831 -77
  79. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +2831 -77
  80. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
  81. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +415 -98
  82. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +415 -98
  83. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
  84. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +106 -0
  85. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +106 -0
  86. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
  87. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +1 -1
  88. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +1 -1
  89. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js.map +1 -1
  90. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +2831 -77
  91. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +2831 -77
  92. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
  93. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +415 -98
  94. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +415 -98
  95. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
  96. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +106 -0
  97. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +106 -0
  98. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
  99. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +1 -1
  100. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +1 -1
  101. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js.map +1 -1
  102. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +2831 -77
  103. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +2858 -103
  104. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
  105. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +415 -98
  106. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +420 -102
  107. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
  108. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +106 -0
  109. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +106 -0
  110. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
  111. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +1 -1
  112. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +1 -1
  113. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js.map +1 -1
  114. package/node_modules/@opentelemetry/semantic-conventions/package.json +3 -3
  115. package/node_modules/@swc/types/index.d.ts +3 -2
  116. package/node_modules/@swc/types/package.json +1 -1
  117. package/node_modules/@types/node/README.md +2 -2
  118. package/node_modules/@types/node/crypto.d.ts +17 -1
  119. package/node_modules/@types/node/fs/promises.d.ts +7 -3
  120. package/node_modules/@types/node/fs.d.ts +11 -1
  121. package/node_modules/@types/node/http.d.ts +4 -19
  122. package/node_modules/@types/node/http2.d.ts +13 -11
  123. package/node_modules/@types/node/inspector.d.ts +163 -6
  124. package/node_modules/@types/node/module.d.ts +24 -0
  125. package/node_modules/@types/node/package.json +4 -89
  126. package/node_modules/@types/node/perf_hooks.d.ts +14 -0
  127. package/node_modules/@types/node/repl.d.ts +11 -1
  128. package/node_modules/@types/node/sqlite.d.ts +0 -1
  129. package/node_modules/@types/node/stream/web.d.ts +4 -0
  130. package/node_modules/@types/node/stream.d.ts +17 -6
  131. package/node_modules/@types/node/test.d.ts +16 -1
  132. package/node_modules/@types/node/timers.d.ts +0 -2
  133. package/node_modules/@types/node/url.d.ts +1 -1
  134. package/node_modules/@types/node/util.d.ts +6 -2
  135. package/node_modules/@types/node/worker_threads.d.ts +12 -0
  136. package/node_modules/@types/node/zlib.d.ts +8 -2
  137. package/node_modules/axios/CHANGELOG.md +17 -0
  138. package/node_modules/axios/README.md +1 -4
  139. package/node_modules/axios/dist/axios.js +39 -5
  140. package/node_modules/axios/dist/axios.js.map +1 -1
  141. package/node_modules/axios/dist/axios.min.js +2 -2
  142. package/node_modules/axios/dist/axios.min.js.map +1 -1
  143. package/node_modules/axios/dist/browser/axios.cjs +46 -9
  144. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  145. package/node_modules/axios/dist/esm/axios.js +46 -9
  146. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  147. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  148. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  149. package/node_modules/axios/dist/node/axios.cjs +46 -9
  150. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  151. package/node_modules/axios/index.d.cts +13 -2
  152. package/node_modules/axios/lib/core/Axios.js +2 -2
  153. package/node_modules/axios/lib/core/mergeConfig.js +1 -1
  154. package/node_modules/axios/lib/env/data.js +1 -1
  155. package/node_modules/axios/lib/helpers/throttle.js +1 -1
  156. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +4 -3
  157. package/node_modules/axios/lib/utils.js +36 -0
  158. package/node_modules/axios/package.json +5 -5
  159. package/node_modules/deepmerge/.editorconfig +7 -0
  160. package/node_modules/deepmerge/.eslintcache +1 -0
  161. package/node_modules/deepmerge/changelog.md +167 -0
  162. package/node_modules/deepmerge/dist/cjs.js +133 -0
  163. package/node_modules/deepmerge/dist/umd.js +139 -0
  164. package/node_modules/deepmerge/index.d.ts +20 -0
  165. package/node_modules/deepmerge/index.js +106 -0
  166. package/node_modules/deepmerge/license.txt +21 -0
  167. package/node_modules/deepmerge/package.json +42 -0
  168. package/node_modules/deepmerge/readme.md +264 -0
  169. package/node_modules/deepmerge/rollup.config.js +22 -0
  170. package/node_modules/follow-redirects/package.json +1 -1
  171. package/node_modules/form-data/CHANGELOG.md +601 -0
  172. package/node_modules/form-data/{Readme.md → README.md} +4 -4
  173. package/node_modules/form-data/lib/form_data.js +2 -6
  174. package/node_modules/form-data/package.json +22 -6
  175. package/node_modules/nan/.github/workflows/ci.yml +8 -10
  176. package/node_modules/nan/.pre-commit-config.yaml +8 -0
  177. package/node_modules/nan/CHANGELOG.md +5 -1
  178. package/node_modules/nan/README.md +4 -4
  179. package/node_modules/nan/nan.h +16 -12
  180. package/node_modules/nan/nan_callbacks.h +13 -0
  181. package/node_modules/nan/nan_callbacks_12_inl.h +16 -2
  182. package/node_modules/nan/nan_callbacks_pre_12_inl.h +6 -2
  183. package/node_modules/nan/nan_maybe_43_inl.h +1 -1
  184. package/node_modules/nan/nan_maybe_pre_43_inl.h +1 -1
  185. package/node_modules/nan/nan_scriptorigin.h +11 -9
  186. package/node_modules/nan/nan_typedarray_contents.h +1 -1
  187. package/node_modules/nan/package.json +2 -2
  188. package/node_modules/undici-types/agent.d.ts +4 -0
  189. package/node_modules/undici-types/client-stats.d.ts +15 -0
  190. package/node_modules/undici-types/client.d.ts +6 -3
  191. package/node_modules/undici-types/mock-agent.d.ts +3 -0
  192. package/node_modules/undici-types/package.json +1 -1
  193. package/node_modules/undici-types/pool.d.ts +2 -0
  194. package/node_modules/undici-types/proxy-agent.d.ts +1 -0
  195. package/node_modules/yaml/README.md +2 -20
  196. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +1 -1
  197. package/node_modules/yaml/dist/stringify/stringifyString.js +1 -1
  198. package/node_modules/yaml/package.json +2 -1
  199. package/package.json +3 -2
  200. package/node_modules/@contrast/agentify/lib/sources.js +0 -95
  201. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/LICENSE +0 -12
  202. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/constants.d.ts +0 -385
  203. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/constants.js +0 -270
  204. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/index.d.ts +0 -40
  205. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/index.js +0 -228
  206. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/primordials.d.ts +0 -65
  207. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/primordials.js +0 -66
  208. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/types.d.ts +0 -383
  209. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/lib/types.js +0 -30
  210. package/node_modules/@contrast/sec-obs/node_modules/@contrast/common/package.json +0 -23
  211. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/LICENSE +0 -12
  212. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/README.md +0 -44
  213. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/common.js +0 -131
  214. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/config.js +0 -290
  215. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/index.d.ts +0 -328
  216. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/index.js +0 -29
  217. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/options.js +0 -836
  218. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/lib/validators.js +0 -23
  219. package/node_modules/@contrast/sec-obs/node_modules/@contrast/config/package.json +0 -27
  220. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/LICENSE +0 -12
  221. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/README.md +0 -98
  222. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/agent-info.js +0 -36
  223. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/app-info.js +0 -233
  224. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/build-id.js +0 -51
  225. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/capture-stacktrace.js +0 -256
  226. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/contrast-methods.js +0 -155
  227. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/index.d.ts +0 -52
  228. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/ioc/core.js +0 -95
  229. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/is-agent-path.js +0 -37
  230. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/messages.js +0 -28
  231. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +0 -63
  232. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
  233. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/sensitive-data-masking/server-settings-listener.js +0 -44
  234. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/cloud-provider-metadata.js +0 -146
  235. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/index.js +0 -225
  236. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/linux-os-info.js +0 -137
  237. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/lib/system-info/utils.js +0 -35
  238. package/node_modules/@contrast/sec-obs/node_modules/@contrast/core/package.json +0 -33
  239. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/LICENSE +0 -12
  240. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/README.md +0 -94
  241. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +0 -121
  242. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +0 -206
  243. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +0 -72
  244. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +0 -88
  245. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +0 -46
  246. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -106
  247. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -28
  248. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/helpers.js +0 -66
  249. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/index.d.ts +0 -115
  250. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/index.js +0 -208
  251. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +0 -43
  252. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/lib/package-finder.js +0 -79
  253. package/node_modules/@contrast/sec-obs/node_modules/@contrast/dep-hooks/package.json +0 -29
  254. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/LICENSE +0 -12
  255. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/README.md +0 -270
  256. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/index.d.ts +0 -16
  257. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/index.js +0 -132
  258. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/serializers.d.ts +0 -33
  259. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/serializers.js +0 -75
  260. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/utils.d.ts +0 -15
  261. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/lib/utils.js +0 -34
  262. package/node_modules/@contrast/sec-obs/node_modules/@contrast/logger/package.json +0 -28
  263. package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/LICENSE +0 -12
  264. package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/README.md +0 -51
  265. package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/lib/index.d.ts +0 -101
  266. package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/lib/index.js +0 -544
  267. package/node_modules/@contrast/sec-obs/node_modules/@contrast/patcher/package.json +0 -25
  268. package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/LICENSE +0 -12
  269. package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/README.md +0 -6
  270. package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/cache.js +0 -318
  271. package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/index.js +0 -216
  272. package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/lib/rewrite-is-deadzoned.js +0 -143
  273. package/node_modules/@contrast/sec-obs/node_modules/@contrast/rewriter/package.json +0 -30
  274. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/LICENSE +0 -12
  275. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/constants.js +0 -26
  276. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/index.d.ts +0 -46
  277. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/index.js +0 -70
  278. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/bluebird.js +0 -128
  279. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/index.js +0 -34
  280. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb-core.js +0 -83
  281. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb3.js +0 -89
  282. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb4.js +0 -80
  283. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mongodb6.js +0 -46
  284. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/mysql.js +0 -151
  285. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/install/redis.js +0 -79
  286. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/lib/utils.js +0 -35
  287. package/node_modules/@contrast/sec-obs/node_modules/@contrast/scopes/package.json +0 -28
  288. package/node_modules/@types/node/ts5.1/compatibility/disposable.d.ts +0 -12
  289. package/node_modules/@types/node/ts5.1/index.d.ts +0 -98
  290. package/node_modules/form-data/README.md.bak +0 -355
@@ -1,106 +0,0 @@
1
- /*
2
- * Copyright: 2025 Contrast Security, Inc
3
- * Contact: support@contrastsecurity.com
4
- * License: Commercial
5
-
6
- * NOTICE: This Software and the patented inventions embodied within may only be
7
- * used as part of Contrast Security’s commercial offerings. Even though it is
8
- * made available through public repositories, use of this Software is subject to
9
- * the applicable End User Licensing Agreement found at
10
- * https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
11
- * between Contrast Security and the End User. The Software may not be reverse
12
- * engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
- * way not consistent with the End User License Agreement.
14
- */
15
- // @ts-check
16
- 'use strict';
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- /**
19
- * @template {Object} T
20
- * @typedef {import('./export-hook-descriptor').Handler<T>} Handler
21
- */
22
- /** @typedef {import('./package-finder').Metadata} Metadata */
23
- class HandlerInvoker {
24
- /**
25
- * @param {import('pino').Logger} logger
26
- */
27
- constructor(logger) {
28
- /** @type {import('pino').Logger} */
29
- this.logger = logger;
30
- /** @type {WeakMap<Object, WeakSet<Handler<any>>>} */
31
- this.seen = new WeakMap();
32
- }
33
- /**
34
- * Filters a collection of handlers to those which have not run for the
35
- * provided export.
36
- * @template {Object} T
37
- * @param {T} xport The exported module
38
- * @param {Handler<T>[]} handlers Collection of handlers
39
- * @returns {Handler<T>[]}
40
- */
41
- filter(xport, handlers) {
42
- if (!xport || (typeof xport !== 'object' && typeof xport !== 'function')) {
43
- return [];
44
- }
45
- const seen = this.seen.get(xport);
46
- if (!seen) {
47
- const handlerSet = new WeakSet(handlers);
48
- this.seen.set(xport, handlerSet);
49
- return handlers;
50
- }
51
- return handlers.filter((handler) => {
52
- if (seen.has(handler)) {
53
- return false;
54
- }
55
- else {
56
- seen.add(handler);
57
- return true;
58
- }
59
- });
60
- }
61
- /**
62
- * Invoke all handlers in the provided collection that have not yet been run
63
- * for the provided export value.
64
- * @template {Object} T
65
- * @param {T} xport The exported module
66
- * @param {Handler<T>[]} handlers The handlers to invoke
67
- * @param {Metadata} metadata Export metadata to pass to the handlers
68
- * @returns {T}
69
- */
70
- invoke(xport, handlers, metadata) {
71
- /** @type {Handler<T>[]} */
72
- const handlersToRerun = [];
73
- const newHandlers = this.filter(xport, handlers);
74
- const rv = newHandlers.reduce((acc, handler) => {
75
- try {
76
- const rerun = () => {
77
- handlersToRerun.push(handler);
78
- };
79
- this.logger.trace({ metadata }, 'invoking handler: %s', metadata.name);
80
- return handler(acc, { rerun, ...metadata }) ?? acc;
81
- }
82
- catch (err) {
83
- this.logger.error({ err, metadata }, 'error invoking handler: %s', metadata.name);
84
- return acc;
85
- }
86
- }, xport);
87
- if (typeof rv == 'function' && rv != xport) {
88
- // @ts-expect-error
89
- this.seen.set(rv, this.seen.get(xport));
90
- }
91
- for (const handler of handlersToRerun) {
92
- this.seen.get(rv)?.delete?.(handler);
93
- this.seen.delete(handler);
94
- }
95
- return rv;
96
- }
97
- /**
98
- * @template {Object} T
99
- * @param {T} xport The exported module
100
- */
101
- reset(xport) {
102
- this.seen.delete(xport);
103
- }
104
- }
105
- module.exports = HandlerInvoker;
106
- //# sourceMappingURL=handler-invoker.js.map
@@ -1,28 +0,0 @@
1
- /**
2
- * Shortens a fully resolved filename to a short path that would be respected by
3
- * `require`.
4
- * @example
5
- * '/long/absolute/path/to/node_modules/package/lib/file.js' => 'package/lib/file'
6
- *
7
- * @param {{
8
- * name: string;
9
- * packageDir: string;
10
- * file: string;
11
- * main?: string;
12
- * }} opts
13
- * @returns {string}
14
- */
15
- export function getShortname({ name, packageDir, file, main }: {
16
- name: string;
17
- packageDir: string;
18
- file: string;
19
- main?: string;
20
- }): string;
21
- /**
22
- * polyfill for `module.isBuiltin` prior to Node v16.17.0
23
- * see: https://nodejs.org/docs/latest-v16.x/api/module.html#moduleisbuiltinmodulename
24
- * @param {string} name
25
- * @returns {boolean}
26
- */
27
- export function isBuiltin(name: string): boolean;
28
- //# sourceMappingURL=helpers.d.ts.map
@@ -1,66 +0,0 @@
1
- /*
2
- * Copyright: 2025 Contrast Security, Inc
3
- * Contact: support@contrastsecurity.com
4
- * License: Commercial
5
-
6
- * NOTICE: This Software and the patented inventions embodied within may only be
7
- * used as part of Contrast Security’s commercial offerings. Even though it is
8
- * made available through public repositories, use of this Software is subject to
9
- * the applicable End User Licensing Agreement found at
10
- * https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
11
- * between Contrast Security and the End User. The Software may not be reverse
12
- * engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
- * way not consistent with the End User License Agreement.
14
- */
15
- 'use strict';
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const Module = require('node:module');
18
- const path = require('node:path');
19
- const { isString, primordials: { StringPrototypeReplace, StringPrototypeSubstring, RegExpPrototypeTest } } = require('@contrast/common');
20
- const pathSepRegex = new RegExp(`\\${path.sep}`, 'g');
21
- /**
22
- * Shortens a fully resolved filename to a short path that would be respected by
23
- * `require`.
24
- * @example
25
- * '/long/absolute/path/to/node_modules/package/lib/file.js' => 'package/lib/file'
26
- *
27
- * @param {{
28
- * name: string;
29
- * packageDir: string;
30
- * file: string;
31
- * main?: string;
32
- * }} opts
33
- * @returns {string}
34
- */
35
- function getShortname({ name, packageDir, file, main }) {
36
- const mainPath = StringPrototypeReplace.call(path.join(packageDir, isString(main) ? main : ''), pathSepRegex, '\\$&');
37
- const mainPathRegex = new RegExp(`^${mainPath}\\${path.sep}?(index)?(\\.js(on)?)?$`);
38
- let normalizedFilename = path.normalize(file);
39
- if (RegExpPrototypeTest.call(mainPathRegex, normalizedFilename)) {
40
- return name;
41
- }
42
- else {
43
- normalizedFilename = StringPrototypeReplace.call(normalizedFilename, path.normalize(packageDir), name);
44
- normalizedFilename = StringPrototypeReplace.call(normalizedFilename, pathSepRegex, '/');
45
- normalizedFilename = StringPrototypeReplace.call(normalizedFilename, /\/?(index)?\.js$/, '');
46
- return normalizedFilename;
47
- }
48
- }
49
- /**
50
- * polyfill for `module.isBuiltin` prior to Node v16.17.0
51
- * see: https://nodejs.org/docs/latest-v16.x/api/module.html#moduleisbuiltinmodulename
52
- * @param {string} name
53
- * @returns {boolean}
54
- */
55
- function isBuiltin(name) {
56
- if (name.startsWith('node:')) {
57
- name = StringPrototypeSubstring.call(name, 5);
58
- }
59
- // @ts-expect-error we've set the node version to 14 before this was added.
60
- return Module.isBuiltin?.(name) ?? Module.builtinModules.includes(name);
61
- }
62
- module.exports = {
63
- getShortname,
64
- isBuiltin,
65
- };
66
- //# sourceMappingURL=helpers.js.map
@@ -1,115 +0,0 @@
1
- declare function _exports(core: {
2
- readonly logger: import('@contrast/logger').Logger;
3
- readonly messages: import('@contrast/common').Messages;
4
- depHooks: DepHooks;
5
- }): DepHooks;
6
- declare namespace _exports {
7
- export { DepHooks };
8
- export { LoadArgs, Metadata };
9
- }
10
- export = _exports;
11
- export type LoadArgs = {
12
- request: string;
13
- parent: Module;
14
- };
15
- export type Metadata = import('./package-finder').Metadata;
16
- /**
17
- * @typedef {Object} LoadArgs
18
- * @property {string} request
19
- * @property {Module} parent
20
- */
21
- /** @typedef {import('./package-finder').Metadata} Metadata */
22
- /**
23
- * Allows clients to register function handlers which run as a 'post-hook' at
24
- * require-time.
25
- */
26
- declare class DepHooks {
27
- /**
28
- * @param {Object} opts
29
- * @param {import('pino').Logger} opts.logger
30
- * @param {import('@contrast/common').Messages} opts.messages
31
- */
32
- constructor({ logger, messages }: {
33
- logger: import('pino').Logger;
34
- messages: import('@contrast/common').Messages;
35
- });
36
- /** @type {import('pino').Logger} */
37
- logger: import('pino').Logger;
38
- /** @type {import('@contrast/common').Messages} */
39
- messages: import('@contrast/common').Messages;
40
- /** @type {HandlerInvoker} */
41
- invoker: HandlerInvoker;
42
- /** @type {ExportHandlerRegistry} */
43
- registry: ExportHandlerRegistry;
44
- /** @type {WeakMap<Object, Object>} */
45
- requiredModules: WeakMap<Object, Object>;
46
- /** @type {Set<string>} */
47
- resets: Set<string>;
48
- /**
49
- * Registers handlers to run afer the described module is required.
50
- * @template {Object} T
51
- * @param {ExportHookDescriptor.Descriptor | string} descriptor describes the module to hook
52
- * @param {ExportHookDescriptor.Handler<T>[]} handlers the function hooks to execute after require
53
- */
54
- register<T extends Object>(descriptor: ExportHookDescriptor.Descriptor | string, ...handlers: ExportHookDescriptor.Handler<T>[]): void;
55
- /** Alias for `DepHooks#resolve` */
56
- resolve: <T extends Object>(descriptor: ExportHookDescriptor.Descriptor | string, ...handlers: ExportHookDescriptor.Handler<T>[]) => void;
57
- /**
58
- * Provided with an export, a collection of handlers, and metadata, will
59
- * invoke only the handlers which have not yet run on the export instance.
60
- * @template {Object} T
61
- * @param {T} xport the exported value of a required module
62
- * @param {ExportHookDescriptor.Handler<T>[]} handlers the function hooks to execute on require
63
- * @param {Metadata} metadata the export's metadata
64
- * @returns {T}
65
- */
66
- runRequireHandlers<T_1 extends Object>(xport: T_1, handlers: ExportHookDescriptor.Handler<T_1>[], metadata: Metadata): T_1;
67
- /**
68
- * Checks if module name exists in resets set. If so, it will remove it from
69
- * the set as well as remove it from the invoker WeakMap. This will force
70
- * instrumentation handlers to re-run. This use case is only used for testing
71
- * of the node agent in certain cases.
72
- * @template {Object} T
73
- * @param {string} request the string passed to require()
74
- * @param {T} xport the exported value of a required module
75
- */
76
- maybeClearHandlers<T_2 extends Object>(request: string, xport: T_2): void;
77
- /**
78
- * Instruments the Module._load method (invoked by require) to run registered handlers _after_ the modules
79
- * have loaded/compiled. Any value returned by the handlers will replace the return value of Module._load
80
- * and thus replace the export. This only works when the modules are required, but not imported. This is
81
- * due to how Node's ModuleWrap works, as it sets the export from the cjsExportCache and not from the return
82
- * value of Module._load like require does. In order to replace a target CJS export that is imported, we
83
- * also need to patch _compile (see below). We cannot replace the value of a built-in that is imported, but
84
- * we haven't had the need (we only really need to do that if an export is a function we need to patch e.g.
85
- * fastify, or connect middleware). We don't limit the Module._load patch to patching only built-ins, because
86
- * we need to support dep-hook handlers that need to run multiple times (via rerun option method that is
87
- * passed to handlers).
88
- *
89
- * This also instruments the _compile instance method with very similar logic to to the Module._load patch.
90
- * By patching _compile, we can set the value of module.exports directly in an earlier in the stage of CJS
91
- * module loading which occurs before the module is cached. This way we _can_ replace the export if the target
92
- * module is imported. The _compile function gets called exactly once per loaded module (excluding built-ins).
93
- *
94
- * @see https://github.com/nodejs/node/blob/main/lib/internal/modules/cjs/loader.js
95
- * @see https://github.com/nodejs/node/blob/main/lib/internal/modules/esm/translators.js
96
- */
97
- install(): void;
98
- originalLoad: any;
99
- originalCompile: any;
100
- /**
101
- * Resets Module's _load method to the original value.
102
- */
103
- uninstall(): void;
104
- /**
105
- * Resets the seen handlers for a given module - they will be re-run on next
106
- * require.
107
- * @param {string} request the string passed to require()
108
- */
109
- reset(request: string): void;
110
- }
111
- import Module = require("module");
112
- import HandlerInvoker = require("./handler-invoker");
113
- import ExportHandlerRegistry = require("./export-handler-registry");
114
- import ExportHookDescriptor = require("./export-hook-descriptor");
115
- //# sourceMappingURL=index.d.ts.map
@@ -1,208 +0,0 @@
1
- /*
2
- * Copyright: 2025 Contrast Security, Inc
3
- * Contact: support@contrastsecurity.com
4
- * License: Commercial
5
-
6
- * NOTICE: This Software and the patented inventions embodied within may only be
7
- * used as part of Contrast Security’s commercial offerings. Even though it is
8
- * made available through public repositories, use of this Software is subject to
9
- * the applicable End User Licensing Agreement found at
10
- * https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
11
- * between Contrast Security and the End User. The Software may not be reverse
12
- * engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
- * way not consistent with the End User License Agreement.
14
- */
15
- // @ts-check
16
- 'use strict';
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const Module = require('node:module');
19
- const ExportHandlerRegistry = require('./export-handler-registry');
20
- const ExportHookDescriptor = require('./export-hook-descriptor');
21
- const HandlerInvoker = require('./handler-invoker');
22
- /**
23
- * @typedef {Object} LoadArgs
24
- * @property {string} request
25
- * @property {Module} parent
26
- */
27
- /** @typedef {import('./package-finder').Metadata} Metadata */
28
- /**
29
- * Allows clients to register function handlers which run as a 'post-hook' at
30
- * require-time.
31
- */
32
- class DepHooks {
33
- /**
34
- * @param {Object} opts
35
- * @param {import('pino').Logger} opts.logger
36
- * @param {import('@contrast/common').Messages} opts.messages
37
- */
38
- constructor({ logger, messages }) {
39
- /** Alias for `DepHooks#resolve` */
40
- this.resolve = this.register;
41
- /** @type {import('pino').Logger} */
42
- this.logger = logger;
43
- /** @type {import('@contrast/common').Messages} */
44
- this.messages = messages;
45
- /** @type {HandlerInvoker} */
46
- this.invoker = new HandlerInvoker(logger);
47
- /** @type {ExportHandlerRegistry} */
48
- this.registry = new ExportHandlerRegistry({ logger, messages });
49
- /** @type {WeakMap<Object, Object>} */
50
- this.requiredModules = new WeakMap();
51
- /** @type {Set<string>} */
52
- this.resets = new Set();
53
- }
54
- /**
55
- * Registers handlers to run afer the described module is required.
56
- * @template {Object} T
57
- * @param {ExportHookDescriptor.Descriptor | string} descriptor describes the module to hook
58
- * @param {ExportHookDescriptor.Handler<T>[]} handlers the function hooks to execute after require
59
- */
60
- register(descriptor, ...handlers) {
61
- const info = ExportHookDescriptor.create(descriptor, handlers);
62
- this.registry.update(info);
63
- }
64
- /**
65
- * Provided with an export, a collection of handlers, and metadata, will
66
- * invoke only the handlers which have not yet run on the export instance.
67
- * @template {Object} T
68
- * @param {T} xport the exported value of a required module
69
- * @param {ExportHookDescriptor.Handler<T>[]} handlers the function hooks to execute on require
70
- * @param {Metadata} metadata the export's metadata
71
- * @returns {T}
72
- */
73
- runRequireHandlers(xport, handlers, metadata) {
74
- return this.invoker.invoke(xport, handlers, metadata);
75
- }
76
- /**
77
- * Checks if module name exists in resets set. If so, it will remove it from
78
- * the set as well as remove it from the invoker WeakMap. This will force
79
- * instrumentation handlers to re-run. This use case is only used for testing
80
- * of the node agent in certain cases.
81
- * @template {Object} T
82
- * @param {string} request the string passed to require()
83
- * @param {T} xport the exported value of a required module
84
- */
85
- maybeClearHandlers(request, xport) {
86
- if (this.resets.has(request)) {
87
- this.resets.delete(request);
88
- this.invoker.reset(xport);
89
- }
90
- }
91
- /**
92
- * Instruments the Module._load method (invoked by require) to run registered handlers _after_ the modules
93
- * have loaded/compiled. Any value returned by the handlers will replace the return value of Module._load
94
- * and thus replace the export. This only works when the modules are required, but not imported. This is
95
- * due to how Node's ModuleWrap works, as it sets the export from the cjsExportCache and not from the return
96
- * value of Module._load like require does. In order to replace a target CJS export that is imported, we
97
- * also need to patch _compile (see below). We cannot replace the value of a built-in that is imported, but
98
- * we haven't had the need (we only really need to do that if an export is a function we need to patch e.g.
99
- * fastify, or connect middleware). We don't limit the Module._load patch to patching only built-ins, because
100
- * we need to support dep-hook handlers that need to run multiple times (via rerun option method that is
101
- * passed to handlers).
102
- *
103
- * This also instruments the _compile instance method with very similar logic to to the Module._load patch.
104
- * By patching _compile, we can set the value of module.exports directly in an earlier in the stage of CJS
105
- * module loading which occurs before the module is cached. This way we _can_ replace the export if the target
106
- * module is imported. The _compile function gets called exactly once per loaded module (excluding built-ins).
107
- *
108
- * @see https://github.com/nodejs/node/blob/main/lib/internal/modules/cjs/loader.js
109
- * @see https://github.com/nodejs/node/blob/main/lib/internal/modules/esm/translators.js
110
- */
111
- install() {
112
- const self = this;
113
- /** @type LoadArgs[] */
114
- const loadStack = [];
115
- // don't define these prior to install(), since it will interfere with other
116
- // components that also need to instrument it e.g. agentify's rewrite-hooks.
117
- self.originalLoad = Reflect.get(Module, '_load');
118
- self.originalCompile = Reflect.get(Module.prototype, '_compile');
119
- this.logger.trace('Applying Module.prototype dep-hooks overrides');
120
- /**
121
- * @this {Module}
122
- * @param {string} request the string passed to require()
123
- * @param {Module} parent the module executing require()
124
- * @param {boolean} isMain indicates whether the module executing require() is the entry point
125
- */
126
- function __loadOverride(request, parent, isMain) {
127
- let exportHandlerInfo;
128
- let xport;
129
- loadStack.push({ request, parent });
130
- try {
131
- exportHandlerInfo = self.registry.query(request, parent, isMain);
132
- xport = Reflect.apply(self.originalLoad, this, [request, parent, isMain]);
133
- if (exportHandlerInfo) {
134
- self.maybeClearHandlers(request, xport);
135
- const xportSubstitution = self.runRequireHandlers(self.requiredModules.get(xport) ?? xport, exportHandlerInfo.handlers, exportHandlerInfo.metadata);
136
- self.requiredModules.set(xport, xportSubstitution);
137
- }
138
- }
139
- finally {
140
- loadStack.pop();
141
- }
142
- return self.requiredModules.get(xport) ?? xport;
143
- }
144
- /**
145
- * @this {Module}
146
- * @param {string} content
147
- * @param {string} filename
148
- * @param {string} format
149
- */
150
- function __compileOverride(content, filename, format) {
151
- // run original which this sets the value of this.exports
152
- const ret = Reflect.apply(self.originalCompile, this, [content, filename, format]);
153
- const xports = this.exports;
154
- // registry works based on request and parent arguments passed to Module._load.
155
- // so use the values the _load hook captured in loadStack
156
- const { request, parent } = loadStack[loadStack.length - 1];
157
- try {
158
- const exportHandlerInfo = self.registry.query(request, parent, false);
159
- if (exportHandlerInfo) {
160
- self.maybeClearHandlers(request, xports);
161
- const xportSubstitution = self.runRequireHandlers(self.requiredModules.get(xports) ?? xports, exportHandlerInfo.handlers, exportHandlerInfo.metadata);
162
- self.requiredModules.set(xports, xportSubstitution);
163
- // set the value of the exports. this value will be cached
164
- this.exports = self.requiredModules.get(xports) ?? xports;
165
- }
166
- }
167
- catch {
168
- //
169
- }
170
- return ret;
171
- }
172
- Reflect.set(Module, '_load', __loadOverride);
173
- Reflect.set(Module.prototype, '_compile', __compileOverride);
174
- }
175
- /**
176
- * Resets Module's _load method to the original value.
177
- */
178
- uninstall() {
179
- this.logger.trace('Removing dep-hook Module patches');
180
- this.originalLoad && Reflect.set(Module, '_load', this.originalLoad);
181
- this.originalCompile && Reflect.set(Module.prototype, '_compile', this.originalCompile);
182
- }
183
- /**
184
- * Resets the seen handlers for a given module - they will be re-run on next
185
- * require.
186
- * @param {string} request the string passed to require()
187
- */
188
- reset(request) {
189
- this.resets.add(request);
190
- }
191
- }
192
- /**
193
- * @param {{
194
- * readonly logger: import('@contrast/logger').Logger;
195
- * readonly messages: import('@contrast/common').Messages;
196
- * depHooks: DepHooks;
197
- * }} core
198
- * @returns {DepHooks}
199
- */
200
- module.exports = function init(core) {
201
- core.depHooks = new DepHooks({
202
- logger: core.logger.child({ name: 'contrast:dep-hooks' }),
203
- messages: core.messages,
204
- });
205
- return core.depHooks;
206
- };
207
- module.exports.DepHooks = DepHooks;
208
- //# sourceMappingURL=index.js.map
@@ -1,43 +0,0 @@
1
- export type Metadata = {
2
- /**
3
- * the name of the module being required as indicated by its package.json
4
- */
5
- name: string;
6
- /**
7
- * shortened version of the module name + file being required
8
- */
9
- shortname: string;
10
- /**
11
- * the version of the module being required as indicated by its package.json
12
- */
13
- version: string;
14
- /**
15
- * the location of the module being required
16
- */
17
- packageDir: string;
18
- /**
19
- * the absolute filename of the module file being required
20
- */
21
- file: string;
22
- /**
23
- * `main` field from the package being required's package.json
24
- */
25
- main?: string | undefined;
26
- };
27
- /**
28
- * @typedef {Object} Metadata
29
- * @property {string} name the name of the module being required as indicated by its package.json
30
- * @property {string} shortname shortened version of the module name + file being required
31
- * @property {string} version the version of the module being required as indicated by its package.json
32
- * @property {string} packageDir the location of the module being required
33
- * @property {string} file the absolute filename of the module file being required
34
- * @property {string=} main `main` field from the package being required's package.json
35
- */
36
- /**
37
- * Resolves the metadata of a package given it's resolved name.
38
- * @param {string=} file Absolute path to the module file
39
- * @param {import('pino').Logger=} logger
40
- * @returns {Metadata?}
41
- */
42
- export function resolveMetadata(file?: string | undefined, logger?: import('pino').Logger | undefined): Metadata | null;
43
- //# sourceMappingURL=package-finder.d.ts.map
@@ -1,79 +0,0 @@
1
- /*
2
- * Copyright: 2025 Contrast Security, Inc
3
- * Contact: support@contrastsecurity.com
4
- * License: Commercial
5
-
6
- * NOTICE: This Software and the patented inventions embodied within may only be
7
- * used as part of Contrast Security’s commercial offerings. Even though it is
8
- * made available through public repositories, use of this Software is subject to
9
- * the applicable End User Licensing Agreement found at
10
- * https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
11
- * between Contrast Security and the End User. The Software may not be reverse
12
- * engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
- * way not consistent with the End User License Agreement.
14
- */
15
- // @ts-check
16
- 'use strict';
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const path = require('node:path');
19
- const { findPackageJsonSync } = require('@contrast/find-package-json');
20
- const { getShortname, isBuiltin } = require('./helpers');
21
- const { primordials: { StringPrototypeReplace, StringPrototypeSubstring, JSONParse, FsReadFileSync } } = require('@contrast/common');
22
- /**
23
- * @typedef {Object} Metadata
24
- * @property {string} name the name of the module being required as indicated by its package.json
25
- * @property {string} shortname shortened version of the module name + file being required
26
- * @property {string} version the version of the module being required as indicated by its package.json
27
- * @property {string} packageDir the location of the module being required
28
- * @property {string} file the absolute filename of the module file being required
29
- * @property {string=} main `main` field from the package being required's package.json
30
- */
31
- /**
32
- * Resolves the metadata of a package given it's resolved name.
33
- * @param {string=} file Absolute path to the module file
34
- * @param {import('pino').Logger=} logger
35
- * @returns {Metadata?}
36
- */
37
- function resolveMetadata(file, logger) {
38
- if (!file) {
39
- return null;
40
- }
41
- if (isBuiltin(file)) {
42
- // @ts-ignore ts does not handle method overloads well
43
- file = StringPrototypeReplace.call(file, /^(node:)?/, 'node:');
44
- return {
45
- name: file,
46
- version: StringPrototypeSubstring.call(process.version, 1),
47
- packageDir: file,
48
- file,
49
- shortname: file,
50
- };
51
- }
52
- const resolved = path.dirname(file);
53
- const pdj = findPackageJsonSync({ cwd: resolved });
54
- if (!pdj) {
55
- logger?.error('unable to find package.json for %s', file);
56
- return null;
57
- }
58
- try {
59
- const json = FsReadFileSync(pdj, 'utf8');
60
- const { name, version, main } = JSONParse(json);
61
- const packageDir = path.dirname(pdj);
62
- return {
63
- name,
64
- version,
65
- packageDir,
66
- file,
67
- shortname: getShortname({ name, packageDir, file, main }),
68
- main,
69
- };
70
- }
71
- catch (err) {
72
- logger?.error({ err }, 'unable to parse %s', pdj);
73
- return null;
74
- }
75
- }
76
- module.exports = {
77
- resolveMetadata,
78
- };
79
- //# sourceMappingURL=package-finder.js.map
@@ -1,29 +0,0 @@
1
- {
2
- "name": "@contrast/dep-hooks",
3
- "version": "1.22.0",
4
- "description": "Post hooks for Module.prototype.require",
5
- "license": "SEE LICENSE IN LICENSE",
6
- "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
7
- "files": [
8
- "lib/",
9
- "!*.test.*",
10
- "!tsconfig.*",
11
- "!*.map"
12
- ],
13
- "main": "lib/index.js",
14
- "types": "lib/index.d.ts",
15
- "engines": {
16
- "npm": ">=6.13.7 <7 || >=8.3.1",
17
- "node": ">=16.9.1"
18
- },
19
- "scripts": {
20
- "build": "tsc --build src/",
21
- "test": "bash ../scripts/test.sh"
22
- },
23
- "dependencies": {
24
- "@contrast/common": "1.33.0",
25
- "@contrast/find-package-json": "^1.1.0",
26
- "@contrast/logger": "1.26.0",
27
- "semver": "^7.6.3"
28
- }
29
- }