@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,256 +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
-
18
- const process = require('process');
19
- const fnInspect = require('@contrast/fn-inspect');
20
- const { primordials: { StringPrototypeReplace, RegExpPrototypeExec } } = require('@contrast/common');
21
-
22
- /** @typedef {import('.').Frame} Frame */
23
- /** @typedef {import('.').CreateSnapshotOpts} CreateSnapshotOpts */
24
-
25
- const EVAL_ORIGIN_REGEX = /\((.*?):(\d+):\d+\)/;
26
-
27
- module.exports = function(core) {
28
- const { config, isAgentPath } = core;
29
-
30
- const stacktraceFactory = new StacktraceFactory({
31
- stackTraceLimit: config.agent.stack_trace_limit,
32
- isAgentPath
33
- });
34
-
35
- /** @type {StacktraceFactory['captureStacktrace']} */
36
- core.captureStacktrace = function (obj, opts, key) {
37
- return stacktraceFactory.captureStacktrace(obj, opts, key);
38
- };
39
-
40
- /** @type {StacktraceFactory['createSnapshot']} */
41
- core.createSnapshot = function (opts) {
42
- return stacktraceFactory.createSnapshot(opts);
43
- };
44
-
45
- return core.captureStacktrace;
46
- };
47
-
48
- class StacktraceFactory {
49
- /**
50
- * The factory will set stacktrace limit for stackframe lists created by it.
51
- * @param {Object} opts
52
- * @param {number} opts.stackTraceLimit set the stack trace limit
53
- * @param {(path: string) => boolean} opts.isAgentPath function indicating if path is agent code
54
- */
55
- constructor({ stackTraceLimit, isAgentPath }) {
56
- this.stackTraceLimit = stackTraceLimit;
57
- this.isAgentPath = isAgentPath;
58
- }
59
-
60
- /**
61
- * @template T
62
- * @param {T} obj
63
- * @param {CreateSnapshotOpts} opts
64
- * @param {string} key
65
- * @returns {T}
66
- */
67
- captureStacktrace(obj, opts, key = 'stack') {
68
- let stack;
69
- const snapshot = this.createSnapshot(opts);
70
- Object.defineProperty(obj, key, {
71
- enumerable: true,
72
- configurable: true,
73
- get() {
74
- if (!stack) {
75
- Object.defineProperty(obj, key, {
76
- configurable: true,
77
- writable: true,
78
- enumerable: true,
79
- value: snapshot()
80
- });
81
- }
82
- return obj[key];
83
- }
84
- });
85
- return obj;
86
- }
87
-
88
- /**
89
- * @param {Frame} frame
90
- * @returns {boolean}
91
- */
92
- shouldAppendFrame(frame) {
93
- return (
94
- !!frame.file &&
95
- !this.isAgentPath(frame.file) &&
96
- !`${frame.type}${frame.method}`.includes('ContrastMethods')
97
- );
98
- }
99
-
100
- /**
101
- * Creates a function that will build a stacktrace when invoked. It will keep
102
- * an error in a closure whose stack will be generated and processed when the
103
- * returned function executes. The result will be cached.
104
- * @param {CreateSnapshotOpts} params
105
- * @returns {() => Frame[]}
106
- */
107
- createSnapshot({ constructorOpt, prependFrames } = {}) {
108
- const target = {};
109
- this.appendStackGetter(target, constructorOpt);
110
-
111
- let frames;
112
-
113
- /**
114
- * Generates array of frames from `target`'s `stack` getter
115
- * @returns {Frame[]}
116
- */
117
- const snapshot = () => {
118
- if (!frames) {
119
- // @ts-expect-error target has had a stack getter appended above.
120
- const callsites = StacktraceFactory.generateCallsites(target) ?? [];
121
- frames = callsites.reduce(
122
- /**
123
- * @param {Frame[]} acc
124
- * @param {NodeJS.CallSite} callsite
125
- */
126
- (acc, callsite) => {
127
- if (StacktraceFactory.isCallsiteValid(callsite)) {
128
- const frame = StacktraceFactory.makeFrame(callsite);
129
- if (this.shouldAppendFrame(frame)) {
130
- acc.push(frame);
131
- }
132
- }
133
-
134
- return acc;
135
- },
136
- [],
137
- );
138
- }
139
-
140
- if (!prependFrames) return frames;
141
-
142
- return [
143
- ...prependFrames.map((f) => (typeof f == 'function' ? fnInspect.funcInfo(f) : f)),
144
- ...frames,
145
- ];
146
- };
147
-
148
- return snapshot;
149
- }
150
-
151
- /**
152
- * Based on stacktrace limit and constructor opt, will append a stack getter
153
- * @param {any} obj
154
- * @param {Function=} constructorOpt
155
- */
156
- appendStackGetter(obj, constructorOpt) {
157
- const { stackTraceLimit } = Error;
158
- Error.stackTraceLimit = this.stackTraceLimit;
159
- Error.captureStackTrace(obj, constructorOpt);
160
- Error.stackTraceLimit = stackTraceLimit;
161
- }
162
-
163
- /**
164
- * @param {any} callsite
165
- * @returns {boolean}
166
- */
167
- static isCallsiteValid(callsite) {
168
- return callsite instanceof Callsite;
169
- }
170
-
171
- /**
172
- * Creates an array frame objects from an array of Callsite instances
173
- * @param {NodeJS.CallSite} callsite
174
- * @returns {Frame}
175
- */
176
- static makeFrame(callsite) {
177
- /** @type {string | undefined} */
178
- let evalOrigin;
179
- /** @type {string | undefined} */
180
- let file;
181
- /** @type {number | null} */
182
- let lineNumber = null;
183
- /** @type {string | null} */
184
- let method = null;
185
- /** @type {string | null} */
186
- let type;
187
-
188
- if (callsite.isEval()) {
189
- evalOrigin = StacktraceFactory.formatFileName(callsite.getEvalOrigin());
190
- const matches = RegExpPrototypeExec.call(EVAL_ORIGIN_REGEX, evalOrigin);
191
- if (matches) {
192
- file = matches[1];
193
- lineNumber = parseInt(matches[2]);
194
- }
195
- }
196
-
197
- file = file ?? callsite.getFileName();
198
- lineNumber = lineNumber ?? callsite.getLineNumber();
199
- method = callsite.getFunctionName();
200
- type = callsite.getTypeName();
201
-
202
- if (method === null && type === 'Object') {
203
- method = '<anonymous>';
204
- type = null;
205
- }
206
-
207
- return { eval: evalOrigin, file, lineNumber, method, type };
208
- }
209
-
210
- /**
211
- * @param {string} fileName
212
- * @returns {string}
213
- */
214
- static formatFileName(fileName = '') {
215
- const cwd = `${process.cwd()}/`;
216
- const idx = fileName.indexOf(cwd);
217
-
218
- if (idx > -1) {
219
- return StringPrototypeReplace.call(fileName, cwd, ''); // + 1 to remove /
220
- }
221
- return fileName;
222
- }
223
-
224
- /**
225
- * Will access `stack` getter propery on the provided error to generate
226
- * a stacktrace. We capture the callsite instances passed to `prepareStacktrace`
227
- * using an ephemeral monkey patch.
228
- * @param {Error} error object with a `stack` getter property
229
- * @returns {NodeJS.CallSite[]}
230
- */
231
- static generateCallsites(error) {
232
- let callsites = [];
233
-
234
- const { prepareStackTrace } = Error;
235
-
236
- Error.prepareStackTrace = function contrastPrepareStackTrace(_, _callsites) {
237
- callsites = _callsites;
238
- return _callsites;
239
- };
240
-
241
- // accessing the getter will call `Error.prepareStacktrace`
242
- error.stack;
243
-
244
- // restore original method
245
- Error.prepareStackTrace = prepareStackTrace;
246
-
247
- return callsites;
248
- }
249
- }
250
-
251
- module.exports.StacktraceFactory = StacktraceFactory;
252
- module.exports.generateCallsites = StacktraceFactory.generateCallsites;
253
-
254
- const Callsite = (module.exports.Callsite = StacktraceFactory.generateCallsites(
255
- new Error()
256
- )[0].constructor);
@@ -1,155 +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
-
16
- 'use strict';
17
-
18
- const { primordials: { StringPrototypeSlice } } = require('@contrast/common');
19
-
20
- module.exports = function (core) {
21
- const { logger, patcher } = core;
22
-
23
- const getOrig = (v) => patcher.unwrap(v);
24
- const toUntrackedString = (v) => StringPrototypeSlice.call(` ${v}`, 1);
25
-
26
- /**
27
- * Components e.g. Assess, Protect, can
28
- * 1) configure rewriter to add desired ContrastMethod functions to source code
29
- * 2) patch those functions on `contrastMethods.api` in order to add instrumentation
30
- */
31
- core.contrastMethods = {
32
- api: {
33
- eval(val) {
34
- return val;
35
- },
36
-
37
- // Assignment Operators
38
- addAssign(left, right) {
39
- return this.add(left, right);
40
- },
41
-
42
- // Binary Operators
43
- add(left, right) {
44
- const ret = getOrig(left) + getOrig(right);
45
- return ret;
46
- },
47
- eqEq(left, right) {
48
- left = getOrig(left);
49
- right = getOrig(right);
50
-
51
- return left == right;
52
- },
53
- eqEqEq(left, right) {
54
- left = getOrig(left);
55
- right = getOrig(right);
56
-
57
- return left === right;
58
- },
59
- notEq(left, right) {
60
- left = getOrig(left);
61
- right = getOrig(right);
62
-
63
- return left != right;
64
- },
65
- notEqEq(left, right) {
66
- left = getOrig(left);
67
- right = getOrig(right);
68
-
69
- return left !== right;
70
- },
71
-
72
- // Computed Properties
73
- // Used to force a copy of handle:
74
- // https://stackoverflow.com/a/31733628
75
- // This is a workaround for CONTRAST-30333, in which something we
76
- // suspect is a v8 bug means that handle will otherwise be clobbered
77
- // and if it was externalized, we will lose the data associated with it
78
- forceCopy(handle) {
79
- if (typeof handle === 'string') {
80
- handle = toUntrackedString(handle);
81
- }
82
- return handle;
83
- },
84
-
85
- // Switch Case
86
- cast(val) {
87
- return getOrig(val);
88
- },
89
-
90
- /**
91
- * Tagged Templates
92
- * The first argument received by the tag function is an array of strings.
93
- * For any template literal, its length is equal to the number of
94
- * substitutions (occurrences of ${...}) plus one, and is therefore always
95
- * non-empty.
96
- * see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
97
- * @param {string[]} strings length n+1
98
- * @param {string[]} args length n
99
- * @returns {string}
100
- */
101
- tag(strings, ...args) {
102
- const [first, ...rest] = strings;
103
-
104
- return rest.reduce(
105
- (result, str, i) => result.concat(args[i], str),
106
- first,
107
- );
108
- },
109
-
110
- // Injections
111
- Function: core.patcher.patch(global.Function, {
112
- name: 'global.Function',
113
- patchType: 'rewrite-injection',
114
- }),
115
- Number: core.patcher.patch(global.Number, {
116
- name: 'global.Number',
117
- patchType: 'rewrite-injection',
118
- }),
119
- Object: core.patcher.patch(global.Object, {
120
- name: 'global.Object',
121
- patchType: 'rewrite-injection',
122
- }),
123
- String: core.patcher.patch(global.String, {
124
- name: 'global.String',
125
- patchType: 'rewrite-injection',
126
- }),
127
- },
128
-
129
- installed: false,
130
-
131
- getGlobal() {
132
- return global;
133
- },
134
-
135
- install() {
136
- if (this.installed) return;
137
-
138
- try {
139
- Object.defineProperty(this.getGlobal(), 'ContrastMethods', {
140
- enumerable: true,
141
- configurable: false,
142
- value: this.api,
143
- });
144
-
145
- this.installed = true;
146
- } catch (err) {
147
- // We should never expect this since the installation process is well
148
- // controlled, but still we should have the defensive code.
149
- logger.error({ err }, 'Unable to define global.ContrastMethods');
150
- }
151
- },
152
- };
153
-
154
- return core.contrastMethods;
155
- };
@@ -1,52 +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
-
16
- import { AppInfo, Messages, SystemInfo, ThreadTransferData } from '@contrast/common';
17
-
18
- interface Frame {
19
- eval: string | undefined;
20
- file: string | undefined;
21
- lineNumber: number | null;
22
- method: string | null;
23
- type: string | null;
24
- }
25
-
26
- /* eslint-disable @typescript-eslint/ban-types */
27
- interface CreateSnapshotOpts {
28
- constructorOpt?: Function;
29
- prependFrames?: (Function | Frame)[];
30
- }
31
-
32
- export interface Core {
33
- threadTransferData: ThreadTransferData;
34
- agentName: string;
35
- agentVersion: string;
36
- reportingInstance: string;
37
-
38
- appInfo: AppInfo;
39
-
40
- captureStackTrace<T>(obj: T, opts: CreateSnapshotOpts, key: string): T;
41
- createSnapshot(opts?: CreateSnapshotOpts): () => Frame[];
42
-
43
- isAgentPath(path: string): boolean;
44
-
45
- messages: Messages;
46
-
47
- sensitiveDataMasking: any;
48
-
49
- getSystemInfo(): Promise<SystemInfo>;
50
- getBuildId(): Promse<number | void>;
51
- Perf: any;
52
- }
@@ -1,95 +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
-
16
- 'use strict';
17
-
18
- const EventEmitter = require('events');
19
- const Perf = require('@contrast/perf');
20
-
21
- const kComponentName = Symbol('kComponentName');
22
-
23
- class Core {
24
- constructor(initData = {}) {
25
- const core = this;
26
- // setup perf tools
27
-
28
- this.Perf = Perf;
29
- this.perf = new Perf('core');
30
- Perf.setInterval();
31
-
32
- // setup messaging
33
- this.messages = new EventEmitter();
34
- // pad for number of components that listen for server-settings-update messages
35
- this.messages.setMaxListeners(10 + this.messages.getMaxListeners());
36
-
37
- // merge init data
38
- Object.assign(this, { ...initData });
39
-
40
- if (process.env.CONTRAST_EXT_PATH) {
41
- const path = require('path');
42
- require(path.resolve(process.env.CONTRAST_EXT_PATH))(this);
43
- }
44
-
45
- this.messages.on('ext:core.init', (fullName) => {
46
- // if scopes is composed, then run our event handlers in a no-instrumentation scope
47
- if (fullName == 'scopes') {
48
- const store = { name: 'core.messages.emit', lock: true };
49
- const emit = core.messages.emit.bind(core.messages);
50
- core.messages.emit = function(...args) {
51
- return core.scopes.instrumentation.isLocked() ?
52
- core.scopes.instrumentation.run(store, emit, ...args) :
53
- emit(...args);
54
- };
55
- }
56
- });
57
- }
58
-
59
- /**
60
- * Given a component factory and spec name will initialize the factory using perf.
61
- * @param {function} factory the component factory function
62
- * @param {string} specName id used by perf
63
- */
64
- initComponentFactory(factory, specName) {
65
- this.perf.wrapInit(factory, specName)(this);
66
- }
67
-
68
- /**
69
- * If component factory is decorated with metadata, then we can
70
- * use the metadata to hook into core's extension events.
71
- * @param {function} component
72
- * @param {string} component.fullName
73
- * @throws {Error} if component doesn't have appropriate metadata
74
- */
75
- initComponentSync(component) {
76
- this.perf.wrapInit(component, component[kComponentName])(this);
77
- this.messages.emit('ext:core.init', component[kComponentName]);
78
- }
79
-
80
- static isComponent(target) {
81
- return typeof target == 'function' && target[kComponentName]?.length > 0;
82
- }
83
-
84
- static makeComponent(meta) {
85
- if (!meta.factory || !meta.name) throw new Error('makeComponent requires factory and name');
86
-
87
- // decorate with metadata
88
- meta.factory[kComponentName] = meta.name;
89
-
90
- return meta.factory;
91
- }
92
- }
93
-
94
- module.exports = Core;
95
- module.exports.Core = Core;
@@ -1,37 +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
-
17
- module.exports = function(core) {
18
- const { config } = core;
19
-
20
- /**
21
- * Returns true if the provided path matches any of the configured filters.
22
- * @param {string} path
23
- * @returns {boolean}
24
- */
25
- function isAgentPath(path) {
26
- for (const seg of config.agent.stack_trace_filters) {
27
- if (path.indexOf(seg) > -1) {
28
- return true;
29
- }
30
- }
31
- return false;
32
- }
33
-
34
- core.isAgentPath = isAgentPath;
35
-
36
- return isAgentPath;
37
- };
@@ -1,28 +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
-
16
- 'use strict';
17
-
18
- const EventEmitter = require('events');
19
-
20
- module.exports = function init(core) {
21
- const perf = new core.Perf('messages');
22
- const messages = perf.wrapEmitter(new EventEmitter());
23
-
24
- // pad for number of components that listen for server-settings-update messages
25
- messages.setMaxListeners(10 + messages.getMaxListeners());
26
-
27
- return core.messages = messages;
28
- };
@@ -1,63 +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
-
16
- 'use strict';
17
-
18
- const { traverseKeys, primordials: { StringPrototypeToLowerCase } } = require('@contrast/common');
19
- const { CONTRAST_REDACTED } = require('./constants');
20
-
21
- module.exports = function(core) {
22
- const idMap = new Map();
23
- const keywordSets = [];
24
-
25
- function getRedactedText(key) {
26
- key = StringPrototypeToLowerCase.call(key);
27
- for (const set of keywordSets) {
28
- if (set.has(key)) {
29
- return `${CONTRAST_REDACTED}-${idMap.get(set)}`;
30
- }
31
- }
32
- }
33
-
34
- function traverseAndMask(target, unmasked) {
35
- let redactedText;
36
- if (!target) return;
37
-
38
- traverseKeys(target, (path, type, value, obj) => {
39
- redactedText = getRedactedText(value);
40
- if (redactedText) {
41
- if (unmasked) unmasked.add(obj[value]);
42
- obj[value] = redactedText;
43
- redactedText = undefined;
44
- }
45
- });
46
- }
47
-
48
- const sensitiveDataMasking = core.sensitiveDataMasking = {
49
- policy: {
50
- idMap,
51
- keywordSets,
52
- maskHttpBody: false,
53
- maskAttackVector: false,
54
- },
55
- getRedactedText,
56
- traverseAndMask
57
- };
58
-
59
- require('./server-settings-listener')(core);
60
- require('./protect-listener')(core);
61
-
62
- return sensitiveDataMasking;
63
- };