@contrast/agent-bundle 5.42.0 → 5.46.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 (484) hide show
  1. package/README.md +1 -10
  2. package/node_modules/@contrast/agent/README.md +1 -10
  3. package/node_modules/@contrast/agent/package.json +12 -12
  4. package/node_modules/@contrast/agent-swc-plugin/package.json +3 -3
  5. package/node_modules/@contrast/agentify/lib/rewrite-hooks.js +3 -3
  6. package/node_modules/@contrast/agentify/lib/utils.js +13 -7
  7. package/node_modules/@contrast/agentify/package.json +17 -17
  8. package/node_modules/@contrast/architecture-components/package.json +6 -6
  9. package/node_modules/@contrast/assess/lib/dataflow/propagation/install/ejs/template.js +1 -1
  10. package/node_modules/@contrast/assess/lib/dataflow/propagation/install/pug/index.js +1 -1
  11. package/node_modules/@contrast/assess/lib/dataflow/sinks/install/http/server-response.js +1 -12
  12. package/node_modules/@contrast/assess/lib/dataflow/sinks/install/restify.js +1 -1
  13. package/node_modules/@contrast/assess/lib/dataflow/sources/handler.js +21 -24
  14. package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +1 -1
  15. package/node_modules/@contrast/assess/lib/dataflow/tracker.js +1 -1
  16. package/node_modules/@contrast/assess/lib/get-source-context.js +11 -22
  17. package/node_modules/@contrast/assess/lib/index.js +1 -1
  18. package/node_modules/@contrast/assess/lib/make-source-context.js +5 -10
  19. package/node_modules/@contrast/assess/lib/policy.js +400 -0
  20. package/node_modules/@contrast/assess/lib/response-scanning/handlers/index.js +10 -14
  21. package/node_modules/@contrast/assess/lib/response-scanning/install/http.js +0 -12
  22. package/node_modules/@contrast/assess/lib/session-configuration/handlers.js +1 -1
  23. package/node_modules/@contrast/assess/package.json +14 -14
  24. package/node_modules/@contrast/code-events/binding.gyp +1 -1
  25. package/node_modules/@contrast/code-events/package.json +11 -9
  26. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi108.node +0 -0
  27. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi115.node +0 -0
  28. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/@contrast+code-events.abi127.node +0 -0
  29. package/node_modules/@contrast/code-events/prebuilds/darwin-x64+arm64/{@contrast+code-events.abi93.node → @contrast+code-events.abi137.node} +0 -0
  30. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi108.armv8.node +0 -0
  31. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi115.armv8.node +0 -0
  32. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi127.armv8.node +0 -0
  33. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi137.armv8.node +0 -0
  34. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.glibc.node +0 -0
  35. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi108.musl.node +0 -0
  36. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.glibc.node +0 -0
  37. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi115.musl.node +0 -0
  38. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.glibc.node +0 -0
  39. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi127.musl.node +0 -0
  40. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.glibc.node +0 -0
  41. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi137.musl.node +0 -0
  42. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi108.node +0 -0
  43. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi115.node +0 -0
  44. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi127.node +0 -0
  45. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi137.node +0 -0
  46. package/node_modules/@contrast/common/lib/constants.d.ts +1 -1
  47. package/node_modules/@contrast/common/lib/constants.js +1 -1
  48. package/node_modules/@contrast/common/lib/index.js +15 -15
  49. package/node_modules/@contrast/common/lib/primordials.d.ts +22 -20
  50. package/node_modules/@contrast/common/lib/types.d.ts +18 -6
  51. package/node_modules/@contrast/common/package.json +2 -2
  52. package/node_modules/@contrast/config/lib/options.js +37 -4
  53. package/node_modules/@contrast/config/package.json +4 -4
  54. package/node_modules/@contrast/core/lib/app-info.js +53 -74
  55. package/node_modules/@contrast/core/lib/index.d.ts +17 -1
  56. package/node_modules/@contrast/core/lib/sensitive-data-masking/index.js +33 -5
  57. package/node_modules/@contrast/core/package.json +10 -9
  58. package/node_modules/@contrast/deadzones/package.json +6 -6
  59. package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.d.ts +17 -13
  60. package/node_modules/@contrast/dep-hooks/lib/export-handler-registry.js +16 -4
  61. package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.d.ts +2 -2
  62. package/node_modules/@contrast/dep-hooks/lib/export-hook-descriptor.js +2 -3
  63. package/node_modules/@contrast/dep-hooks/lib/handler-invoker.d.ts +6 -6
  64. package/node_modules/@contrast/dep-hooks/lib/handler-invoker.js +0 -1
  65. package/node_modules/@contrast/dep-hooks/lib/helpers.d.ts +0 -7
  66. package/node_modules/@contrast/dep-hooks/lib/helpers.js +2 -18
  67. package/node_modules/@contrast/dep-hooks/lib/index.d.ts +17 -12
  68. package/node_modules/@contrast/dep-hooks/lib/index.js +5 -3
  69. package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -1
  70. package/node_modules/@contrast/dep-hooks/lib/package-finder.js +6 -6
  71. package/node_modules/@contrast/dep-hooks/package.json +4 -3
  72. package/node_modules/@contrast/distringuish/package.json +7 -6
  73. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi108.node +0 -0
  74. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi115.node +0 -0
  75. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/@contrast+distringuish.abi127.node +0 -0
  76. package/node_modules/@contrast/distringuish/prebuilds/darwin-x64+arm64/{@contrast+distringuish.abi93.node → @contrast+distringuish.abi137.node} +0 -0
  77. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi108.armv8.node +0 -0
  78. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi115.armv8.node +0 -0
  79. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi127.armv8.node +0 -0
  80. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi137.armv8.node +0 -0
  81. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.glibc.node +0 -0
  82. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi108.musl.node +0 -0
  83. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.glibc.node +0 -0
  84. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi115.musl.node +0 -0
  85. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.glibc.node +0 -0
  86. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi127.musl.node +0 -0
  87. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.glibc.node +0 -0
  88. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi137.musl.node +0 -0
  89. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi108.node +0 -0
  90. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi115.node +0 -0
  91. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi127.node +0 -0
  92. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi137.node +0 -0
  93. package/node_modules/@contrast/esm-hooks/lib/debug-methods.mjs +4 -4
  94. package/node_modules/@contrast/esm-hooks/lib/get-file-type.mjs +2 -9
  95. package/node_modules/@contrast/esm-hooks/lib/hooks.mjs +0 -2
  96. package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs/promises.mjs +2 -0
  97. package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/fs.mjs +3 -0
  98. package/node_modules/@contrast/esm-hooks/lib/redirects/builtin/util.mjs +1 -0
  99. package/node_modules/@contrast/esm-hooks/package.json +7 -7
  100. package/node_modules/@contrast/fn-inspect/package.json +9 -5
  101. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi108.node +0 -0
  102. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi115.node +0 -0
  103. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/@contrast+fn-inspect.abi127.node +0 -0
  104. package/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/{@contrast+fn-inspect.abi93.node → @contrast+fn-inspect.abi137.node} +0 -0
  105. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi108.armv8.node +0 -0
  106. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi115.armv8.node +0 -0
  107. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi127.armv8.node +0 -0
  108. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi137.armv8.node +0 -0
  109. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.glibc.node +0 -0
  110. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi108.musl.node +0 -0
  111. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.glibc.node +0 -0
  112. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi115.musl.node +0 -0
  113. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.glibc.node +0 -0
  114. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi127.musl.node +0 -0
  115. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi137.glibc.node +0 -0
  116. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/{@contrast+fn-inspect.abi93.musl.node → @contrast+fn-inspect.abi137.musl.node} +0 -0
  117. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi108.node +0 -0
  118. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi115.node +0 -0
  119. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi127.node +0 -0
  120. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi137.node +0 -0
  121. package/node_modules/@contrast/instrumentation/lib/http2.js +0 -11
  122. package/node_modules/@contrast/instrumentation/package.json +6 -6
  123. package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +312 -224
  124. package/node_modules/@contrast/library-analysis/package.json +6 -6
  125. package/node_modules/@contrast/logger/lib/index.js +18 -8
  126. package/node_modules/@contrast/logger/lib/serializers.js +5 -5
  127. package/node_modules/@contrast/logger/lib/utils.d.ts +0 -6
  128. package/node_modules/@contrast/logger/package.json +4 -4
  129. package/node_modules/@contrast/metrics/lib/index.d.ts +6 -6
  130. package/node_modules/@contrast/metrics/lib/index.js +0 -1
  131. package/node_modules/@contrast/metrics/package.json +7 -7
  132. package/node_modules/@contrast/patcher/package.json +3 -3
  133. package/node_modules/@contrast/perf/package.json +7 -4
  134. package/node_modules/@contrast/protect/lib/hardening/handlers.js +37 -21
  135. package/node_modules/@contrast/protect/lib/index.d.ts +3 -2
  136. package/node_modules/@contrast/protect/lib/index.js +9 -2
  137. package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +269 -238
  138. package/node_modules/@contrast/protect/lib/input-analysis/install/http.js +3 -4
  139. package/node_modules/@contrast/protect/lib/input-tracing/{handlers/index.js → handlers.js} +15 -15
  140. package/node_modules/@contrast/protect/lib/input-tracing/index.js +0 -1
  141. package/node_modules/@contrast/protect/lib/make-source-context.js +5 -7
  142. package/node_modules/@contrast/protect/lib/policy.js +130 -95
  143. package/node_modules/@contrast/protect/lib/semantic-analysis/handlers.js +19 -18
  144. package/node_modules/@contrast/protect/package.json +12 -12
  145. package/node_modules/@contrast/reporter/lib/index.js +1 -1
  146. package/node_modules/@contrast/reporter/lib/reporters/base.d.ts +0 -1
  147. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.d.ts +4 -2
  148. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/index.js +14 -14
  149. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.d.ts +43 -6
  150. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +262 -429
  151. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/server-inventory.d.ts +3 -3
  152. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +17 -7
  153. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +12 -13
  154. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/utils.js +6 -7
  155. package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
  156. package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.d.ts +2 -3
  157. package/node_modules/@contrast/reporter/lib/reporters/security-logger/index.js +72 -86
  158. package/node_modules/@contrast/reporter/lib/reporters/security-logger/messages.js +6 -7
  159. package/node_modules/@contrast/reporter/lib/validators.js +0 -1
  160. package/node_modules/@contrast/reporter/node_modules/sonic-boom/.husky/pre-commit +2 -2
  161. package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc +5 -0
  162. package/node_modules/@contrast/reporter/node_modules/sonic-boom/README.md +2 -4
  163. package/node_modules/@contrast/reporter/node_modules/sonic-boom/bench.js +5 -36
  164. package/node_modules/@contrast/reporter/node_modules/sonic-boom/index.js +56 -300
  165. package/node_modules/@contrast/reporter/node_modules/sonic-boom/package.json +12 -7
  166. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test.js +1684 -0
  167. package/node_modules/@contrast/reporter/node_modules/sonic-boom/types/index.d.ts +1 -2
  168. package/node_modules/@contrast/reporter/package.json +10 -10
  169. package/node_modules/@contrast/rewriter/lib/index.js +5 -43
  170. package/node_modules/@contrast/rewriter/package.json +8 -8
  171. package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +0 -5
  172. package/node_modules/@contrast/route-coverage/lib/install/restify.js +1 -1
  173. package/node_modules/@contrast/route-coverage/package.json +10 -10
  174. package/node_modules/@contrast/scopes/package.json +6 -6
  175. package/node_modules/@contrast/sec-obs/lib/traces/http.js +1 -1
  176. package/node_modules/@contrast/sec-obs/lib/traces/http.test.js +1 -1
  177. package/node_modules/@contrast/sec-obs/package.json +10 -10
  178. package/node_modules/@contrast/sources/lib/index.js +1 -1
  179. package/node_modules/@contrast/sources/lib/index.test.js +0 -26
  180. package/node_modules/@contrast/sources/package.json +3 -3
  181. package/node_modules/@contrast/telemetry/package.json +6 -6
  182. package/node_modules/@opentelemetry/semantic-conventions/README.md +3 -2
  183. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +4350 -2882
  184. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +4350 -2882
  185. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js.map +1 -1
  186. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +136 -0
  187. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js +154 -0
  188. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.js.map +1 -0
  189. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +713 -141
  190. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js +713 -141
  191. package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.js.map +1 -1
  192. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +2 -0
  193. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +2 -0
  194. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js.map +1 -1
  195. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +1 -0
  196. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +1 -0
  197. package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js.map +1 -1
  198. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +7 -1
  199. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js +7 -1
  200. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js.map +1 -1
  201. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +5 -0
  202. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +23 -0
  203. package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js.map +1 -0
  204. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +1 -1
  205. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +1 -1
  206. package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js.map +1 -1
  207. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +4350 -2882
  208. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js +4350 -2882
  209. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.js.map +1 -1
  210. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +136 -0
  211. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js +154 -0
  212. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.js.map +1 -0
  213. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +713 -141
  214. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js +713 -141
  215. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.js.map +1 -1
  216. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +2 -0
  217. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +2 -0
  218. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js.map +1 -1
  219. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +1 -0
  220. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +1 -0
  221. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js.map +1 -1
  222. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +7 -1
  223. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js +7 -1
  224. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js.map +1 -1
  225. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +5 -0
  226. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +23 -0
  227. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js.map +1 -0
  228. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +1 -1
  229. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +1 -1
  230. package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js.map +1 -1
  231. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +4350 -2882
  232. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js +4354 -2883
  233. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.js.map +1 -1
  234. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +136 -0
  235. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +157 -0
  236. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js.map +1 -0
  237. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +713 -141
  238. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +720 -147
  239. package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js.map +1 -1
  240. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +2 -0
  241. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +2 -0
  242. package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js.map +1 -1
  243. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +1 -0
  244. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +1 -0
  245. package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js.map +1 -1
  246. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +7 -1
  247. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +10 -4
  248. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js.map +1 -1
  249. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +5 -0
  250. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +26 -0
  251. package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js.map +1 -0
  252. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +1 -1
  253. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +1 -1
  254. package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js.map +1 -1
  255. package/node_modules/@opentelemetry/semantic-conventions/package.json +6 -7
  256. package/node_modules/@swc/core/README.md +5 -0
  257. package/node_modules/@swc/core/binding.d.ts +2 -2
  258. package/node_modules/@swc/core/index.d.ts +5 -4
  259. package/node_modules/@swc/core/index.js +2 -2
  260. package/node_modules/@swc/core/package.json +12 -12
  261. package/node_modules/@swc/core-darwin-arm64/package.json +1 -1
  262. package/node_modules/@swc/core-darwin-arm64/swc.darwin-arm64.node +0 -0
  263. package/node_modules/@swc/core-darwin-x64/package.json +1 -1
  264. package/node_modules/@swc/core-darwin-x64/swc.darwin-x64.node +0 -0
  265. package/node_modules/@swc/core-linux-arm64-gnu/package.json +1 -1
  266. package/node_modules/@swc/core-linux-arm64-gnu/swc.linux-arm64-gnu.node +0 -0
  267. package/node_modules/@swc/core-linux-arm64-musl/package.json +1 -1
  268. package/node_modules/@swc/core-linux-arm64-musl/swc.linux-arm64-musl.node +0 -0
  269. package/node_modules/@swc/core-linux-x64-gnu/package.json +1 -1
  270. package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
  271. package/node_modules/@swc/core-linux-x64-musl/package.json +1 -1
  272. package/node_modules/@swc/core-linux-x64-musl/swc.linux-x64-musl.node +0 -0
  273. package/node_modules/@swc/core-win32-arm64-msvc/package.json +1 -1
  274. package/node_modules/@swc/core-win32-arm64-msvc/swc.win32-arm64-msvc.node +0 -0
  275. package/node_modules/@swc/core-win32-x64-msvc/package.json +1 -1
  276. package/node_modules/@swc/core-win32-x64-msvc/swc.win32-x64-msvc.node +0 -0
  277. package/node_modules/@swc/types/index.d.ts +14 -5
  278. package/node_modules/@swc/types/package.json +2 -2
  279. package/node_modules/@types/node/README.md +1 -1
  280. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  281. package/node_modules/@types/node/assert.d.ts +119 -95
  282. package/node_modules/@types/node/buffer.d.ts +1 -1
  283. package/node_modules/@types/node/child_process.d.ts +26 -122
  284. package/node_modules/@types/node/crypto.d.ts +161 -17
  285. package/node_modules/@types/node/dns.d.ts +5 -0
  286. package/node_modules/@types/node/events.d.ts +79 -33
  287. package/node_modules/@types/node/fs/promises.d.ts +41 -26
  288. package/node_modules/@types/node/fs.d.ts +276 -35
  289. package/node_modules/@types/node/globals.d.ts +148 -347
  290. package/node_modules/@types/node/http.d.ts +57 -8
  291. package/node_modules/@types/node/https.d.ts +5 -0
  292. package/node_modules/@types/node/index.d.ts +7 -2
  293. package/node_modules/@types/node/inspector.d.ts +187 -4089
  294. package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
  295. package/node_modules/@types/node/module.d.ts +1 -0
  296. package/node_modules/@types/node/net.d.ts +21 -0
  297. package/node_modules/@types/node/package.json +3 -3
  298. package/node_modules/@types/node/sqlite.d.ts +34 -0
  299. package/node_modules/@types/node/test.d.ts +106 -23
  300. package/node_modules/@types/node/tls.d.ts +32 -0
  301. package/node_modules/@types/node/ts5.6/index.d.ts +7 -2
  302. package/node_modules/@types/node/ts5.7/index.d.ts +7 -2
  303. package/node_modules/@types/node/url.d.ts +25 -6
  304. package/node_modules/@types/node/util.d.ts +11 -4
  305. package/node_modules/@types/node/vm.d.ts +73 -10
  306. package/node_modules/@types/node/wasi.d.ts +21 -0
  307. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  308. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  309. package/node_modules/@types/node/{dom-events.d.ts → web-globals/events.d.ts} +49 -51
  310. package/node_modules/@types/node/web-globals/fetch.d.ts +50 -0
  311. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  312. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  313. package/node_modules/@types/node/worker_threads.d.ts +84 -50
  314. package/node_modules/@types/node/zlib.d.ts +6 -0
  315. package/node_modules/axios/CHANGELOG.md +58 -0
  316. package/node_modules/axios/README.md +87 -10
  317. package/node_modules/axios/dist/axios.js +355 -289
  318. package/node_modules/axios/dist/axios.js.map +1 -1
  319. package/node_modules/axios/dist/axios.min.js +2 -2
  320. package/node_modules/axios/dist/axios.min.js.map +1 -1
  321. package/node_modules/axios/dist/browser/axios.cjs +286 -213
  322. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  323. package/node_modules/axios/dist/esm/axios.js +286 -213
  324. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  325. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  326. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  327. package/node_modules/axios/dist/node/axios.cjs +377 -213
  328. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  329. package/node_modules/axios/index.d.cts +12 -5
  330. package/node_modules/axios/index.d.ts +13 -4
  331. package/node_modules/axios/lib/adapters/adapters.js +6 -4
  332. package/node_modules/axios/lib/adapters/fetch.js +221 -162
  333. package/node_modules/axios/lib/adapters/http.js +18 -0
  334. package/node_modules/axios/lib/adapters/xhr.js +11 -8
  335. package/node_modules/axios/lib/core/Axios.js +0 -2
  336. package/node_modules/axios/lib/core/AxiosError.js +10 -3
  337. package/node_modules/axios/lib/core/dispatchRequest.js +1 -1
  338. package/node_modules/axios/lib/defaults/index.js +1 -1
  339. package/node_modules/axios/lib/env/data.js +1 -1
  340. package/node_modules/axios/lib/helpers/buildURL.js +1 -3
  341. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +73 -0
  342. package/node_modules/axios/lib/helpers/resolveConfig.js +13 -9
  343. package/node_modules/axios/lib/utils.js +5 -3
  344. package/node_modules/axios/package.json +18 -12
  345. package/node_modules/balanced-match/.github/FUNDING.yml +2 -0
  346. package/node_modules/balanced-match/LICENSE.md +21 -0
  347. package/node_modules/balanced-match/README.md +97 -0
  348. package/node_modules/balanced-match/index.js +62 -0
  349. package/node_modules/balanced-match/package.json +48 -0
  350. package/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
  351. package/node_modules/brace-expansion/LICENSE +21 -0
  352. package/node_modules/brace-expansion/README.md +135 -0
  353. package/node_modules/brace-expansion/index.js +203 -0
  354. package/node_modules/brace-expansion/package.json +49 -0
  355. package/node_modules/detect-libc/lib/detect-libc.js +59 -13
  356. package/node_modules/detect-libc/lib/elf.js +39 -0
  357. package/node_modules/detect-libc/lib/filesystem.js +18 -8
  358. package/node_modules/detect-libc/package.json +3 -2
  359. package/node_modules/minimatch/LICENSE +15 -0
  360. package/node_modules/minimatch/README.md +454 -0
  361. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  362. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  363. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  364. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  365. package/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
  366. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  367. package/node_modules/minimatch/dist/commonjs/ast.js +592 -0
  368. package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  369. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  370. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  371. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  372. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  373. package/node_modules/minimatch/dist/commonjs/escape.d.ts +12 -0
  374. package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  375. package/node_modules/minimatch/dist/commonjs/escape.js +22 -0
  376. package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  377. package/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
  378. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  379. package/node_modules/minimatch/dist/commonjs/index.js +1017 -0
  380. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  381. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  382. package/node_modules/minimatch/dist/commonjs/unescape.d.ts +17 -0
  383. package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  384. package/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
  385. package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  386. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  387. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  388. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  389. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  390. package/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
  391. package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  392. package/node_modules/minimatch/dist/esm/ast.js +588 -0
  393. package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  394. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  395. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  396. package/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
  397. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  398. package/node_modules/minimatch/dist/esm/escape.d.ts +12 -0
  399. package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  400. package/node_modules/minimatch/dist/esm/escape.js +18 -0
  401. package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  402. package/node_modules/minimatch/dist/esm/index.d.ts +94 -0
  403. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  404. package/node_modules/minimatch/dist/esm/index.js +1001 -0
  405. package/node_modules/minimatch/dist/esm/index.js.map +1 -0
  406. package/node_modules/minimatch/dist/esm/package.json +3 -0
  407. package/node_modules/minimatch/dist/esm/unescape.d.ts +17 -0
  408. package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  409. package/node_modules/minimatch/dist/esm/unescape.js +20 -0
  410. package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  411. package/node_modules/minimatch/package.json +82 -0
  412. package/node_modules/node-abi/LICENSE +21 -0
  413. package/node_modules/node-abi/README.md +54 -0
  414. package/node_modules/node-abi/abi_registry.json +408 -0
  415. package/node_modules/node-abi/getNextTarget.js +13 -0
  416. package/node_modules/node-abi/index.js +161 -0
  417. package/node_modules/node-abi/package.json +46 -0
  418. package/node_modules/node-addon-api/README.md +25 -249
  419. package/node_modules/node-addon-api/common.gypi +1 -0
  420. package/node_modules/node-addon-api/index.js +2 -0
  421. package/node_modules/node-addon-api/napi-inl.h +592 -166
  422. package/node_modules/node-addon-api/napi.h +167 -59
  423. package/node_modules/node-addon-api/node_addon_api.gyp +10 -0
  424. package/node_modules/node-addon-api/noexcept.gypi +1 -1
  425. package/node_modules/node-addon-api/package.json +13 -13
  426. package/node_modules/node-addon-api/tools/conversion.js +1 -1
  427. package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
  428. package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
  429. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  430. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  431. package/node_modules/protobufjs/dist/protobuf.js +2 -2
  432. package/node_modules/protobufjs/dist/protobuf.min.js +2 -2
  433. package/node_modules/protobufjs/google/protobuf/descriptor.json +2 -2
  434. package/node_modules/protobufjs/google/protobuf/descriptor.proto +2 -1
  435. package/node_modules/protobufjs/package.json +1 -1
  436. package/node_modules/undici-types/agent.d.ts +0 -4
  437. package/node_modules/undici-types/client.d.ts +0 -2
  438. package/node_modules/undici-types/diagnostics-channel.d.ts +9 -0
  439. package/node_modules/undici-types/dispatcher.d.ts +3 -8
  440. package/node_modules/undici-types/env-http-proxy-agent.d.ts +2 -1
  441. package/node_modules/undici-types/eventsource.d.ts +3 -3
  442. package/node_modules/undici-types/fetch.d.ts +1 -0
  443. package/node_modules/undici-types/h2c-client.d.ts +0 -2
  444. package/node_modules/undici-types/handlers.d.ts +1 -1
  445. package/node_modules/undici-types/index.d.ts +3 -1
  446. package/node_modules/undici-types/mock-client.d.ts +2 -0
  447. package/node_modules/undici-types/mock-interceptor.d.ts +2 -1
  448. package/node_modules/undici-types/mock-pool.d.ts +2 -0
  449. package/node_modules/undici-types/package.json +1 -1
  450. package/node_modules/undici-types/retry-handler.d.ts +9 -0
  451. package/node_modules/undici-types/snapshot-agent.d.ts +107 -0
  452. package/node_modules/undici-types/webidl.d.ts +29 -15
  453. package/node_modules/undici-types/websocket.d.ts +3 -1
  454. package/package.json +3 -3
  455. package/node_modules/@contrast/assess/lib/get-policy.js +0 -336
  456. package/node_modules/@contrast/code-events/prebuilds/linux-arm64/@contrast+code-events.abi93.armv8.node +0 -0
  457. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.glibc.node +0 -0
  458. package/node_modules/@contrast/code-events/prebuilds/linux-x64/@contrast+code-events.abi93.musl.node +0 -0
  459. package/node_modules/@contrast/code-events/prebuilds/win32-x64/@contrast+code-events.abi93.node +0 -0
  460. package/node_modules/@contrast/core/lib/sensitive-data-masking/protect-listener.js +0 -111
  461. package/node_modules/@contrast/distringuish/prebuilds/linux-arm64/@contrast+distringuish.abi93.armv8.node +0 -0
  462. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.glibc.node +0 -0
  463. package/node_modules/@contrast/distringuish/prebuilds/linux-x64/@contrast+distringuish.abi93.musl.node +0 -0
  464. package/node_modules/@contrast/distringuish/prebuilds/win32-x64/@contrast+distringuish.abi93.node +0 -0
  465. package/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/@contrast+fn-inspect.abi93.armv8.node +0 -0
  466. package/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/@contrast+fn-inspect.abi93.glibc.node +0 -0
  467. package/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/@contrast+fn-inspect.abi93.node +0 -0
  468. package/node_modules/@contrast/perf/lib/index.test.js +0 -547
  469. package/node_modules/@contrast/perf/lib/tsconfig.json +0 -31
  470. package/node_modules/@contrast/protect/lib/input-tracing/install/spdy.js +0 -63
  471. package/node_modules/@contrast/reporter/node_modules/sonic-boom/.taprc.yaml +0 -11
  472. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/destroy.test.js +0 -49
  473. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/end.test.js +0 -98
  474. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush-sync.test.js +0 -140
  475. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/flush.test.js +0 -419
  476. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/fsync.test.js +0 -63
  477. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/helper.js +0 -42
  478. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/minlength.test.js +0 -35
  479. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/mode.test.js +0 -116
  480. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/reopen.test.js +0 -239
  481. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/retry.test.js +0 -414
  482. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/sync.test.js +0 -261
  483. package/node_modules/@contrast/reporter/node_modules/sonic-boom/test/write.test.js +0 -465
  484. package/node_modules/node-addon-api/tools/eslint-format.js +0 -79
@@ -32,6 +32,7 @@ const {
32
32
  }
33
33
  } = require('@contrast/common');
34
34
  const { Core } = require('@contrast/core/lib/ioc/core');
35
+
35
36
  //
36
37
  // these rules are not implemented by agent-lib, but are being considered for
37
38
  // implementation:
@@ -100,6 +101,7 @@ module.exports = Core.makeComponent({
100
101
  factory(core) {
101
102
  const {
102
103
  logger,
104
+ protect,
103
105
  protect: {
104
106
  agentLib,
105
107
  inputAnalysis,
@@ -132,6 +134,124 @@ module.exports = Core.makeComponent({
132
134
  // inputs against rules 1) is very fast and 2) dramatically pares down the number
133
135
  // of exclusion checks that need to be made.
134
136
 
137
+ /**
138
+ * merge new findings into the existing findings
139
+ *
140
+ * @param {Object} sourceContext sourceContext.findings is the existing findings
141
+ * @param {Object} newFindings the findings, in {trackRequest, resultsList} format.
142
+ * @returns {undefined|[String]} undefined to permit else [mode, rule] to block.
143
+ */
144
+ function mergeFindings(sourceContext, newFindings) {
145
+ const { policy } = sourceContext;
146
+ const { securityException, resultsMap } = sourceContext;
147
+
148
+ if (!newFindings.trackRequest) {
149
+ return securityException;
150
+ }
151
+
152
+ newFindings.resultsList = newFindings.resultsList.filter(
153
+ (result) => !inputAnalysis.isResultExcluded(sourceContext, result)
154
+ );
155
+
156
+ normalizeFindings(policy, newFindings);
157
+
158
+ sourceContext.trackRequest = sourceContext.trackRequest || newFindings.trackRequest;
159
+ sourceContext.securityException = sourceContext.securityException || newFindings.securityException;
160
+
161
+ // merge them into a ruleId-indexed map (pojo)
162
+ for (const result of newFindings.resultsList) {
163
+ if (!resultsMap[result.ruleId]) {
164
+ resultsMap[result.ruleId] = [];
165
+ }
166
+ resultsMap[result.ruleId].push(result);
167
+ }
168
+
169
+ return sourceContext.securityException;
170
+ }
171
+
172
+ //
173
+ // add common fields to findings.
174
+ //
175
+ function normalizeFindings(policy, findings) {
176
+ // now both augment the rules and check to see if any require blocking
177
+ // at perimeter.
178
+ for (const r of findings.resultsList) {
179
+ // augment
180
+ // what additional augmentations are needed?
181
+ // the name/id might need to be mapped but keep the original so it's not lost
182
+ r.mappedId = agentLibRuleTypeToName[r.ruleId] || r.ruleId;
183
+
184
+ // if we block this or the value is found in sink, we'll know not to check
185
+ // this result for probe analysis in handleRequestEnd().
186
+ r.blocked = false;
187
+ r.exploited = false;
188
+
189
+ // apply exclusions here.
190
+ //
191
+ // apply exclusions after scoring inputs as it will require less work
192
+ // most of the time.
193
+ //
194
+ // the following might need to be changed. BAP is legacy behavior; beyond that,
195
+ // the only way a score >= 90 can come back is if there is no "worth-watching"
196
+ // option and that implies that there is no sink, so this is the only place at
197
+ // which the block can occur. so at a minimum 'block' should also result in a
198
+ // block.
199
+ const mode = policy.getRuleMode(r.ruleId);
200
+
201
+ if (r.score >= 90 && BLOCKING_MODES.includes(mode)) {
202
+ r.blocked = true;
203
+ findings.securityException = [mode, r.ruleId, { result: r }];
204
+ }
205
+ }
206
+ }
207
+
208
+ function checkIpsMatch(listEntry, ip) {
209
+ const parsed = address.process(ip);
210
+
211
+ // Check if IP is in CIDR range,
212
+ if (listEntry.cidr) {
213
+ if (parsed.kind() !== listEntry.cidr.kind) {
214
+ return null;
215
+ }
216
+
217
+ if (parsed.match(listEntry.cidr.range)) {
218
+ return { ...listEntry, match: ip };
219
+ } else {
220
+ return null;
221
+ }
222
+ }
223
+
224
+ // or do a direct comparison
225
+ if (parsed.toNormalizedString() === listEntry.normalizedValue) {
226
+ return { ...listEntry, matchedIp: ip };
227
+ }
228
+
229
+ return null;
230
+ }
231
+
232
+ /**
233
+ * getValueAtKey() is used to fetch the object (expected) associated
234
+ * with the path of keys in obj. i say expected because this is only used
235
+ * for fetching the objects associated with a nosql vulnerability and those
236
+ * should always be objects.
237
+ *
238
+ * @param {Object} obj an object with keys
239
+ * @param {Array} path list of keys to walk through the object
240
+ * @param {String} lastKey the last key (it's not in path)
241
+ *
242
+ * @returns the value at end of walking path in obj
243
+ */
244
+ function getValueAtKey(obj, path, key) {
245
+ for (const p of path) {
246
+ /* c8 ignore next 6 */
247
+ if (!(p in obj)) {
248
+ return undefined;
249
+ }
250
+ obj = obj[p];
251
+ }
252
+ return key in obj ? obj[key] : undefined;
253
+ }
254
+
135
255
  /**
136
256
  * handleConnect()
137
257
  *
@@ -169,7 +289,7 @@ module.exports = Core.makeComponent({
169
289
  * @returns {undefined|[String]} undefined to permit else [mode, rule] to block.
170
290
  */
171
291
  inputAnalysis.handleConnect = function handleConnect(sourceContext, connectInputs) {
172
- const { policy: { rulesMask } } = sourceContext;
292
+ const rulesMask = sourceContext.policy.getRulesMask();
173
293
 
174
294
  inputAnalysis.handleVirtualPatches(
175
295
  sourceContext,
@@ -183,6 +303,10 @@ module.exports = Core.makeComponent({
183
303
  block = inputAnalysis.handleMethodTampering(sourceContext, connectInputs);
184
304
  }
185
305
 
306
+ if (block) {
307
+ core.protect.reportFinding(block[2]);
308
+ }
309
+
186
310
  return block;
187
311
  };
188
312
 
@@ -205,17 +329,15 @@ module.exports = Core.makeComponent({
205
329
  inputAnalysis.handleQueryParams = function handleQueryParams(sourceContext, queryParams) {
206
330
  if (sourceContext.analyzedQuery) return;
207
331
  sourceContext.analyzedQuery = true;
208
-
209
332
  if (typeof queryParams !== 'object') {
210
333
  logger.debug({ queryParams }, 'handleQueryParams() called with non-object');
211
334
  return;
212
335
  }
213
-
214
336
  inputAnalysis.handleVirtualPatches(sourceContext, { PARAMETERS: queryParams });
215
337
 
216
338
  const block = commonObjectAnalyzer(sourceContext, queryParams, parameterInputTypes);
217
-
218
339
  if (block) {
340
+ core.protect.reportFinding(block[2]);
219
341
  core.protect.throwSecurityException(sourceContext);
220
342
  }
221
343
  };
@@ -230,6 +352,9 @@ module.exports = Core.makeComponent({
230
352
  * @param {Object} urlParams pojo
231
353
  */
232
354
  inputAnalysis.handleUrlParams = function(sourceContext, urlParams) {
355
+ const rulesMask = sourceContext.policy.getRulesMask();
356
+ if (!rulesMask) return;
357
+
233
358
  if (sourceContext.analyzedUrlParams) return;
234
359
  sourceContext.analyzedUrlParams = true;
235
360
 
@@ -240,7 +365,6 @@ module.exports = Core.makeComponent({
240
365
 
241
366
  inputAnalysis.handleVirtualPatches(sourceContext, { PARAMETERS: urlParams });
242
367
 
243
- const { policy: { rulesMask } } = sourceContext;
244
368
  const resultsList = [];
245
369
  const { UrlParameter } = agentLib.InputType;
246
370
 
@@ -251,7 +375,6 @@ module.exports = Core.makeComponent({
251
375
  }
252
376
 
253
377
  const items = agentLib.scoreAtom(rulesMask, value, UrlParameter, preferWW);
254
-
255
378
  if (!items) {
256
379
  return;
257
380
  }
@@ -284,6 +407,9 @@ module.exports = Core.makeComponent({
284
407
  const block = mergeFindings(sourceContext, urlParamsFindings);
285
408
 
286
409
  if (block) {
410
+ if (block[2]) {
411
+ core.protect.reportFinding(block[2]);
412
+ }
287
413
  core.protect.throwSecurityException(sourceContext);
288
414
  }
289
415
  };
@@ -302,7 +428,8 @@ module.exports = Core.makeComponent({
302
428
 
303
429
  inputAnalysis.handleVirtualPatches(sourceContext, { HEADERS: cookies });
304
430
 
305
- const { policy: { rulesMask } } = sourceContext;
431
+ const rulesMask = sourceContext.policy.getRulesMask();
432
+ if (!rulesMask) return;
306
433
 
307
434
  const cookiesArr = Object.entries(cookies).reduce((acc, [key, value]) => {
308
435
  // things like booleans will cause agent-lib to throw
@@ -315,6 +442,7 @@ module.exports = Core.makeComponent({
315
442
  const block = mergeFindings(sourceContext, cookieFindings);
316
443
 
317
444
  if (block) {
445
+ protect.reportFinding(block[2]);
318
446
  core.protect.throwSecurityException(sourceContext);
319
447
  }
320
448
  };
@@ -356,6 +484,7 @@ module.exports = Core.makeComponent({
356
484
  sourceContext.bodyType = bodyType;
357
485
 
358
486
  if (block) {
487
+ protect.reportFinding(block[2]);
359
488
  core.protect.throwSecurityException(sourceContext);
360
489
  }
361
490
  };
@@ -367,7 +496,7 @@ module.exports = Core.makeComponent({
367
496
  const { policy } = sourceContext;
368
497
  const resultsList = [];
369
498
 
370
- if (policy[Rule.UNSAFE_FILE_UPLOAD] === 'off') return;
499
+ if (policy.getRuleMode(Rule.UNSAFE_FILE_UPLOAD) === 'off') return;
371
500
 
372
501
  for (const name of names) {
373
502
  if (!isString(name)) {
@@ -375,7 +504,7 @@ module.exports = Core.makeComponent({
375
504
  return;
376
505
  }
377
506
 
378
- const items = agentLib.scoreAtom(policy.rulesMask, name, type);
507
+ const items = agentLib.scoreAtom(policy.getRulesMask(), name, type);
379
508
 
380
509
  if (!items) {
381
510
  return;
@@ -402,6 +531,7 @@ module.exports = Core.makeComponent({
402
531
  const block = mergeFindings(sourceContext, unsafeFilenameFindings);
403
532
 
404
533
  if (block) {
534
+ core.protect.reportFinding(block[2]);
405
535
  core.protect.throwSecurityException(sourceContext);
406
536
  }
407
537
  };
@@ -411,6 +541,7 @@ module.exports = Core.makeComponent({
411
541
 
412
542
  if (!Object.keys(requestInput).filter(Boolean).length || !sourceContext?.virtualPatchesEvaluators.length) return;
413
543
 
544
+ // todo: get virtualPatchesEvaluators from protect policy instead of request
414
545
  for (const vpEvaluators of sourceContext.virtualPatchesEvaluators) {
415
546
  for (const key in requestInput) {
416
547
  const evaluator = vpEvaluators.get(key);
@@ -423,10 +554,17 @@ module.exports = Core.makeComponent({
423
554
  if (!sourceContext.resultsMap[ruleId]) {
424
555
  sourceContext.resultsMap[ruleId] = [];
425
556
  }
426
- sourceContext.resultsMap[ruleId].push({
427
- name,
428
- uuid
429
- });
557
+
558
+ const result = {
559
+ key: name,
560
+ inputType: 'UNKNOWN',
561
+ ruleId: Rule.VIRTUAL_PATCH,
562
+ value: 'Virtual Patch',
563
+ blocked: true,
564
+ };
565
+ const eventArg = { result, findings: { uuid } };
566
+
567
+ protect.reportFinding(eventArg);
430
568
  sourceContext.securityException = ['block', ruleId];
431
569
  core.protect.throwSecurityException(sourceContext);
432
570
  }
@@ -453,7 +591,7 @@ module.exports = Core.makeComponent({
453
591
  if (!sourceContext || !ipDenylist.length) return;
454
592
 
455
593
  const { sourceInfo } = core.scopes.sources.getStore();
456
- const match = ipListAnalysis(sourceInfo.Ip, sourceInfo.rawHeaders, ipDenylist);
594
+ const match = ipListAnalysis(sourceInfo.ip, sourceInfo.rawHeaders, ipDenylist);
457
595
 
458
596
  if (match) {
459
597
  logger.info(match, 'Found a matching IP to an entry in ipDeny list');
@@ -461,17 +599,28 @@ module.exports = Core.makeComponent({
461
599
  sourceContext.resultsMap[ruleId] = [];
462
600
  }
463
601
 
464
- sourceContext.resultsMap[ruleId].push({
465
- ip: match.matchedIp,
466
- uuid: match.uuid,
467
- });
602
+ const eventArg = {
603
+ result: {
604
+ key: 'IP Address',
605
+ inputType: 'UNKNOWN',
606
+ ruleId: Rule.IP_DENYLIST,
607
+ value: sourceInfo.ip,
608
+ blocked: true,
609
+ },
610
+ findings: {
611
+ uuid: match.uuid,
612
+ ip: match.matchedIp,
613
+ },
614
+ };
615
+ protect.reportFinding(eventArg);
616
+
468
617
  return ['block', 'ip-denylist'];
469
618
  }
470
619
  };
471
620
 
472
621
  inputAnalysis.handleMethodTampering = function(sourceContext, connectInputs) {
473
622
  const ruleId = Rule.METHOD_TAMPERING;
474
- const mode = sourceContext.policy[ruleId];
623
+ const mode = sourceContext.policy.getRuleMode(ruleId);
475
624
  if (mode !== OFF) {
476
625
  const { method } = connectInputs;
477
626
 
@@ -481,14 +630,14 @@ module.exports = Core.makeComponent({
481
630
  key: 'method',
482
631
  value: method,
483
632
  blocked: false,
484
- exploitMetadata: null,
485
633
  };
486
634
 
487
635
  sourceContext.resultsMap[ruleId] = [result];
488
636
 
489
637
  if (BLOCKING_MODES.includes(mode)) {
638
+ result.exploited = true;
490
639
  result.blocked = true;
491
- return sourceContext.securityException = ['block', ruleId];
640
+ return sourceContext.securityException = ['block', ruleId, { result }];
492
641
  }
493
642
  }
494
643
  }
@@ -502,24 +651,23 @@ module.exports = Core.makeComponent({
502
651
  * @param {Object} sourceContext
503
652
  */
504
653
  inputAnalysis.handleRequestEnd = function handleRequestEnd(sourceContext) {
505
- {
506
- // check status code to verify method-tampering exploitation
507
- const mtResult = sourceContext.resultsMap[Rule.METHOD_TAMPERING]?.[0];
508
- if (mtResult) {
509
- const { statusCode } = sourceContext.resData;
510
- if (statusCode !== 405 || statusCode !== 501) {
511
- mtResult.exploitMetadata = [{ statusCode }];
512
- }
654
+ const { policy } = sourceContext;
655
+ // check status code to verify method-tampering exploitation
656
+ const mtResult = sourceContext.resultsMap[Rule.METHOD_TAMPERING]?.[0];
657
+ if (mtResult && policy.getRuleMode(Rule.METHOD_TAMPERING) !== OFF) {
658
+ const { statusCode } = sourceContext.resData;
659
+ if (statusCode !== 405 || statusCode !== 501) {
660
+ mtResult.exploited = true;
661
+ protect.reportFindings({ result: mtResult, finding: { statusCode } });
513
662
  }
514
663
  }
515
664
 
516
- if (!config.protect.probe_analysis.enable) return;
517
-
518
665
  // Detecting probes
519
- const { resultsMap, policy: { rulesMask } } = sourceContext;
666
+ const rulesMask = sourceContext.policy.getRulesMask();
667
+ if (rulesMask == 0 || !config.protect.probe_analysis.enable) return;
668
+ const { resultsMap } = sourceContext;
520
669
  const probesRules = [Rule.CMD_INJECTION, Rule.PATH_TRAVERSAL, Rule.SQL_INJECTION, Rule.XXE];
521
670
  const probes = {};
522
-
523
671
  const findingsForScoreRequest = {
524
672
  HeaderValue: {},
525
673
  ParameterValue: {},
@@ -532,7 +680,7 @@ module.exports = Core.makeComponent({
532
680
  resultsByRuleId.forEach(resultByRuleId => {
533
681
  const {
534
682
  ruleId,
535
- exploitMetadata,
683
+ exploited,
536
684
  score,
537
685
  value,
538
686
  key,
@@ -540,10 +688,11 @@ module.exports = Core.makeComponent({
540
688
  } = resultByRuleId;
541
689
 
542
690
  if (
543
- !isMonitorMode(ruleId, sourceContext) ||
544
- exploitMetadata.length > 0 ||
691
+ sourceContext.policy.getRuleMode(ruleId) !== MONITOR ||
692
+ exploited === true || // todo: remove
545
693
  score >= 90 ||
546
- !probesRules.some((rule) => rule === ruleId)
694
+ !probesRules.some((rule) => rule === ruleId) ||
695
+ inputType == InputType.UNKNOWN
547
696
  ) {
548
697
  return;
549
698
  }
@@ -562,9 +711,7 @@ module.exports = Core.makeComponent({
562
711
  valueToResultByRuleId[value] = resultByRuleId;
563
712
  });
564
713
  });
565
-
566
714
  const { ParameterValue, HeaderValue, CookieValue } = findingsForScoreRequest;
567
-
568
715
  const results =
569
716
  agentLib.scoreRequestConnect(
570
717
  rulesMask,
@@ -579,20 +726,20 @@ module.exports = Core.makeComponent({
579
726
  ).resultsList || [];
580
727
 
581
728
  Object.entries(findingsForScoreAtom).forEach(([value, inputTypes]) => {
582
- Object.entries(inputTypes).forEach(([inputType, resultByRuleId]) =>
583
- (
584
- agentLib.scoreAtom(rulesMask, value, agentLib.InputType[inputType], {
585
- preferWorthWatching: false,
586
- }) || []
587
- ).forEach(result => {
729
+ Object.entries(inputTypes).forEach(([inputType, resultByRuleId]) => {
730
+ if (agentLib.InputType[inputType] == null) return;
731
+ const alibResult = agentLib.scoreAtom(rulesMask, value, agentLib.InputType[inputType], {
732
+ preferWorthWatching: false,
733
+ }) || [];
734
+ alibResult.forEach(result => {
588
735
  results.push({ value, ...result });
589
736
  valueToResultByRuleId[value] = resultByRuleId;
590
- })
591
- );
737
+ });
738
+ });
592
739
  });
593
740
 
594
741
  results
595
- .filter(({ score, ruleId }) => score >= 90 && isMonitorMode(ruleId, sourceContext))
742
+ .filter(({ score, ruleId }) => score >= 90 && sourceContext.policy.getRuleMode(ruleId) == MONITOR)
596
743
  .forEach((result) => {
597
744
  const resultByRuleId = valueToResultByRuleId[result.value];
598
745
  const probe = Object.assign({}, resultByRuleId, result, {
@@ -607,20 +754,85 @@ module.exports = Core.makeComponent({
607
754
  probes[key] = probe;
608
755
  });
609
756
 
610
- Object.values(probes).forEach(probe => {
611
- if (!resultsMap[probe.ruleId]) {
612
- resultsMap[probe.ruleId] = [];
757
+ for (const result of Object.values(probes)) {
758
+ core.protect.reportFinding({ result });
759
+ }
760
+ };
761
+
762
+ /**
763
+ * Reads the source context's policy and compares to result item to check whether to ignore it.
764
+ * @param {ProtectMessage} sourceContext
765
+ * @param {Result} result
766
+ * @returns {boolean} whether result should be excluded
767
+ */
768
+ inputAnalysis.isResultExcluded = function isResultExcluded(sourceContext, result) {
769
+ const exclusions = sourceContext.policy.getExclusionInfo();
770
+ if (!exclusions) return false;
771
+
772
+ const { ruleId, path, inputType, value } = result;
773
+ const inputName = path ? path[path.length - 1] : null;
774
+
775
+ let checkCookiesInHeader = false;
776
+ let inputExclusions;
777
+
778
+ switch (inputType) {
779
+ case 'JsonKey':
780
+ case 'JsonValue':
781
+ case 'MultipartName': {
782
+ if (
783
+ exclusions?.ignoreBody ||
784
+ exclusions?.bodyPolicy?.[ruleId] == OFF
785
+ ) return true;
786
+
787
+ return false;
788
+ }
789
+ case 'ParameterKey':
790
+ case 'ParameterValue': {
791
+ const qsExcluded = exclusions.ignoreQuerystring || exclusions.querystringPolicy?.[ruleId] === OFF;
792
+ if (qsExcluded) return true;
793
+ inputExclusions = exclusions.parameter;
794
+ break;
613
795
  }
796
+ case 'CookieValue': {
797
+ inputExclusions = exclusions.cookie;
798
+ break;
799
+ }
800
+ case 'HeaderKey':
801
+ case 'HeaderValue': {
802
+ if (path[0] && StringPrototypeToLowerCase.call(path[0]) === 'cookie') {
803
+ inputExclusions = exclusions.cookie;
804
+ checkCookiesInHeader = true;
805
+ } else {
806
+ inputExclusions = exclusions?.header;
807
+ }
808
+ break;
809
+ }
810
+ }
614
811
 
615
- resultsMap[probe.ruleId].push(probe);
616
- });
812
+ if (!inputName || !inputExclusions) return false;
813
+
814
+ for (const excl of inputExclusions) {
815
+ let nameCheck = false;
816
+ if (checkCookiesInHeader) {
817
+ nameCheck = excl.checkCookiesInHeader(value);
818
+ } else {
819
+ nameCheck = excl.matchesInputName(inputName);
820
+ }
821
+ if (!nameCheck) continue;
822
+ if (!excl.policy || excl.policy[ruleId] === OFF) {
823
+ return true;
824
+ }
825
+ }
826
+
827
+ return false;
617
828
  };
618
829
 
619
830
  /**
620
831
  * commonObjectAnalyzer() walks an object supplied by the end-user and checks
621
832
  * it for vulnerabilities.
622
833
  *
623
- * This can cause the request to be blocked, depending on the mode and findings.
834
+ *
835
+ This can cause the request to be blocked, depending on the mode and findings.
624
836
  *
625
837
  * @param {Object} sourceContext the sourceContext for the request
626
838
  * @param {Object} object the object to analyze. It could be from any input
@@ -632,14 +844,14 @@ module.exports = Core.makeComponent({
632
844
  * @returns {Array | undefined} returns an array with block info if vulnerability was found.
633
845
  */
634
846
  function commonObjectAnalyzer(sourceContext, object, inputTypes) {
635
- const { policy: { rulesMask } } = sourceContext;
636
- if (!rulesMask) return;
637
-
638
847
  // use inputTypes to set params...
639
848
  const { keyType, inputType } = inputTypes;
640
849
  const inputTypeStr = inputTypes === jsonInputTypes ? 'Json' : 'Parameter';
641
850
  const resultsList = [];
642
851
 
852
+ const rulesMask = sourceContext.policy.getRulesMask();
853
+ if (!rulesMask) return;
854
+
643
855
  // it's possible to optimize this if qs (or a similar package) is not loaded
644
856
  // or if none of the values of queryParams are objects. a quick '.includes()'
645
857
  // could be used to determine that. if none are objects then traverseKeysAndValues()
@@ -768,184 +980,3 @@ module.exports = Core.makeComponent({
768
980
  }
769
981
  },
770
982
  });
771
-
772
- /**
773
- * Reads the source context's policy and compares to result item to check whether to ignore it.
774
- * @param {ProtectMessage} sourceContext
775
- * @param {Result} result
776
- * @returns {boolean} whether result should be excluded
777
- */
778
- function isResultExcluded(sourceContext, result) {
779
- const { policy: { exclusions } } = sourceContext;
780
- const { ruleId, path, inputType, value } = result;
781
- const inputName = path ? path[path.length - 1] : null;
782
-
783
- let checkCookiesInHeader = false;
784
- let inputExclusions;
785
- switch (inputType) {
786
- case 'JsonKey':
787
- case 'JsonValue':
788
- case 'MultipartName': {
789
- return exclusions.ignoreBody || exclusions.bodyPolicy?.[ruleId] === OFF;
790
- }
791
- case 'ParameterKey':
792
- case 'ParameterValue': {
793
- const qsExcluded = exclusions.ignoreQuerystring || exclusions.querystringPolicy?.[ruleId] === OFF;
794
- if (qsExcluded) return true;
795
- inputExclusions = exclusions.parameter;
796
- break;
797
- }
798
- case 'CookieValue': {
799
- inputExclusions = exclusions.cookie;
800
- break;
801
- }
802
- case 'HeaderKey':
803
- case 'HeaderValue': {
804
- if (path[0] && StringPrototypeToLowerCase.call(path[0]) === 'cookie') {
805
- inputExclusions = exclusions.cookie;
806
- checkCookiesInHeader = true;
807
- } else {
808
- inputExclusions = exclusions.header;
809
- }
810
- break;
811
- }
812
- }
813
-
814
- if (!inputName || !inputExclusions) return false;
815
-
816
- for (const excl of inputExclusions) {
817
- let nameCheck = false;
818
- if (checkCookiesInHeader) {
819
- nameCheck = excl.checkCookiesInHeader(value);
820
- } else {
821
- nameCheck = excl.matchesInputName(inputName);
822
- }
823
- if (!nameCheck) continue;
824
- if (!excl.policy || excl.policy[ruleId] === OFF) {
825
- return true;
826
- }
827
- }
828
-
829
- return false;
830
- }
831
-
832
- /**
833
- * merge new findings into the existing findings
834
- *
835
- * @param {Object} sourceContext sourceContext.findings is the existing findings
836
- * @param {Object} newFindings the findings, in {trackRequest, resultsList} format.
837
- * @returns {undefined|[String]} undefined to permit else [mode, rule] to block.
838
- */
839
- function mergeFindings(sourceContext, newFindings) {
840
- const { policy, securityException, resultsMap } = sourceContext;
841
-
842
- if (!newFindings.trackRequest) {
843
- return securityException;
844
- }
845
-
846
- newFindings.resultsList = newFindings.resultsList.filter(
847
- (result) => !isResultExcluded(sourceContext, result)
848
- );
849
-
850
- normalizeFindings(policy, newFindings);
851
-
852
- sourceContext.trackRequest = sourceContext.trackRequest || newFindings.trackRequest;
853
- sourceContext.securityException = sourceContext.securityException || newFindings.securityException;
854
-
855
- // merge them into a ruleId-indexed map (pojo)
856
- for (const result of newFindings.resultsList) {
857
- if (!resultsMap[result.ruleId]) {
858
- resultsMap[result.ruleId] = [];
859
- }
860
- resultsMap[result.ruleId].push(result);
861
- }
862
-
863
- return sourceContext.securityException;
864
- }
865
-
866
- //
867
- // add common fields to findings.
868
- //
869
- function normalizeFindings(policy, findings) {
870
- // now both augment the rules and check to see if any require blocking
871
- // at perimeter.
872
- for (const r of findings.resultsList) {
873
- // augment
874
- // what additional augmentations are needed?
875
- // the name/id might need to be mapped but keep the original so it's not lost
876
- r.mappedId = agentLibRuleTypeToName[r.ruleId] || r.ruleId;
877
- // this finding resulted in blocking, i.e., it is not a probe.
878
- r.blocked = false;
879
-
880
- // sink analysis will add findings here
881
- r.exploitMetadata = [];
882
-
883
- // apply exclusions here.
884
- //
885
- // apply exclusions after scoring inputs as it will require less work
886
- // most of the time.
887
- //
888
- // the following might need to be changed. BAP is legacy behavior; beyond that,
889
- // the only way a score >= 90 can come back is if there is no "worth-watching"
890
- // option and that implies that there is no sink, so this is the only place at
891
- // which the block can occur. so at a minimum 'block' should also result in a
892
- // block.
893
- const mode = policy[r.ruleId];
894
- if (r.score >= 90 && BLOCKING_MODES.includes(mode)) {
895
- r.blocked = true;
896
- findings.securityException = [mode, r.ruleId];
897
- }
898
- }
899
- }
900
-
901
-
902
- function checkIpsMatch(listEntry, ip) {
903
- const parsed = address.process(ip);
904
-
905
- // Check if IP is in CIDR range,
906
- if (listEntry.cidr) {
907
- if (parsed.kind() !== listEntry.cidr.kind) {
908
- return null;
909
- }
910
-
911
- if (parsed.match(listEntry.cidr.range)) {
912
- return { ...listEntry, match: ip };
913
- } else {
914
- return null;
915
- }
916
- }
917
-
918
- // or do a direct comparison
919
- if (parsed.toNormalizedString() === listEntry.normalizedValue) {
920
- return { ...listEntry, matchedIp: ip };
921
- }
922
-
923
- return null;
924
- }
925
-
926
- /**
927
- * getValueAtKey() is used to fetch the object (expected) associated
928
- * with the path of keys in obj. i say expected because this is only used
929
- * for fetching the objects associated with a nosql vulnerability and those
930
- * should always be objects.
931
- *
932
- * @param {Object} obj an object with keys
933
- * @param {Array} path list of keys to walk through the object
934
- * @param {String} lastKey the last key (it's not in path)
935
- *
936
- * @returns the value at end of walking path in obj
937
- */
938
- function getValueAtKey(obj, path, key) {
939
- for (const p of path) {
940
- /* c8 ignore next 6 */
941
- if (!(p in obj)) {
942
- return undefined;
943
- }
944
- obj = obj[p];
945
- }
946
- return key in obj ? obj[key] : undefined;
947
- }
948
-
949
- function isMonitorMode(ruleId, sourceContext) {
950
- return sourceContext.policy[ruleId] === MONITOR;
951
- }