@oneuptime/common 12.0.24 → 12.0.26

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 (870) hide show
  1. package/Models/AnalyticsModels/Index.ts +2 -0
  2. package/Models/AnalyticsModels/Span.ts +101 -0
  3. package/Models/AnalyticsModels/ThreatIntelIndicator.ts +413 -0
  4. package/Models/DatabaseModels/AlertSeverity.ts +4 -1
  5. package/Models/DatabaseModels/CephClusterFeed.ts +625 -0
  6. package/Models/DatabaseModels/CloudResourceFeed.ts +625 -0
  7. package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +13 -0
  8. package/Models/DatabaseModels/DetectionRule.ts +9 -3
  9. package/Models/DatabaseModels/DockerHostFeed.ts +625 -0
  10. package/Models/DatabaseModels/DockerSwarmClusterFeed.ts +628 -0
  11. package/Models/DatabaseModels/GoogleSecOpsConnection.ts +9 -3
  12. package/Models/DatabaseModels/HostFeed.ts +625 -0
  13. package/Models/DatabaseModels/IncidentSeverity.ts +4 -1
  14. package/Models/DatabaseModels/Index.ts +22 -0
  15. package/Models/DatabaseModels/KubernetesClusterFeed.ts +628 -0
  16. package/Models/DatabaseModels/Monitor.ts +87 -0
  17. package/Models/DatabaseModels/NetworkDevice.ts +96 -5
  18. package/Models/DatabaseModels/NetworkDeviceAutoImportRule.ts +92 -6
  19. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +301 -31
  20. package/Models/DatabaseModels/NetworkSite.ts +120 -0
  21. package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +1 -0
  22. package/Models/DatabaseModels/PodmanHostFeed.ts +625 -0
  23. package/Models/DatabaseModels/ProxmoxClusterFeed.ts +626 -0
  24. package/Models/DatabaseModels/ScheduledMaintenance.ts +67 -0
  25. package/Models/DatabaseModels/ServiceFeed.ts +625 -0
  26. package/Models/DatabaseModels/TelemetrySourceMap.ts +474 -0
  27. package/Models/DatabaseModels/ThreatIntelFeed.ts +758 -0
  28. package/Models/DatabaseModels/UserOnCallLog.ts +1 -0
  29. package/Models/DatabaseModels/UserTotpAuth.ts +1 -0
  30. package/Models/DatabaseModels/UserWebAuthn.ts +1 -0
  31. package/Server/API/AlertAPI.ts +23 -1
  32. package/Server/API/BaseAPI.ts +14 -27
  33. package/Server/API/IncidentAPI.ts +41 -1
  34. package/Server/API/IncidentEpisodeAPI.ts +23 -1
  35. package/Server/API/MicrosoftTeamsAPI.ts +31 -2
  36. package/Server/API/ScheduledMaintenanceAPI.ts +23 -1
  37. package/Server/API/SlackAPI.ts +48 -2
  38. package/Server/API/TelemetryAPI.ts +167 -42
  39. package/Server/API/UserOnCallLogTimelineAPI.ts +75 -61
  40. package/Server/API/UserTotpAuthAPI.ts +67 -1
  41. package/Server/API/UserWebAuthnAPI.ts +44 -1
  42. package/Server/Infrastructure/Postgres/SchemaMigrations/1787923136162-MigrationName.ts +57 -0
  43. package/Server/Infrastructure/Postgres/SchemaMigrations/1789600000000-AddAutoProvisionedNetworkDeviceMonitors.ts +49 -0
  44. package/Server/Infrastructure/Postgres/SchemaMigrations/1789700000000-AddNetworkScaleIndexes.ts +129 -0
  45. package/Server/Infrastructure/Postgres/SchemaMigrations/1789800000000-WidenSecurityEventLastErrorColumns.ts +54 -0
  46. package/Server/Infrastructure/Postgres/SchemaMigrations/1789900000000-AddNetworkSiteRollupPolicyAndMaintenance.ts +64 -0
  47. package/Server/Infrastructure/Postgres/SchemaMigrations/1790000000000-AddTelemetrySourceMap.ts +64 -0
  48. package/Server/Infrastructure/Postgres/SchemaMigrations/1790000000001-AddSnmpConfigsToNetworkDeviceDiscoveryScan.ts +72 -0
  49. package/Server/Infrastructure/Postgres/SchemaMigrations/1790003445000-AddSnmpEnabledToNetworkDeviceDiscoveryScan.ts +31 -0
  50. package/Server/Infrastructure/Postgres/SchemaMigrations/1790100000000-AddResourceActivityFeeds.ts +489 -0
  51. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +18 -0
  52. package/Server/Middleware/IdentityRateLimit.ts +53 -3
  53. package/Server/Middleware/SlackAuthorization.ts +96 -18
  54. package/Server/Services/AIService.ts +181 -41
  55. package/Server/Services/CephClusterFeedService.ts +99 -0
  56. package/Server/Services/CephClusterLabelRuleEngineService.ts +29 -0
  57. package/Server/Services/CephClusterOwnerRuleEngineService.ts +23 -0
  58. package/Server/Services/CephClusterOwnerTeamService.ts +129 -0
  59. package/Server/Services/CephClusterOwnerUserService.ts +123 -0
  60. package/Server/Services/CephClusterService.ts +223 -2
  61. package/Server/Services/CloudResourceFeedService.ts +99 -0
  62. package/Server/Services/CloudResourceLabelRuleEngineService.ts +30 -0
  63. package/Server/Services/CloudResourceOwnerRuleEngineService.ts +33 -0
  64. package/Server/Services/CloudResourceOwnerTeamService.ts +129 -0
  65. package/Server/Services/CloudResourceOwnerUserService.ts +123 -0
  66. package/Server/Services/CloudResourceService.ts +227 -2
  67. package/Server/Services/DatabaseService.ts +265 -0
  68. package/Server/Services/DockerHostFeedService.ts +99 -0
  69. package/Server/Services/DockerHostLabelRuleEngineService.ts +29 -0
  70. package/Server/Services/DockerHostOwnerRuleEngineService.ts +23 -0
  71. package/Server/Services/DockerHostOwnerTeamService.ts +129 -0
  72. package/Server/Services/DockerHostOwnerUserService.ts +123 -0
  73. package/Server/Services/DockerHostService.ts +227 -2
  74. package/Server/Services/DockerSwarmClusterFeedService.ts +102 -0
  75. package/Server/Services/DockerSwarmClusterLabelRuleEngineService.ts +30 -0
  76. package/Server/Services/DockerSwarmClusterOwnerRuleEngineService.ts +24 -0
  77. package/Server/Services/DockerSwarmClusterOwnerTeamService.ts +133 -0
  78. package/Server/Services/DockerSwarmClusterOwnerUserService.ts +127 -0
  79. package/Server/Services/DockerSwarmClusterService.ts +229 -2
  80. package/Server/Services/EnterpriseLicenseService.ts +15 -7
  81. package/Server/Services/ExceptionAggregationService.ts +12 -2
  82. package/Server/Services/HostFeedService.ts +99 -0
  83. package/Server/Services/HostLabelRuleEngineService.ts +29 -0
  84. package/Server/Services/HostOwnerRuleEngineService.ts +23 -0
  85. package/Server/Services/HostOwnerTeamService.ts +129 -0
  86. package/Server/Services/HostOwnerUserService.ts +123 -0
  87. package/Server/Services/HostService.ts +215 -2
  88. package/Server/Services/IncidentService.ts +11 -0
  89. package/Server/Services/Index.ts +24 -0
  90. package/Server/Services/KubernetesClusterFeedService.ts +99 -0
  91. package/Server/Services/KubernetesClusterLabelRuleEngineService.ts +30 -0
  92. package/Server/Services/KubernetesClusterOwnerRuleEngineService.ts +24 -0
  93. package/Server/Services/KubernetesClusterOwnerTeamService.ts +133 -0
  94. package/Server/Services/KubernetesClusterOwnerUserService.ts +127 -0
  95. package/Server/Services/KubernetesClusterService.ts +231 -2
  96. package/Server/Services/LogAggregationService.ts +23 -280
  97. package/Server/Services/MetricAggregationService.ts +98 -1
  98. package/Server/Services/MonitorService.ts +177 -13
  99. package/Server/Services/MonitorTemplateService.ts +111 -0
  100. package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +777 -86
  101. package/Server/Services/NetworkDeviceAutoImportRuleService.ts +199 -16
  102. package/Server/Services/NetworkDeviceDiscoveryScanService.ts +1055 -14
  103. package/Server/Services/NetworkDeviceService.ts +750 -4
  104. package/Server/Services/NetworkInterfaceService.ts +415 -0
  105. package/Server/Services/NetworkSiteService.ts +485 -52
  106. package/Server/Services/PodmanHostFeedService.ts +99 -0
  107. package/Server/Services/PodmanHostLabelRuleEngineService.ts +29 -0
  108. package/Server/Services/PodmanHostOwnerRuleEngineService.ts +23 -0
  109. package/Server/Services/PodmanHostOwnerTeamService.ts +129 -0
  110. package/Server/Services/PodmanHostOwnerUserService.ts +123 -0
  111. package/Server/Services/PodmanHostService.ts +227 -2
  112. package/Server/Services/ProjectService.ts +16 -10
  113. package/Server/Services/ProxmoxClusterFeedService.ts +99 -0
  114. package/Server/Services/ProxmoxClusterLabelRuleEngineService.ts +30 -0
  115. package/Server/Services/ProxmoxClusterOwnerRuleEngineService.ts +24 -0
  116. package/Server/Services/ProxmoxClusterOwnerTeamService.ts +131 -0
  117. package/Server/Services/ProxmoxClusterOwnerUserService.ts +124 -0
  118. package/Server/Services/ProxmoxClusterService.ts +225 -2
  119. package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +61 -0
  120. package/Server/Services/ServiceFeedService.ts +99 -0
  121. package/Server/Services/ServiceLabelRuleEngineService.ts +29 -0
  122. package/Server/Services/ServiceOwnerRuleEngineService.ts +26 -0
  123. package/Server/Services/ServiceOwnerTeamService.ts +129 -0
  124. package/Server/Services/ServiceOwnerUserService.ts +123 -0
  125. package/Server/Services/ServiceService.ts +227 -3
  126. package/Server/Services/StatusPageSubscriberService.ts +7 -0
  127. package/Server/Services/TelemetryAttributeService.ts +13 -3
  128. package/Server/Services/TelemetrySourceMapService.ts +307 -0
  129. package/Server/Services/ThreatIntelFeedService.ts +222 -0
  130. package/Server/Services/ThreatIntelIndicatorService.ts +428 -0
  131. package/Server/Services/TraceAggregationService.ts +101 -11
  132. package/Server/Services/UserService.ts +13 -6
  133. package/Server/Services/UserTwoFactorBackupCodeService.ts +127 -0
  134. package/Server/Services/UserWebhookService.ts +11 -2
  135. package/Server/Static/Brand/README.md +38 -0
  136. package/Server/Static/Brand/favicons/apple-touch-icon.png +0 -0
  137. package/Server/Static/Brand/favicons/favicon-16x16.png +0 -0
  138. package/Server/Static/Brand/favicons/favicon-32x32.png +0 -0
  139. package/Server/Static/Brand/favicons/favicon.ico +0 -0
  140. package/Server/Static/Brand/favicons/safari-pinned-tab.svg +31 -0
  141. package/Server/Static/Brand/hou-wb.svg +1 -0
  142. package/Server/Static/Brand/oneuptime-logo.svg +1 -0
  143. package/Server/Static/Brand/ou-wb.svg +1 -0
  144. package/Server/Static/Vendor/README.md +4 -0
  145. package/Server/Types/AnalyticsDatabase/ModelPermission.ts +13 -3
  146. package/Server/Types/Database/AggregateBy.ts +83 -0
  147. package/Server/Types/Database/AggregateResultUtil.ts +126 -0
  148. package/Server/Types/Database/JSONColumnQuery.ts +18 -0
  149. package/Server/Types/Database/QueryHelper.ts +40 -0
  150. package/Server/Types/Database/QueryUtil.ts +26 -0
  151. package/Server/Types/Workflow/Components/API/Utils.ts +10 -1
  152. package/Server/Types/Workflow/Components/JavaScript.ts +8 -0
  153. package/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.ts +9 -0
  154. package/Server/Utils/AI/SRE/InvestigationGrader.ts +18 -0
  155. package/Server/Utils/AnalyticsDatabase/AttributeFilterStatement.ts +422 -0
  156. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +176 -0
  157. package/Server/Utils/DataSource/HttpFetch.ts +18 -0
  158. package/Server/Utils/Database/RelationIdUtil.ts +42 -0
  159. package/Server/Utils/Marketing/MarketingEventUtil.ts +38 -9
  160. package/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.ts +34 -3
  161. package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +9 -1
  162. package/Server/Utils/Monitor/Criteria/SyntheticMonitor.ts +28 -10
  163. package/Server/Utils/Monitor/MonitorAlert.ts +541 -332
  164. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +330 -64
  165. package/Server/Utils/Monitor/MonitorIncident.ts +640 -434
  166. package/Server/Utils/Monitor/MonitorResource.ts +226 -49
  167. package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +46 -3
  168. package/Server/Utils/Monitor/NetworkInventoryUtil.ts +23 -102
  169. package/Server/Utils/Monitor/PerEntityCriteriaFanOut.ts +329 -0
  170. package/Server/Utils/NetworkDevice/DeviceHealthAggregation.ts +427 -0
  171. package/Server/Utils/NetworkSite/NetworkSiteMaintenanceSuppression.ts +310 -0
  172. package/Server/Utils/OnCallNotificationContext.ts +686 -0
  173. package/Server/Utils/PrivateNetworkWebhookConfig.ts +549 -0
  174. package/Server/Utils/ResourceFeed/ResourceFeedUtil.ts +139 -0
  175. package/Server/Utils/Response.ts +11 -1
  176. package/Server/Utils/SSRFProtection.ts +230 -60
  177. package/Server/Utils/SecurityEvent/ConnectorErrorMessage.ts +106 -0
  178. package/Server/Utils/SecurityEvent/DetectionRuleEvaluator.ts +84 -284
  179. package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.ts +47 -20
  180. package/Server/Utils/SecurityEvent/SecurityEventAlerting.ts +318 -0
  181. package/Server/Utils/SecurityEvent/ThreatIntel/TaxiiClient.ts +199 -0
  182. package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelEnricher.ts +252 -0
  183. package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.ts +739 -0
  184. package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.ts +533 -0
  185. package/Server/Utils/StartServer.ts +83 -56
  186. package/Server/Utils/StatusPageSubscriberWebhook.ts +3 -0
  187. package/Server/Utils/Telemetry/LlmMetricSpend.ts +56 -5
  188. package/Server/Utils/Telemetry/LlmSpan.ts +46 -0
  189. package/Server/Utils/Telemetry/SourceMapResolver.ts +480 -0
  190. package/Server/Utils/TwoFactorBackupCodeNotification.ts +106 -0
  191. package/Server/Utils/VM/VMAPI.ts +3 -0
  192. package/Server/Utils/VM/VMRunner.ts +27 -1
  193. package/Server/Utils/VendorAssets.ts +42 -0
  194. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +136 -6
  195. package/Server/Utils/Workspace/Slack/Actions/Auth.ts +0 -12
  196. package/Server/Views/AcknowledgeUserOnCallNotification.ejs +11 -9
  197. package/Server/Views/Partials/Head.ejs +9 -9
  198. package/Server/Views/Partials/OnCallNotificationDetails.ejs +48 -0
  199. package/Server/Views/ViewMessage.ejs +11 -9
  200. package/Tests/App/Accounts/LoginTwoFactorRecovery.test.tsx +972 -0
  201. package/Tests/App/Dashboard/AddNeighborToMonitoringModal.test.tsx +401 -0
  202. package/Tests/App/Dashboard/DiscoveryScanEditForm.test.tsx +707 -0
  203. package/Tests/App/Dashboard/DiscoveryScanWizardValidation.test.tsx +1908 -18
  204. package/Tests/App/Dashboard/LlmCallsTableIdentity.test.tsx +322 -0
  205. package/Tests/App/Dashboard/LlmOverview.test.tsx +335 -0
  206. package/Tests/App/Dashboard/LlmSpanDisplay.test.ts +391 -0
  207. package/Tests/App/Dashboard/LlmUsageBreakdown.test.tsx +1007 -0
  208. package/Tests/App/Dashboard/ResourceFeed.test.tsx +230 -0
  209. package/Tests/App/Dashboard/ResourceFeedPageWiring.test.ts +216 -0
  210. package/Tests/App/Dashboard/TopologyAddToMonitoring.test.tsx +192 -0
  211. package/Tests/App/Dashboard/WorkspaceNotificationRuleConditions.test.tsx +439 -0
  212. package/Tests/Models/DatabaseModels/DateColumnDeserialization.test.ts +182 -0
  213. package/Tests/Models/DatabaseModels/RelationColumnModelTypeCoverage.test.ts +82 -0
  214. package/Tests/Models/DatabaseModels/ResourceFeedModels.test.ts +398 -0
  215. package/Tests/Models/DiscoveryScanNameColumn.test.ts +151 -16
  216. package/Tests/Models/DiscoveryScanSnmpEnabledColumn.test.ts +593 -0
  217. package/Tests/Models/NetworkDeviceCreateContract.test.ts +102 -0
  218. package/Tests/Server/API/AIGenerationProjectAIToggle.test.ts +607 -0
  219. package/Tests/Server/API/AIGenerationRequestBudget.test.ts +355 -0
  220. package/Tests/Server/API/AIKillSwitchBackstop.test.ts +602 -0
  221. package/Tests/Server/API/BaseAPI.test.ts +41 -0
  222. package/Tests/Server/API/BaseAPIUpdateDateColumns.test.ts +154 -0
  223. package/Tests/Server/API/BaseAPIUpdatePayloadValidation.test.ts +9 -16
  224. package/Tests/Server/API/MicrosoftTeamsBotTestEndpoint.test.ts +335 -0
  225. package/Tests/Server/API/UserOnCallLogTimelineAcknowledgePage.test.ts +611 -0
  226. package/Tests/Server/API/UserTotpAuthAPI.test.ts +498 -4
  227. package/Tests/Server/API/UserWebAuthnBackupCodeMinting.test.ts +682 -0
  228. package/Tests/Server/Infrastructure/ExampleDockerfiles.test.ts +595 -0
  229. package/Tests/Server/Middleware/SlackAuthorization.test.ts +262 -5
  230. package/Tests/Server/Services/AIServiceDailyBudget.test.ts +9 -0
  231. package/Tests/Server/Services/AIServiceProjectAccess.test.ts +6 -0
  232. package/Tests/Server/Services/AutoImportScanCredentialSelect.test.ts +18 -0
  233. package/Tests/Server/Services/DatabaseServiceAggregateBy.test.ts +590 -0
  234. package/Tests/Server/Services/DatabaseServiceUpdateWriteRouting.test.ts +12 -0
  235. package/Tests/Server/Services/DiscoveryScanClaimHookFreeSafety.test.ts +162 -26
  236. package/Tests/Server/Services/EnterpriseLicenseServiceCreate.test.ts +292 -0
  237. package/Tests/Server/Services/FeedRetentionConsistency.test.ts +119 -12
  238. package/Tests/Server/Services/LogAggregationAttributeOperators.test.ts +109 -0
  239. package/Tests/Server/Services/MetricAggregationAttributeOperators.test.ts +170 -0
  240. package/Tests/Server/Services/MonitorTemplateServiceNetworkDeviceSync.test.ts +383 -0
  241. package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +997 -3
  242. package/Tests/Server/Services/NetworkDeviceAutoImportRuleService.test.ts +830 -0
  243. package/Tests/Server/Services/NetworkDeviceAutoMonitorLifecycle.test.ts +528 -0
  244. package/Tests/Server/Services/NetworkDeviceDiscoveryScanService.test.ts +3141 -1
  245. package/Tests/Server/Services/NetworkDeviceRegisteredHostnames.test.ts +1023 -0
  246. package/Tests/Server/Services/NetworkDeviceSiteAssignmentRuleSkip.test.ts +728 -0
  247. package/Tests/Server/Services/NetworkInterfaceServiceUpsert.test.ts +795 -0
  248. package/Tests/Server/Services/NetworkSiteRollupPolicyAndMaintenance.test.ts +903 -0
  249. package/Tests/Server/Services/NetworkSiteService.test.ts +165 -24
  250. package/Tests/Server/Services/ProjectServiceChangePlan.test.ts +5 -3
  251. package/Tests/Server/Services/ProjectServiceCreateSubscriptionStarted.test.ts +5 -2
  252. package/Tests/Server/Services/ResourceCreationFeedWrites.test.ts +304 -0
  253. package/Tests/Server/Services/ResourceFeedServices.test.ts +269 -0
  254. package/Tests/Server/Services/ResourceOwnerFeedWrites.test.ts +245 -0
  255. package/Tests/Server/Services/SecurityEventLastErrorColumnWidth.test.ts +792 -0
  256. package/Tests/Server/Services/TelemetrySourceMapService.test.ts +483 -0
  257. package/Tests/Server/Services/ThreatIntelFeedService.test.ts +351 -0
  258. package/Tests/Server/Services/ThreatIntelIndicatorService.test.ts +366 -0
  259. package/Tests/Server/Services/TraceAggregationAttributeOperators.test.ts +507 -0
  260. package/Tests/Server/Services/UserTwoFactorBackupCodeGenerateIfNone.test.ts +705 -0
  261. package/Tests/Server/Services/WorkspaceNotificationRuleOnCallDutyPolicy.test.ts +306 -0
  262. package/Tests/Server/Types/Database/AggregateResultUtil.test.ts +386 -0
  263. package/Tests/Server/Types/Database/Permissions/SelectRejectionMessageContract.test.ts +424 -0
  264. package/Tests/Server/Types/Database/QueryHelperWildcard.test.ts +142 -0
  265. package/Tests/Server/Types/Workflow/Components/ApiComponentPrivateNetwork.test.ts +163 -0
  266. package/Tests/Server/Types/Workflow/Components/JavaScriptPrivateNetwork.test.ts +124 -0
  267. package/Tests/Server/Utils/AI/CodeFixAgentCompletion.test.ts +5 -0
  268. package/Tests/Server/Utils/AI/InvestigationGrader.test.ts +39 -1
  269. package/Tests/Server/Utils/AnalyticsDatabase/AttributeFilterStatement.test.ts +338 -0
  270. package/Tests/Server/Utils/AnalyticsDatabase/StatementGeneratorWildcard.test.ts +383 -0
  271. package/Tests/Server/Utils/Marketing/EmittedMarketingEvent.ts +23 -0
  272. package/Tests/Server/Utils/Marketing/MarketingEventUtil.test.ts +51 -0
  273. package/Tests/Server/Utils/Monitor/Criteria/SyntheticMonitorCriteria.test.ts +259 -0
  274. package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPerSeriesFanout.test.ts +557 -0
  275. package/Tests/Server/Utils/Monitor/MonitorDependencySuppressionCreatorSkip.test.ts +12 -2
  276. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkLogWritePath.test.ts +404 -0
  277. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +8 -2
  278. package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +125 -98
  279. package/Tests/Server/Utils/Monitor/PerEntityCriteriaFanOut.test.ts +444 -0
  280. package/Tests/Server/Utils/Monitor/PerSeriesSecondEntityAlerting.test.ts +1112 -0
  281. package/Tests/Server/Utils/NetworkDevice/DeviceHealthAggregation.test.ts +717 -0
  282. package/Tests/Server/Utils/NetworkDevice/RulePatternValidator.test.ts +78 -0
  283. package/Tests/Server/Utils/NetworkSite/NetworkSiteMaintenanceSuppression.test.ts +363 -0
  284. package/Tests/Server/Utils/OfflineAssetHygiene.test.ts +35 -0
  285. package/Tests/Server/Utils/OnCallNotificationContext.test.ts +908 -0
  286. package/Tests/Server/Utils/PrivateNetworkWebhookConfig.test.ts +423 -0
  287. package/Tests/Server/Utils/ResourceFeed/ResourceFeedUtil.test.ts +191 -0
  288. package/Tests/Server/Utils/SSRFProtectionPrivateNetwork.test.ts +597 -0
  289. package/Tests/Server/Utils/SecurityEvent/ConnectorErrorMessage.test.ts +819 -0
  290. package/Tests/Server/Utils/SecurityEvent/DetectionRuleEvaluator.test.ts +381 -0
  291. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPoller.test.ts +417 -0
  292. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerFailureTaxonomy.test.ts +819 -0
  293. package/Tests/Server/Utils/SecurityEvent/SecurityEventAlerting.test.ts +246 -0
  294. package/Tests/Server/Utils/SecurityEvent/ThreatIntel/TaxiiClient.test.ts +282 -0
  295. package/Tests/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelEnricher.test.ts +312 -0
  296. package/Tests/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.test.ts +854 -0
  297. package/Tests/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.test.ts +437 -0
  298. package/Tests/Server/Utils/StartServerErrorStatus.test.ts +225 -0
  299. package/Tests/Server/Utils/StatusPage/MonitorRulePatternValidator.test.ts +62 -0
  300. package/Tests/Server/Utils/StatusPageSubscriberWebhookPrivateNetwork.test.ts +119 -0
  301. package/Tests/Server/Utils/Telemetry/LlmCostBudgetEvaluator.test.ts +37 -18
  302. package/Tests/Server/Utils/Telemetry/LlmMetricSpend.test.ts +143 -2
  303. package/Tests/Server/Utils/Telemetry/LlmSpan.test.ts +804 -0
  304. package/Tests/Server/Utils/Telemetry/SourceMapResolver.test.ts +542 -0
  305. package/Tests/Server/Utils/TwoFactorBackupCodeNotification.test.ts +272 -0
  306. package/Tests/Server/Utils/VM/VMRunnerPrivateNetworkWiring.test.ts +111 -0
  307. package/Tests/Server/Utils/VendorAssets.test.ts +117 -0
  308. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelSend.test.ts +101 -4
  309. package/Tests/Server/Utils/Workspace/MicrosoftTeamsInstallStateDiagnostics.test.ts +922 -0
  310. package/Tests/Server/Utils/Workspace/MicrosoftTeamsRosterDiagnosticMessages.test.ts +642 -0
  311. package/Tests/Server/Views/OnCallAcknowledgePage.test.ts +430 -0
  312. package/Tests/Types/API/URLQueryString.test.ts +472 -0
  313. package/Tests/Types/BaseDatabase/Wildcard.test.ts +163 -0
  314. package/Tests/Types/BaseDatabase/WildcardPattern.test.ts +149 -0
  315. package/Tests/Types/Database/DateColumnValue.test.ts +265 -0
  316. package/Tests/Types/DateToIsoStringOrNull.test.ts +67 -0
  317. package/Tests/Types/Log/LogQueryToFilter.test.ts +218 -43
  318. package/Tests/Types/Monitor/KubernetesTemplateGroupByKeys.test.ts +225 -0
  319. package/Tests/Types/Monitor/TemplateGroupByKeys.test.ts +296 -0
  320. package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +102 -0
  321. package/Tests/Types/NetworkAutomation/RuleRunResultDescribe.test.ts +145 -0
  322. package/Tests/Types/NetworkSite/SiteHealthRollupPolicy.test.ts +58 -0
  323. package/Tests/Types/SerializableObjectDictionaryImportCycle.test.ts +15 -0
  324. package/Tests/Types/Telemetry/LlmMetricConventions.test.ts +391 -0
  325. package/Tests/Types/Telemetry/TelemetrySearchQuery.test.ts +620 -0
  326. package/Tests/Types/WhatsApp/WhatsAppTemplates.test.ts +110 -0
  327. package/Tests/Types/Workspace/NotificationRuleConditionUtil.test.ts +76 -6
  328. package/Tests/Types/Workspace/NotificationRules/NotificationRuleCondition.test.ts +16 -4
  329. package/Tests/Types/Workspace/NotificationRules/OnCallDutyPolicyConditions.test.ts +669 -0
  330. package/Tests/UI/Components/DictionaryFilterOperatorWildcard.test.ts +175 -0
  331. package/Tests/UI/Components/IconOpticalSize.test.tsx +377 -0
  332. package/Tests/UI/MicrosoftTeams/MicrosoftTeamsChatsCardInstallGuidance.test.tsx +332 -0
  333. package/Tests/UI/MicrosoftTeams/MicrosoftTeamsInstallGuidanceContent.test.tsx +643 -0
  334. package/Tests/Utils/Monitor/InterfaceInventoryUtil.test.ts +824 -0
  335. package/Tests/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.test.ts +626 -0
  336. package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +718 -0
  337. package/Tests/Utils/NetworkDevice/DeviceHealthStateUtil.test.ts +59 -0
  338. package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +287 -2
  339. package/Tests/Utils/NetworkDiscovery/DiscoveryImportEligibility.test.ts +73 -0
  340. package/Tests/Utils/NetworkDiscovery/PingMonitorBuilder.test.ts +317 -0
  341. package/Tests/Utils/NetworkDiscovery/RescanIntervalUtil.test.ts +262 -0
  342. package/Tests/Utils/NetworkDiscovery/ScanModeUtil.test.ts +474 -0
  343. package/Tests/Utils/NetworkDiscovery/SnmpScanConfigUtil.test.ts +2442 -0
  344. package/Tests/Utils/NetworkSite/SiteMaintenanceUtil.test.ts +188 -0
  345. package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +522 -0
  346. package/Tests/Utils/NetworkSite/SiteUptimeUtil.test.ts +694 -0
  347. package/Tests/Utils/SecurityEvent/ThreatIntel/StixPatternParser.test.ts +281 -0
  348. package/Tests/Utils/Telemetry/CrossSignalScope.test.ts +87 -67
  349. package/Tests/Utils/Telemetry/LlmMetricQuery.test.ts +298 -0
  350. package/Types/API/URL.ts +45 -10
  351. package/Types/AnalyticsDatabase/AnalyticsTableName.ts +8 -0
  352. package/Types/BaseDatabase/NotWildcard.ts +86 -0
  353. package/Types/BaseDatabase/Wildcard.ts +89 -0
  354. package/Types/BaseDatabase/WildcardPattern.ts +176 -0
  355. package/Types/Database/DateColumnValue.ts +184 -0
  356. package/Types/Database/TableColumn.ts +40 -5
  357. package/Types/Date.ts +37 -0
  358. package/Types/Email/EmailTemplateType.ts +1 -0
  359. package/Types/JSON.ts +8 -0
  360. package/Types/Log/LogQueryToFilter.ts +167 -129
  361. package/Types/Monitor/DockerAlertTemplates.ts +43 -12
  362. package/Types/Monitor/HostAlertTemplates.ts +31 -3
  363. package/Types/Monitor/KubernetesAlertTemplates.ts +98 -0
  364. package/Types/Monitor/MonitorStep.ts +49 -0
  365. package/Types/Monitor/PodmanAlertTemplates.ts +39 -12
  366. package/Types/Monitor/SnmpMonitor/CdpNeighbor.ts +14 -0
  367. package/Types/Monitor/SnmpMonitor/LldpNeighbor.ts +11 -0
  368. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +11 -4
  369. package/Types/NetworkAutomation/RuleRunResult.ts +191 -2
  370. package/Types/NetworkSite/SiteHealthRollupPolicy.ts +96 -0
  371. package/Types/Permission.ts +411 -0
  372. package/Types/Probe/ProbeApiIngestResponse.ts +42 -0
  373. package/Types/SecurityEvent/ThreatIntelConstants.ts +118 -0
  374. package/Types/SerializableObjectDictionary.ts +8 -0
  375. package/Types/Telemetry/LlmConventions.ts +255 -0
  376. package/Types/Telemetry/LlmMetricConventions.ts +212 -7
  377. package/Types/Telemetry/SourceMap.ts +56 -0
  378. package/Types/Telemetry/TelemetrySearchQuery.ts +949 -0
  379. package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +12 -1
  380. package/UI/Components/Dictionary/DictionaryFilterOperator.ts +83 -0
  381. package/UI/Components/Icon/Icon.tsx +28 -1
  382. package/UI/Components/LogsViewer/components/LogSearchBar.tsx +26 -4
  383. package/UI/Components/LogsViewer/components/LogSearchHelp.tsx +34 -16
  384. package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +15 -2
  385. package/Utils/Metrics/MetricExplorerUrl.ts +77 -15
  386. package/Utils/Monitor/InterfaceInventoryUtil.ts +251 -0
  387. package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +333 -0
  388. package/Utils/Monitor/NetworkTopologyUtil.ts +249 -28
  389. package/Utils/NetworkDevice/DeviceHealthStateUtil.ts +14 -6
  390. package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +2 -0
  391. package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +49 -18
  392. package/Utils/NetworkDiscovery/PingMonitorBuilder.ts +215 -0
  393. package/Utils/NetworkDiscovery/RescanIntervalUtil.ts +148 -0
  394. package/Utils/NetworkDiscovery/ScanModeUtil.ts +105 -0
  395. package/Utils/NetworkDiscovery/SnmpScanConfigUtil.ts +827 -0
  396. package/Utils/NetworkSite/SiteMaintenanceUtil.ts +110 -0
  397. package/Utils/NetworkSite/SiteStatusRollupUtil.ts +350 -19
  398. package/Utils/NetworkSite/SiteUptimeUtil.ts +422 -21
  399. package/Utils/SecurityEvent/ThreatIntel/StixPatternParser.ts +383 -0
  400. package/Utils/Telemetry/CrossSignalScope.ts +37 -39
  401. package/Utils/Telemetry/LlmMetricQuery.ts +83 -0
  402. package/build/dist/Models/AnalyticsModels/Index.js +2 -0
  403. package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
  404. package/build/dist/Models/AnalyticsModels/Span.js +89 -0
  405. package/build/dist/Models/AnalyticsModels/Span.js.map +1 -1
  406. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js +325 -0
  407. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js.map +1 -0
  408. package/build/dist/Models/DatabaseModels/AlertSeverity.js +4 -1
  409. package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
  410. package/build/dist/Models/DatabaseModels/CephClusterFeed.js +648 -0
  411. package/build/dist/Models/DatabaseModels/CephClusterFeed.js.map +1 -0
  412. package/build/dist/Models/DatabaseModels/CloudResourceFeed.js +648 -0
  413. package/build/dist/Models/DatabaseModels/CloudResourceFeed.js.map +1 -0
  414. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +11 -0
  415. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
  416. package/build/dist/Models/DatabaseModels/DetectionRule.js +9 -3
  417. package/build/dist/Models/DatabaseModels/DetectionRule.js.map +1 -1
  418. package/build/dist/Models/DatabaseModels/DockerHostFeed.js +648 -0
  419. package/build/dist/Models/DatabaseModels/DockerHostFeed.js.map +1 -0
  420. package/build/dist/Models/DatabaseModels/DockerSwarmClusterFeed.js +648 -0
  421. package/build/dist/Models/DatabaseModels/DockerSwarmClusterFeed.js.map +1 -0
  422. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js +9 -3
  423. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js.map +1 -1
  424. package/build/dist/Models/DatabaseModels/HostFeed.js +648 -0
  425. package/build/dist/Models/DatabaseModels/HostFeed.js.map +1 -0
  426. package/build/dist/Models/DatabaseModels/IncidentSeverity.js +4 -1
  427. package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
  428. package/build/dist/Models/DatabaseModels/Index.js +22 -0
  429. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  430. package/build/dist/Models/DatabaseModels/KubernetesClusterFeed.js +648 -0
  431. package/build/dist/Models/DatabaseModels/KubernetesClusterFeed.js.map +1 -0
  432. package/build/dist/Models/DatabaseModels/Monitor.js +81 -0
  433. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  434. package/build/dist/Models/DatabaseModels/NetworkDevice.js +103 -7
  435. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  436. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js +91 -6
  437. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js.map +1 -1
  438. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +276 -31
  439. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  440. package/build/dist/Models/DatabaseModels/NetworkSite.js +124 -1
  441. package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -1
  442. package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +1 -0
  443. package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
  444. package/build/dist/Models/DatabaseModels/PodmanHostFeed.js +648 -0
  445. package/build/dist/Models/DatabaseModels/PodmanHostFeed.js.map +1 -0
  446. package/build/dist/Models/DatabaseModels/ProxmoxClusterFeed.js +648 -0
  447. package/build/dist/Models/DatabaseModels/ProxmoxClusterFeed.js.map +1 -0
  448. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +66 -0
  449. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  450. package/build/dist/Models/DatabaseModels/ServiceFeed.js +648 -0
  451. package/build/dist/Models/DatabaseModels/ServiceFeed.js.map +1 -0
  452. package/build/dist/Models/DatabaseModels/TelemetrySourceMap.js +496 -0
  453. package/build/dist/Models/DatabaseModels/TelemetrySourceMap.js.map +1 -0
  454. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js +800 -0
  455. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js.map +1 -0
  456. package/build/dist/Models/DatabaseModels/UserOnCallLog.js +1 -0
  457. package/build/dist/Models/DatabaseModels/UserOnCallLog.js.map +1 -1
  458. package/build/dist/Models/DatabaseModels/UserTotpAuth.js +1 -0
  459. package/build/dist/Models/DatabaseModels/UserTotpAuth.js.map +1 -1
  460. package/build/dist/Models/DatabaseModels/UserWebAuthn.js +1 -0
  461. package/build/dist/Models/DatabaseModels/UserWebAuthn.js.map +1 -1
  462. package/build/dist/Server/API/AlertAPI.js +18 -1
  463. package/build/dist/Server/API/AlertAPI.js.map +1 -1
  464. package/build/dist/Server/API/BaseAPI.js +11 -20
  465. package/build/dist/Server/API/BaseAPI.js.map +1 -1
  466. package/build/dist/Server/API/IncidentAPI.js +35 -1
  467. package/build/dist/Server/API/IncidentAPI.js.map +1 -1
  468. package/build/dist/Server/API/IncidentEpisodeAPI.js +18 -1
  469. package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
  470. package/build/dist/Server/API/MicrosoftTeamsAPI.js +30 -2
  471. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  472. package/build/dist/Server/API/ScheduledMaintenanceAPI.js +18 -1
  473. package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
  474. package/build/dist/Server/API/SlackAPI.js +45 -2
  475. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  476. package/build/dist/Server/API/TelemetryAPI.js +100 -35
  477. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  478. package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +64 -59
  479. package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
  480. package/build/dist/Server/API/UserTotpAuthAPI.js +65 -1
  481. package/build/dist/Server/API/UserTotpAuthAPI.js.map +1 -1
  482. package/build/dist/Server/API/UserWebAuthnAPI.js +42 -1
  483. package/build/dist/Server/API/UserWebAuthnAPI.js.map +1 -1
  484. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787923136162-MigrationName.js +26 -0
  485. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787923136162-MigrationName.js.map +1 -0
  486. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789600000000-AddAutoProvisionedNetworkDeviceMonitors.js +22 -0
  487. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789600000000-AddAutoProvisionedNetworkDeviceMonitors.js.map +1 -0
  488. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789700000000-AddNetworkScaleIndexes.js +88 -0
  489. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789700000000-AddNetworkScaleIndexes.js.map +1 -0
  490. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789800000000-WidenSecurityEventLastErrorColumns.js +39 -0
  491. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789800000000-WidenSecurityEventLastErrorColumns.js.map +1 -0
  492. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789900000000-AddNetworkSiteRollupPolicyAndMaintenance.js +34 -0
  493. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789900000000-AddNetworkSiteRollupPolicyAndMaintenance.js.map +1 -0
  494. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790000000000-AddTelemetrySourceMap.js +32 -0
  495. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790000000000-AddTelemetrySourceMap.js.map +1 -0
  496. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790000000001-AddSnmpConfigsToNetworkDeviceDiscoveryScan.js +61 -0
  497. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790000000001-AddSnmpConfigsToNetworkDeviceDiscoveryScan.js.map +1 -0
  498. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790003445000-AddSnmpEnabledToNetworkDeviceDiscoveryScan.js +23 -0
  499. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790003445000-AddSnmpEnabledToNetworkDeviceDiscoveryScan.js.map +1 -0
  500. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790100000000-AddResourceActivityFeeds.js +179 -0
  501. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790100000000-AddResourceActivityFeeds.js.map +1 -0
  502. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +18 -0
  503. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  504. package/build/dist/Server/Middleware/IdentityRateLimit.js +40 -3
  505. package/build/dist/Server/Middleware/IdentityRateLimit.js.map +1 -1
  506. package/build/dist/Server/Middleware/SlackAuthorization.js +58 -7
  507. package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
  508. package/build/dist/Server/Services/AIService.js +177 -30
  509. package/build/dist/Server/Services/AIService.js.map +1 -1
  510. package/build/dist/Server/Services/CephClusterFeedService.js +89 -0
  511. package/build/dist/Server/Services/CephClusterFeedService.js.map +1 -0
  512. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js +27 -3
  513. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js.map +1 -1
  514. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js +21 -0
  515. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js.map +1 -1
  516. package/build/dist/Server/Services/CephClusterOwnerTeamService.js +120 -0
  517. package/build/dist/Server/Services/CephClusterOwnerTeamService.js.map +1 -1
  518. package/build/dist/Server/Services/CephClusterOwnerUserService.js +113 -0
  519. package/build/dist/Server/Services/CephClusterOwnerUserService.js.map +1 -1
  520. package/build/dist/Server/Services/CephClusterService.js +175 -1
  521. package/build/dist/Server/Services/CephClusterService.js.map +1 -1
  522. package/build/dist/Server/Services/CloudResourceFeedService.js +89 -0
  523. package/build/dist/Server/Services/CloudResourceFeedService.js.map +1 -0
  524. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js +27 -3
  525. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js.map +1 -1
  526. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js +28 -3
  527. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js.map +1 -1
  528. package/build/dist/Server/Services/CloudResourceOwnerTeamService.js +120 -0
  529. package/build/dist/Server/Services/CloudResourceOwnerTeamService.js.map +1 -1
  530. package/build/dist/Server/Services/CloudResourceOwnerUserService.js +113 -0
  531. package/build/dist/Server/Services/CloudResourceOwnerUserService.js.map +1 -1
  532. package/build/dist/Server/Services/CloudResourceService.js +177 -1
  533. package/build/dist/Server/Services/CloudResourceService.js.map +1 -1
  534. package/build/dist/Server/Services/DatabaseService.js +201 -0
  535. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  536. package/build/dist/Server/Services/DockerHostFeedService.js +89 -0
  537. package/build/dist/Server/Services/DockerHostFeedService.js.map +1 -0
  538. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js +27 -3
  539. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js.map +1 -1
  540. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js +21 -0
  541. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js.map +1 -1
  542. package/build/dist/Server/Services/DockerHostOwnerTeamService.js +120 -0
  543. package/build/dist/Server/Services/DockerHostOwnerTeamService.js.map +1 -1
  544. package/build/dist/Server/Services/DockerHostOwnerUserService.js +113 -0
  545. package/build/dist/Server/Services/DockerHostOwnerUserService.js.map +1 -1
  546. package/build/dist/Server/Services/DockerHostService.js +177 -1
  547. package/build/dist/Server/Services/DockerHostService.js.map +1 -1
  548. package/build/dist/Server/Services/DockerSwarmClusterFeedService.js +90 -0
  549. package/build/dist/Server/Services/DockerSwarmClusterFeedService.js.map +1 -0
  550. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js +27 -3
  551. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js.map +1 -1
  552. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js +21 -0
  553. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js.map +1 -1
  554. package/build/dist/Server/Services/DockerSwarmClusterOwnerTeamService.js +120 -0
  555. package/build/dist/Server/Services/DockerSwarmClusterOwnerTeamService.js.map +1 -1
  556. package/build/dist/Server/Services/DockerSwarmClusterOwnerUserService.js +113 -0
  557. package/build/dist/Server/Services/DockerSwarmClusterOwnerUserService.js.map +1 -1
  558. package/build/dist/Server/Services/DockerSwarmClusterService.js +175 -1
  559. package/build/dist/Server/Services/DockerSwarmClusterService.js.map +1 -1
  560. package/build/dist/Server/Services/EnterpriseLicenseService.js +40 -30
  561. package/build/dist/Server/Services/EnterpriseLicenseService.js.map +1 -1
  562. package/build/dist/Server/Services/ExceptionAggregationService.js +8 -2
  563. package/build/dist/Server/Services/ExceptionAggregationService.js.map +1 -1
  564. package/build/dist/Server/Services/HostFeedService.js +89 -0
  565. package/build/dist/Server/Services/HostFeedService.js.map +1 -0
  566. package/build/dist/Server/Services/HostLabelRuleEngineService.js +27 -3
  567. package/build/dist/Server/Services/HostLabelRuleEngineService.js.map +1 -1
  568. package/build/dist/Server/Services/HostOwnerRuleEngineService.js +21 -0
  569. package/build/dist/Server/Services/HostOwnerRuleEngineService.js.map +1 -1
  570. package/build/dist/Server/Services/HostOwnerTeamService.js +120 -0
  571. package/build/dist/Server/Services/HostOwnerTeamService.js.map +1 -1
  572. package/build/dist/Server/Services/HostOwnerUserService.js +113 -0
  573. package/build/dist/Server/Services/HostOwnerUserService.js.map +1 -1
  574. package/build/dist/Server/Services/HostService.js +175 -1
  575. package/build/dist/Server/Services/HostService.js.map +1 -1
  576. package/build/dist/Server/Services/IncidentService.js +10 -0
  577. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  578. package/build/dist/Server/Services/Index.js +24 -0
  579. package/build/dist/Server/Services/Index.js.map +1 -1
  580. package/build/dist/Server/Services/KubernetesClusterFeedService.js +89 -0
  581. package/build/dist/Server/Services/KubernetesClusterFeedService.js.map +1 -0
  582. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js +27 -3
  583. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js.map +1 -1
  584. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js +21 -0
  585. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js.map +1 -1
  586. package/build/dist/Server/Services/KubernetesClusterOwnerTeamService.js +120 -0
  587. package/build/dist/Server/Services/KubernetesClusterOwnerTeamService.js.map +1 -1
  588. package/build/dist/Server/Services/KubernetesClusterOwnerUserService.js +113 -0
  589. package/build/dist/Server/Services/KubernetesClusterOwnerUserService.js.map +1 -1
  590. package/build/dist/Server/Services/KubernetesClusterService.js +177 -1
  591. package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
  592. package/build/dist/Server/Services/LogAggregationService.js +19 -196
  593. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  594. package/build/dist/Server/Services/MetricAggregationService.js +59 -0
  595. package/build/dist/Server/Services/MetricAggregationService.js.map +1 -1
  596. package/build/dist/Server/Services/MonitorService.js +115 -13
  597. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  598. package/build/dist/Server/Services/MonitorTemplateService.js +86 -0
  599. package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
  600. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +561 -67
  601. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
  602. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +130 -16
  603. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -1
  604. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +850 -8
  605. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -1
  606. package/build/dist/Server/Services/NetworkDeviceService.js +594 -5
  607. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  608. package/build/dist/Server/Services/NetworkInterfaceService.js +306 -0
  609. package/build/dist/Server/Services/NetworkInterfaceService.js.map +1 -1
  610. package/build/dist/Server/Services/NetworkSiteService.js +408 -47
  611. package/build/dist/Server/Services/NetworkSiteService.js.map +1 -1
  612. package/build/dist/Server/Services/PodmanHostFeedService.js +89 -0
  613. package/build/dist/Server/Services/PodmanHostFeedService.js.map +1 -0
  614. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js +27 -3
  615. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js.map +1 -1
  616. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js +21 -0
  617. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js.map +1 -1
  618. package/build/dist/Server/Services/PodmanHostOwnerTeamService.js +120 -0
  619. package/build/dist/Server/Services/PodmanHostOwnerTeamService.js.map +1 -1
  620. package/build/dist/Server/Services/PodmanHostOwnerUserService.js +113 -0
  621. package/build/dist/Server/Services/PodmanHostOwnerUserService.js.map +1 -1
  622. package/build/dist/Server/Services/PodmanHostService.js +177 -1
  623. package/build/dist/Server/Services/PodmanHostService.js.map +1 -1
  624. package/build/dist/Server/Services/ProjectService.js +40 -30
  625. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  626. package/build/dist/Server/Services/ProxmoxClusterFeedService.js +89 -0
  627. package/build/dist/Server/Services/ProxmoxClusterFeedService.js.map +1 -0
  628. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js +27 -3
  629. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js.map +1 -1
  630. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js +21 -0
  631. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js.map +1 -1
  632. package/build/dist/Server/Services/ProxmoxClusterOwnerTeamService.js +120 -0
  633. package/build/dist/Server/Services/ProxmoxClusterOwnerTeamService.js.map +1 -1
  634. package/build/dist/Server/Services/ProxmoxClusterOwnerUserService.js +113 -0
  635. package/build/dist/Server/Services/ProxmoxClusterOwnerUserService.js.map +1 -1
  636. package/build/dist/Server/Services/ProxmoxClusterService.js +175 -1
  637. package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -1
  638. package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +56 -0
  639. package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
  640. package/build/dist/Server/Services/ServiceFeedService.js +89 -0
  641. package/build/dist/Server/Services/ServiceFeedService.js.map +1 -0
  642. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js +27 -3
  643. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js.map +1 -1
  644. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js +24 -0
  645. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js.map +1 -1
  646. package/build/dist/Server/Services/ServiceOwnerTeamService.js +120 -0
  647. package/build/dist/Server/Services/ServiceOwnerTeamService.js.map +1 -1
  648. package/build/dist/Server/Services/ServiceOwnerUserService.js +113 -0
  649. package/build/dist/Server/Services/ServiceOwnerUserService.js.map +1 -1
  650. package/build/dist/Server/Services/ServiceService.js +173 -2
  651. package/build/dist/Server/Services/ServiceService.js.map +1 -1
  652. package/build/dist/Server/Services/StatusPageSubscriberService.js +7 -0
  653. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  654. package/build/dist/Server/Services/TelemetryAttributeService.js +9 -3
  655. package/build/dist/Server/Services/TelemetryAttributeService.js.map +1 -1
  656. package/build/dist/Server/Services/TelemetrySourceMapService.js +265 -0
  657. package/build/dist/Server/Services/TelemetrySourceMapService.js.map +1 -0
  658. package/build/dist/Server/Services/ThreatIntelFeedService.js +157 -0
  659. package/build/dist/Server/Services/ThreatIntelFeedService.js.map +1 -0
  660. package/build/dist/Server/Services/ThreatIntelIndicatorService.js +276 -0
  661. package/build/dist/Server/Services/ThreatIntelIndicatorService.js.map +1 -0
  662. package/build/dist/Server/Services/TraceAggregationService.js +62 -6
  663. package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
  664. package/build/dist/Server/Services/UserService.js +22 -13
  665. package/build/dist/Server/Services/UserService.js.map +1 -1
  666. package/build/dist/Server/Services/UserTwoFactorBackupCodeService.js +120 -0
  667. package/build/dist/Server/Services/UserTwoFactorBackupCodeService.js.map +1 -1
  668. package/build/dist/Server/Services/UserWebhookService.js +11 -2
  669. package/build/dist/Server/Services/UserWebhookService.js.map +1 -1
  670. package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js +12 -1
  671. package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js.map +1 -1
  672. package/build/dist/Server/Types/Database/AggregateBy.js +2 -0
  673. package/build/dist/Server/Types/Database/AggregateBy.js.map +1 -0
  674. package/build/dist/Server/Types/Database/AggregateResultUtil.js +90 -0
  675. package/build/dist/Server/Types/Database/AggregateResultUtil.js.map +1 -0
  676. package/build/dist/Server/Types/Database/JSONColumnQuery.js +14 -0
  677. package/build/dist/Server/Types/Database/JSONColumnQuery.js.map +1 -1
  678. package/build/dist/Server/Types/Database/QueryHelper.js +42 -0
  679. package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
  680. package/build/dist/Server/Types/Database/QueryUtil.js +18 -0
  681. package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
  682. package/build/dist/Server/Types/Workflow/Components/API/Utils.js +10 -1
  683. package/build/dist/Server/Types/Workflow/Components/API/Utils.js.map +1 -1
  684. package/build/dist/Server/Types/Workflow/Components/JavaScript.js +8 -0
  685. package/build/dist/Server/Types/Workflow/Components/JavaScript.js.map +1 -1
  686. package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js +8 -0
  687. package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js.map +1 -1
  688. package/build/dist/Server/Utils/AI/SRE/InvestigationGrader.js +15 -0
  689. package/build/dist/Server/Utils/AI/SRE/InvestigationGrader.js.map +1 -1
  690. package/build/dist/Server/Utils/AnalyticsDatabase/AttributeFilterStatement.js +266 -0
  691. package/build/dist/Server/Utils/AnalyticsDatabase/AttributeFilterStatement.js.map +1 -0
  692. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +134 -0
  693. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  694. package/build/dist/Server/Utils/DataSource/HttpFetch.js +8 -0
  695. package/build/dist/Server/Utils/DataSource/HttpFetch.js.map +1 -1
  696. package/build/dist/Server/Utils/Database/RelationIdUtil.js +31 -0
  697. package/build/dist/Server/Utils/Database/RelationIdUtil.js.map +1 -1
  698. package/build/dist/Server/Utils/Marketing/MarketingEventUtil.js +26 -8
  699. package/build/dist/Server/Utils/Marketing/MarketingEventUtil.js.map +1 -1
  700. package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js +42 -17
  701. package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js.map +1 -1
  702. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +9 -1
  703. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
  704. package/build/dist/Server/Utils/Monitor/Criteria/SyntheticMonitor.js +15 -2
  705. package/build/dist/Server/Utils/Monitor/Criteria/SyntheticMonitor.js.map +1 -1
  706. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +386 -271
  707. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  708. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +278 -64
  709. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  710. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +469 -350
  711. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  712. package/build/dist/Server/Utils/Monitor/MonitorResource.js +183 -44
  713. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  714. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +46 -3
  715. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -1
  716. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +18 -91
  717. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
  718. package/build/dist/Server/Utils/Monitor/PerEntityCriteriaFanOut.js +194 -0
  719. package/build/dist/Server/Utils/Monitor/PerEntityCriteriaFanOut.js.map +1 -0
  720. package/build/dist/Server/Utils/NetworkDevice/DeviceHealthAggregation.js +332 -0
  721. package/build/dist/Server/Utils/NetworkDevice/DeviceHealthAggregation.js.map +1 -0
  722. package/build/dist/Server/Utils/NetworkSite/NetworkSiteMaintenanceSuppression.js +279 -0
  723. package/build/dist/Server/Utils/NetworkSite/NetworkSiteMaintenanceSuppression.js.map +1 -0
  724. package/build/dist/Server/Utils/OnCallNotificationContext.js +415 -0
  725. package/build/dist/Server/Utils/OnCallNotificationContext.js.map +1 -0
  726. package/build/dist/Server/Utils/PrivateNetworkWebhookConfig.js +424 -0
  727. package/build/dist/Server/Utils/PrivateNetworkWebhookConfig.js.map +1 -0
  728. package/build/dist/Server/Utils/ResourceFeed/ResourceFeedUtil.js +108 -0
  729. package/build/dist/Server/Utils/ResourceFeed/ResourceFeedUtil.js.map +1 -0
  730. package/build/dist/Server/Utils/Response.js +12 -1
  731. package/build/dist/Server/Utils/Response.js.map +1 -1
  732. package/build/dist/Server/Utils/SSRFProtection.js +160 -58
  733. package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
  734. package/build/dist/Server/Utils/SecurityEvent/ConnectorErrorMessage.js +89 -0
  735. package/build/dist/Server/Utils/SecurityEvent/ConnectorErrorMessage.js.map +1 -0
  736. package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js +75 -234
  737. package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js.map +1 -1
  738. package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js +41 -16
  739. package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js.map +1 -1
  740. package/build/dist/Server/Utils/SecurityEvent/SecurityEventAlerting.js +217 -0
  741. package/build/dist/Server/Utils/SecurityEvent/SecurityEventAlerting.js.map +1 -0
  742. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/TaxiiClient.js +103 -0
  743. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/TaxiiClient.js.map +1 -0
  744. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelEnricher.js +168 -0
  745. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelEnricher.js.map +1 -0
  746. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.js +527 -0
  747. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.js.map +1 -0
  748. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.js +376 -0
  749. package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.js.map +1 -0
  750. package/build/dist/Server/Utils/StartServer.js +70 -44
  751. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  752. package/build/dist/Server/Utils/StatusPageSubscriberWebhook.js +3 -0
  753. package/build/dist/Server/Utils/StatusPageSubscriberWebhook.js.map +1 -1
  754. package/build/dist/Server/Utils/Telemetry/LlmMetricSpend.js +52 -3
  755. package/build/dist/Server/Utils/Telemetry/LlmMetricSpend.js.map +1 -1
  756. package/build/dist/Server/Utils/Telemetry/LlmSpan.js +24 -1
  757. package/build/dist/Server/Utils/Telemetry/LlmSpan.js.map +1 -1
  758. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js +327 -0
  759. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js.map +1 -0
  760. package/build/dist/Server/Utils/TwoFactorBackupCodeNotification.js +84 -0
  761. package/build/dist/Server/Utils/TwoFactorBackupCodeNotification.js.map +1 -0
  762. package/build/dist/Server/Utils/VM/VMAPI.js.map +1 -1
  763. package/build/dist/Server/Utils/VM/VMRunner.js +10 -1
  764. package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
  765. package/build/dist/Server/Utils/VendorAssets.js +29 -0
  766. package/build/dist/Server/Utils/VendorAssets.js.map +1 -1
  767. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +121 -6
  768. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  769. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +0 -10
  770. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
  771. package/build/dist/Types/API/URL.js +40 -10
  772. package/build/dist/Types/API/URL.js.map +1 -1
  773. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +8 -0
  774. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
  775. package/build/dist/Types/BaseDatabase/NotWildcard.js +72 -0
  776. package/build/dist/Types/BaseDatabase/NotWildcard.js.map +1 -0
  777. package/build/dist/Types/BaseDatabase/Wildcard.js +75 -0
  778. package/build/dist/Types/BaseDatabase/Wildcard.js.map +1 -0
  779. package/build/dist/Types/BaseDatabase/WildcardPattern.js +137 -0
  780. package/build/dist/Types/BaseDatabase/WildcardPattern.js.map +1 -0
  781. package/build/dist/Types/Database/DateColumnValue.js +125 -0
  782. package/build/dist/Types/Database/DateColumnValue.js.map +1 -0
  783. package/build/dist/Types/Database/TableColumn.js +18 -2
  784. package/build/dist/Types/Database/TableColumn.js.map +1 -1
  785. package/build/dist/Types/Date.js +31 -0
  786. package/build/dist/Types/Date.js.map +1 -1
  787. package/build/dist/Types/Email/EmailTemplateType.js +1 -0
  788. package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
  789. package/build/dist/Types/JSON.js +2 -0
  790. package/build/dist/Types/JSON.js.map +1 -1
  791. package/build/dist/Types/Log/LogQueryToFilter.js +111 -108
  792. package/build/dist/Types/Log/LogQueryToFilter.js.map +1 -1
  793. package/build/dist/Types/Monitor/DockerAlertTemplates.js +40 -16
  794. package/build/dist/Types/Monitor/DockerAlertTemplates.js.map +1 -1
  795. package/build/dist/Types/Monitor/HostAlertTemplates.js +29 -7
  796. package/build/dist/Types/Monitor/HostAlertTemplates.js.map +1 -1
  797. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +98 -4
  798. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  799. package/build/dist/Types/Monitor/MonitorStep.js +40 -0
  800. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  801. package/build/dist/Types/Monitor/PodmanAlertTemplates.js +36 -16
  802. package/build/dist/Types/Monitor/PodmanAlertTemplates.js.map +1 -1
  803. package/build/dist/Types/NetworkAutomation/RuleRunResult.js +90 -0
  804. package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -1
  805. package/build/dist/Types/NetworkSite/SiteHealthRollupPolicy.js +84 -0
  806. package/build/dist/Types/NetworkSite/SiteHealthRollupPolicy.js.map +1 -0
  807. package/build/dist/Types/Permission.js +354 -0
  808. package/build/dist/Types/Permission.js.map +1 -1
  809. package/build/dist/Types/SecurityEvent/ThreatIntelConstants.js +100 -0
  810. package/build/dist/Types/SecurityEvent/ThreatIntelConstants.js.map +1 -0
  811. package/build/dist/Types/SerializableObjectDictionary.js +8 -0
  812. package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
  813. package/build/dist/Types/Telemetry/LlmConventions.js +236 -0
  814. package/build/dist/Types/Telemetry/LlmConventions.js.map +1 -1
  815. package/build/dist/Types/Telemetry/LlmMetricConventions.js +197 -5
  816. package/build/dist/Types/Telemetry/LlmMetricConventions.js.map +1 -1
  817. package/build/dist/Types/Telemetry/SourceMap.js +9 -0
  818. package/build/dist/Types/Telemetry/SourceMap.js.map +1 -0
  819. package/build/dist/Types/Telemetry/TelemetrySearchQuery.js +661 -0
  820. package/build/dist/Types/Telemetry/TelemetrySearchQuery.js.map +1 -0
  821. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +12 -1
  822. package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -1
  823. package/build/dist/UI/Components/Dictionary/DictionaryFilterOperator.js +67 -0
  824. package/build/dist/UI/Components/Dictionary/DictionaryFilterOperator.js.map +1 -1
  825. package/build/dist/UI/Components/Icon/Icon.js +28 -1
  826. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  827. package/build/dist/UI/Components/LogsViewer/components/LogSearchBar.js +25 -4
  828. package/build/dist/UI/Components/LogsViewer/components/LogSearchBar.js.map +1 -1
  829. package/build/dist/UI/Components/LogsViewer/components/LogSearchHelp.js +36 -16
  830. package/build/dist/UI/Components/LogsViewer/components/LogSearchHelp.js.map +1 -1
  831. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +14 -2
  832. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
  833. package/build/dist/Utils/Metrics/MetricExplorerUrl.js +54 -9
  834. package/build/dist/Utils/Metrics/MetricExplorerUrl.js.map +1 -1
  835. package/build/dist/Utils/Monitor/InterfaceInventoryUtil.js +128 -0
  836. package/build/dist/Utils/Monitor/InterfaceInventoryUtil.js.map +1 -0
  837. package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +190 -0
  838. package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -0
  839. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +206 -28
  840. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
  841. package/build/dist/Utils/NetworkDevice/DeviceHealthStateUtil.js +14 -7
  842. package/build/dist/Utils/NetworkDevice/DeviceHealthStateUtil.js.map +1 -1
  843. package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -1
  844. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +34 -18
  845. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -1
  846. package/build/dist/Utils/NetworkDiscovery/PingMonitorBuilder.js +163 -0
  847. package/build/dist/Utils/NetworkDiscovery/PingMonitorBuilder.js.map +1 -0
  848. package/build/dist/Utils/NetworkDiscovery/RescanIntervalUtil.js +99 -0
  849. package/build/dist/Utils/NetworkDiscovery/RescanIntervalUtil.js.map +1 -0
  850. package/build/dist/Utils/NetworkDiscovery/ScanModeUtil.js +85 -0
  851. package/build/dist/Utils/NetworkDiscovery/ScanModeUtil.js.map +1 -0
  852. package/build/dist/Utils/NetworkDiscovery/SnmpScanConfigUtil.js +560 -0
  853. package/build/dist/Utils/NetworkDiscovery/SnmpScanConfigUtil.js.map +1 -0
  854. package/build/dist/Utils/NetworkSite/SiteMaintenanceUtil.js +56 -0
  855. package/build/dist/Utils/NetworkSite/SiteMaintenanceUtil.js.map +1 -0
  856. package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +185 -10
  857. package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -1
  858. package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js +248 -21
  859. package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js.map +1 -1
  860. package/build/dist/Utils/SecurityEvent/ThreatIntel/StixPatternParser.js +255 -0
  861. package/build/dist/Utils/SecurityEvent/ThreatIntel/StixPatternParser.js.map +1 -0
  862. package/build/dist/Utils/Telemetry/CrossSignalScope.js +27 -30
  863. package/build/dist/Utils/Telemetry/CrossSignalScope.js.map +1 -1
  864. package/build/dist/Utils/Telemetry/LlmMetricQuery.js +57 -1
  865. package/build/dist/Utils/Telemetry/LlmMetricQuery.js.map +1 -1
  866. package/package.json +2 -1
  867. package/Tests/Types/Log/LogQueryParser.test.ts +0 -186
  868. package/Types/Log/LogQueryParser.ts +0 -252
  869. package/build/dist/Types/Log/LogQueryParser.js +0 -200
  870. package/build/dist/Types/Log/LogQueryParser.js.map +0 -1
@@ -0,0 +1,682 @@
1
+ import UserWebAuthnAPI from "../../../Server/API/UserWebAuthnAPI";
2
+ import UserMiddleware from "../../../Server/Middleware/UserAuthorization";
3
+ import UserTwoFactorBackupCodeService from "../../../Server/Services/UserTwoFactorBackupCodeService";
4
+ import UserWebAuthnService from "../../../Server/Services/UserWebAuthnService";
5
+ import logger from "../../../Server/Utils/Logger";
6
+ import Response from "../../../Server/Utils/Response";
7
+ import {
8
+ NextFunction,
9
+ OneUptimeRequest,
10
+ OneUptimeResponse,
11
+ } from "../../../Server/Utils/Express";
12
+ import { mockRouter } from "./Helpers";
13
+ import { getJestSpyOn } from "../../Spy";
14
+ import Dictionary from "../../../Types/Dictionary";
15
+ import BadDataException from "../../../Types/Exception/BadDataException";
16
+ import { JSONObject } from "../../../Types/JSON";
17
+ import ObjectID from "../../../Types/ObjectID";
18
+ import {
19
+ afterEach,
20
+ beforeAll,
21
+ beforeEach,
22
+ describe,
23
+ expect,
24
+ test,
25
+ } from "@jest/globals";
26
+
27
+ /*
28
+ * POST /user-webauthn/verify-registration -- the moment a security key stops
29
+ * being a plugged-in piece of plastic and becomes a second factor the account
30
+ * will demand at every sign-in.
31
+ *
32
+ * WHY THIS ROUTE MINTS BACKUP CODES AT ALL
33
+ *
34
+ * Issue #3382: single-use backup codes shipped, and then essentially nobody
35
+ * had any, because the only thing in the product that ever wrote one was a
36
+ * button on the profile page that a user had to go and find. An account with
37
+ * zero codes gets no recovery affordance worth the name, so the login screen
38
+ * dead-ends exactly when it matters. The fix mints a set at ENROLMENT -- the
39
+ * one moment the user is already thinking about losing access -- and this
40
+ * route is one of the three places enrolment completes.
41
+ *
42
+ * A security key deserves it at least as much as an authenticator app does: an
43
+ * app can be restored from a phone backup, whereas a hardware key left in a
44
+ * taxi is simply gone, and nothing else on the account can stand in for it.
45
+ *
46
+ * WHAT THIS FILE GUARDS, all of which leave the suite green if nobody asserts
47
+ * them here.
48
+ *
49
+ * 1. THE FIRST KEY ON A BARE ACCOUNT ACTUALLY MINTS, AND THE CODES COME
50
+ * BACK. `generateForUserIfNone` returns the ONLY copy of the plaintext
51
+ * that will ever exist -- the rows store keyed digests -- so a handler
52
+ * that mints and then answers with an empty success has written ten
53
+ * credentials nobody will ever see. `getStatusForUser` would report "10
54
+ * backup codes" to a user who holds none of them, which looks exactly
55
+ * like the healthy state and is strictly worse than having none.
56
+ *
57
+ * 2. A KEY ADDED ALONGSIDE AN AUTHENTICATOR APP CHANGES NOTHING. The
58
+ * only-if-there-are-none rule is the whole reason this calls
59
+ * `generateForUserIfNone` and not `regenerateForUser`; the latter opens
60
+ * by DELETING, so wiring it in here would silently void the list the user
61
+ * printed when they set their phone up. `regenerateForUser` and
62
+ * `deleteAllForUser` are therefore asserted never to be reached.
63
+ *
64
+ * 3. A MINT FAILURE IS SWALLOWED. By the time this code runs the credential
65
+ * is already committed. Letting a backup-code error out through `next()`
66
+ * would report a failed registration for a registration that succeeded --
67
+ * and the user, believing it failed, would go round again with a key the
68
+ * account already trusts.
69
+ *
70
+ * 4. THE OWNER COMES FROM THE SESSION. There is no `:userId` anywhere on
71
+ * this path, which is what makes the route safe today -- but "safe
72
+ * because there is no parameter to abuse" evaporates the moment somebody
73
+ * reaches for `req.body["userId"]`. Minting for the wrong account is not
74
+ * a read: on an account that has no codes it CREATES a working set of
75
+ * sign-in credentials and hands them to the caller.
76
+ *
77
+ * 5. NOTHING IS MINTED FOR A REGISTRATION THAT FAILED. The mint sits after
78
+ * the `await` on `verifyRegistration` on purpose. Moved above it, a
79
+ * caller replaying a junk credential would still walk away with ten live
80
+ * backup codes for their own account -- a way to mint recovery
81
+ * credentials that never proves possession of anything.
82
+ *
83
+ * WHAT IS MOCKED, AND WHAT IS DELIBERATELY NOT
84
+ *
85
+ * `UserWebAuthnService.verifyRegistration` and
86
+ * `UserTwoFactorBackupCodeService.generateForUserIfNone` are spied on at the
87
+ * singletons, so nothing touches Postgres and the plaintext is a fixed set
88
+ * this file can compare against exactly.
89
+ *
90
+ * `CommonAPI.getDatabaseCommonInteractionProps` is NOT stubbed. It is the
91
+ * thing that decides which user this request is for, so stubbing it would make
92
+ * the ownership assertions circular -- they would prove only that a stub
93
+ * returns what it was told to. The real one runs against a request that
94
+ * carries an attacker's id in the body, the params and the query at once.
95
+ *
96
+ * `TwoFactorBackupCode` is NOT mocked either: `formatForDisplay` is the
97
+ * route's output contract with the screen that shows the codes once.
98
+ *
99
+ * SIBLING FILES, SO NOTHING HERE IS DUPLICATED
100
+ *
101
+ * - Common/Tests/Server/Services/UserTwoFactorBackupCodeService.test.ts owns
102
+ * `generateForUserIfNone` itself: the count check, the write loop and the
103
+ * by-id compensating delete.
104
+ * - Common/Tests/Server/API/UserTotpAuthAPI.test.ts owns the same minting on
105
+ * the authenticator-app enrolment route.
106
+ * - Common/Tests/Server/API/UserTwoFactorBackupCodeAPI.test.ts owns the
107
+ * self-service generate/status routes on the profile page.
108
+ * - App/Tests/FeatureSet/Identity/BackupCodeLoginVerification.test.ts owns
109
+ * SPENDING a code at sign-in.
110
+ *
111
+ * What is left, and what this file is entirely about, is the handler.
112
+ */
113
+
114
+ jest.mock("../../../Server/Utils/Express", () => {
115
+ return {
116
+ getRouter: () => {
117
+ return mockRouter;
118
+ },
119
+ };
120
+ });
121
+
122
+ jest.mock("../../../Server/Utils/Response", () => {
123
+ return {
124
+ sendEntityArrayResponse: jest.fn(),
125
+ sendJsonArrayResponse: jest.fn(),
126
+ sendJsonObjectResponse: jest.fn(),
127
+ sendEmptySuccessResponse: jest.fn(),
128
+ sendEntityResponse: jest.fn(),
129
+ sendErrorResponse: jest.fn(),
130
+ setNoCacheHeaders: jest.fn(),
131
+ };
132
+ });
133
+
134
+ const VERIFY_REGISTRATION_ROUTE: string = "/user-webauthn/verify-registration";
135
+
136
+ const CALLER_ID: ObjectID = new ObjectID(
137
+ "11111111-1111-4111-8111-111111111111",
138
+ );
139
+
140
+ /*
141
+ * The id an attacker puts in every part of the request they control, hoping
142
+ * the handler reads one of them instead of the session.
143
+ */
144
+ const SOMEBODY_ELSE_ID: string = "22222222-2222-4222-8222-222222222222";
145
+
146
+ /*
147
+ * What the service hands back when it mints. Fixed strings rather than real
148
+ * generated ones so the response assertion has an exact expectation: a
149
+ * formatter reduced to the identity function, or a handler returning a
150
+ * placeholder array of the right length, has to fail rather than agree with
151
+ * itself.
152
+ */
153
+ const MINTED_CODES: Array<string> = [
154
+ "2W9XKQ4M7B",
155
+ "H3TRZ5D8NC",
156
+ "P6JVG2YK4S",
157
+ "B8NQ7MXW3T",
158
+ "F5RD9CZH2K",
159
+ "T4KY6BVN8P",
160
+ "M2XS5GQJ7W",
161
+ "C9HB3NPR6D",
162
+ "Z7VM4TKG5X",
163
+ "K3PC8WYS9N",
164
+ ];
165
+
166
+ /*
167
+ * The same ten codes in the form the show-once screen renders as-is. Written
168
+ * out as literals rather than derived from `formatForDisplay`, so the
169
+ * assertion pins the contract instead of restating the implementation.
170
+ */
171
+ const MINTED_CODES_AS_DISPLAYED: Array<string> = [
172
+ "2W9XK-Q4M7B",
173
+ "H3TRZ-5D8NC",
174
+ "P6JVG-2YK4S",
175
+ "B8NQ7-MXW3T",
176
+ "F5RD9-CZH2K",
177
+ "T4KY6-BVN8P",
178
+ "M2XS5-GQJ7W",
179
+ "C9HB3-NPR6D",
180
+ "Z7VM4-TKG5X",
181
+ "K3PC8-WYS9N",
182
+ ];
183
+
184
+ /* A credential body shaped the way the browser's navigator.credentials returns one. */
185
+ const CREDENTIAL_FROM_THE_BROWSER: JSONObject = {
186
+ id: "credential-id-from-the-authenticator",
187
+ rawId: "credential-id-from-the-authenticator",
188
+ type: "public-key",
189
+ response: {
190
+ clientDataJSON: "client-data",
191
+ attestationObject: "attestation",
192
+ },
193
+ };
194
+
195
+ const KEY_NAME: string = "Yubikey on my keyring";
196
+
197
+ type RouteCallResult = {
198
+ thrownToNext: unknown;
199
+ nextCallCount: number;
200
+ };
201
+
202
+ type CallRouteOptions = {
203
+ params?: Dictionary<string> | undefined;
204
+ query?: Dictionary<string> | undefined;
205
+ body?: Dictionary<unknown> | undefined;
206
+
207
+ /*
208
+ * Spliced onto the request in place of the default signed-in caller. An
209
+ * EMPTY object is a request with no `userAuthorization` property at all,
210
+ * which is what reaches the handler if the middleware in front of it is ever
211
+ * removed or fails open.
212
+ */
213
+ authorization?: Dictionary<unknown> | undefined;
214
+ };
215
+
216
+ type CallVerifyRegistrationFunction = (
217
+ data?: CallRouteOptions,
218
+ ) => Promise<RouteCallResult>;
219
+
220
+ const callVerifyRegistration: CallVerifyRegistrationFunction = async (
221
+ data?: CallRouteOptions,
222
+ ): Promise<RouteCallResult> => {
223
+ const req: OneUptimeRequest = {
224
+ params: data?.params || {},
225
+ query: data?.query || {},
226
+ body: data?.body || {
227
+ credential: CREDENTIAL_FROM_THE_BROWSER,
228
+ name: KEY_NAME,
229
+ },
230
+ headers: {},
231
+ ...(data?.authorization || { userAuthorization: { userId: CALLER_ID } }),
232
+ } as unknown as OneUptimeRequest;
233
+
234
+ const res: OneUptimeResponse = {
235
+ send: jest.fn(),
236
+ json: jest.fn(),
237
+ setHeader: jest.fn(),
238
+ status: jest.fn().mockReturnThis(),
239
+ } as unknown as OneUptimeResponse;
240
+
241
+ const next: jest.Mock = jest.fn();
242
+
243
+ await mockRouter
244
+ .match("post", VERIFY_REGISTRATION_ROUTE)
245
+ .handlerFunction(req, res, next as unknown as NextFunction);
246
+
247
+ return {
248
+ thrownToNext: next.mock.calls[0] ? next.mock.calls[0][0] : undefined,
249
+ nextCallCount: next.mock.calls.length,
250
+ };
251
+ };
252
+
253
+ type AsMockFunction = (fn: unknown) => jest.Mock;
254
+
255
+ const asMock: AsMockFunction = (fn: unknown): jest.Mock => {
256
+ return fn as unknown as jest.Mock;
257
+ };
258
+
259
+ /* The body the route answered with, as the enrolment page receives it. */
260
+ type SentJsonObjectFunction = () => JSONObject;
261
+
262
+ const sentJsonObject: SentJsonObjectFunction = (): JSONObject => {
263
+ const call: Array<unknown> | undefined = asMock(
264
+ Response.sendJsonObjectResponse,
265
+ ).mock.calls[0];
266
+
267
+ return (call?.[2] as JSONObject) || {};
268
+ };
269
+
270
+ type MintArgument = { userId: ObjectID; count?: number | undefined };
271
+
272
+ type VerifyRegistrationArgument = {
273
+ credential: unknown;
274
+ name: string;
275
+ props: { userId?: ObjectID | undefined };
276
+ };
277
+
278
+ let verifyRegistrationSpy: jest.SpyInstance;
279
+ let mintSpy: jest.SpyInstance;
280
+ let regenerateSpy: jest.SpyInstance;
281
+ let deleteAllSpy: jest.SpyInstance;
282
+ let loggerErrorSpy: jest.SpyInstance;
283
+
284
+ beforeAll(() => {
285
+ mockRouter.routes.length = 0;
286
+ new UserWebAuthnAPI();
287
+ });
288
+
289
+ beforeEach(() => {
290
+ jest.clearAllMocks();
291
+
292
+ verifyRegistrationSpy = getJestSpyOn(
293
+ UserWebAuthnService,
294
+ "verifyRegistration",
295
+ );
296
+ verifyRegistrationSpy.mockResolvedValue(undefined as never);
297
+
298
+ /*
299
+ * The default is the interesting case: an account that has no codes, so the
300
+ * service mints and returns the plaintext.
301
+ */
302
+ mintSpy = getJestSpyOn(
303
+ UserTwoFactorBackupCodeService,
304
+ "generateForUserIfNone",
305
+ );
306
+ mintSpy.mockResolvedValue(MINTED_CODES as never);
307
+
308
+ /*
309
+ * Spied so the "never called" assertions are real. Left with an
310
+ * implementation that throws would be indistinguishable from a stub that was
311
+ * simply never reached, and both of these DESTROY the user's existing codes,
312
+ * so a call to either is the failure this route must not have.
313
+ */
314
+ regenerateSpy = getJestSpyOn(
315
+ UserTwoFactorBackupCodeService,
316
+ "regenerateForUser",
317
+ );
318
+ regenerateSpy.mockResolvedValue(MINTED_CODES as never);
319
+
320
+ deleteAllSpy = getJestSpyOn(
321
+ UserTwoFactorBackupCodeService,
322
+ "deleteAllForUser",
323
+ );
324
+ deleteAllSpy.mockResolvedValue(undefined as never);
325
+
326
+ loggerErrorSpy = getJestSpyOn(logger, "error").mockImplementation(
327
+ (): void => {
328
+ return undefined;
329
+ },
330
+ );
331
+ });
332
+
333
+ afterEach(() => {
334
+ jest.restoreAllMocks();
335
+ });
336
+
337
+ describe("POST /user-webauthn/verify-registration", () => {
338
+ describe("the route itself", () => {
339
+ test("is registered as a POST behind the user middleware", () => {
340
+ /*
341
+ * The handler takes the owning user from `userAuthorization`, which is
342
+ * put on the request by this middleware and by nothing else. Without it
343
+ * the id would be undefined for every caller, and asserted by IDENTITY
344
+ * rather than by counting because swapping in a different middleware
345
+ * keeps the count at one.
346
+ */
347
+ const route: { middlewares: Array<unknown> } = mockRouter.match(
348
+ "post",
349
+ VERIFY_REGISTRATION_ROUTE,
350
+ );
351
+
352
+ expect(route.middlewares).toEqual([UserMiddleware.getUserMiddleware]);
353
+ });
354
+
355
+ test("carries no route parameter that could name a user", () => {
356
+ /*
357
+ * This is the property the whole ownership story rests on: there is
358
+ * nothing in the path to point at somebody else. A future
359
+ * `/user-webauthn/:userId/verify-registration` -- added to let the admin
360
+ * page reuse the endpoint, say -- would hand any signed-in caller a way
361
+ * to mint a live set of backup codes onto a stranger's account, and the
362
+ * handler as written would not notice.
363
+ */
364
+ const parameterised: Array<string> = mockRouter.routes
365
+ .filter((route: { uri: string }): boolean => {
366
+ return route.uri === VERIFY_REGISTRATION_ROUTE;
367
+ })
368
+ .map((route: { uri: string }): string => {
369
+ return route.uri;
370
+ })
371
+ .filter((uri: string): boolean => {
372
+ return uri.includes(":");
373
+ });
374
+
375
+ expect(parameterised).toEqual([]);
376
+ });
377
+ });
378
+
379
+ describe("registering the first security key on an account with no codes", () => {
380
+ test("mints a set for the signed-in user", async () => {
381
+ const result: RouteCallResult = await callVerifyRegistration();
382
+
383
+ expect(result.nextCallCount).toBe(0);
384
+ expect(mintSpy).toHaveBeenCalledTimes(1);
385
+
386
+ const argument: MintArgument = mintSpy.mock.calls[0]![0] as MintArgument;
387
+
388
+ expect(argument.userId).toBe(CALLER_ID);
389
+ });
390
+
391
+ test("answers with the minted codes, formatted for display", async () => {
392
+ /*
393
+ * This response IS the only delivery of the plaintext. The rows hold
394
+ * keyed digests, so a handler that mints and then answers without the
395
+ * codes -- the old `sendEmptySuccessResponse` -- leaves the account
396
+ * holding ten credentials that nobody, including the user, can ever
397
+ * produce again.
398
+ */
399
+ await callVerifyRegistration();
400
+
401
+ expect(sentJsonObject()).toEqual({
402
+ backupCodes: MINTED_CODES_AS_DISPLAYED,
403
+ });
404
+ });
405
+
406
+ test("does not answer with an empty success", async () => {
407
+ /*
408
+ * The failure mode this route had before the fix, asserted separately
409
+ * from the payload: an empty success is a 200 the enrolment page cannot
410
+ * distinguish from "there were no codes to show", so it renders nothing
411
+ * and the codes are gone.
412
+ */
413
+ await callVerifyRegistration();
414
+
415
+ expect(Response.sendEmptySuccessResponse).not.toHaveBeenCalled();
416
+ expect(Response.sendJsonObjectResponse).toHaveBeenCalledTimes(1);
417
+ });
418
+
419
+ test("hyphenates without altering the code material", async () => {
420
+ /*
421
+ * `formatForDisplay` is cosmetic and `normalizeCode` strips the hyphen
422
+ * straight back out -- so the one thing that must survive the formatter
423
+ * is the characters themselves, in order. A formatter that dropped,
424
+ * reordered or re-cased a character would hand the user a list that
425
+ * cannot sign them in, and they would only find out at the worst
426
+ * possible moment.
427
+ */
428
+ await callVerifyRegistration();
429
+
430
+ const returned: Array<string> = sentJsonObject()[
431
+ "backupCodes"
432
+ ] as Array<string>;
433
+
434
+ expect(
435
+ returned.map((code: string): string => {
436
+ return code.replace(/-/g, "");
437
+ }),
438
+ ).toEqual(MINTED_CODES);
439
+ });
440
+ });
441
+
442
+ describe("registering a key alongside codes the user already has", () => {
443
+ test("answers with an empty array when the service reports there were codes already", async () => {
444
+ /*
445
+ * `null` is the service saying "this account already has a recovery
446
+ * route and I wrote nothing". The route must turn that into an empty
447
+ * list rather than into `null` or a missing property: the page branches
448
+ * on the array being non-empty, and `undefined.length` would take the
449
+ * whole enrolment screen down after a registration that succeeded.
450
+ */
451
+ mintSpy.mockResolvedValue(null as never);
452
+
453
+ const result: RouteCallResult = await callVerifyRegistration();
454
+
455
+ expect(result.nextCallCount).toBe(0);
456
+ expect(sentJsonObject()).toEqual({ backupCodes: [] });
457
+ });
458
+
459
+ test("never replaces or deletes the existing set", async () => {
460
+ /*
461
+ * The difference between the two service methods is the entire point of
462
+ * this call site. `regenerateForUser` opens by deleting everything the
463
+ * user holds, so reaching for it here would mean that adding a security
464
+ * key to an account that already has an authenticator app silently voids
465
+ * the printed list from that first enrolment -- codes the user has no
466
+ * reason to believe stopped working.
467
+ */
468
+ mintSpy.mockResolvedValue(null as never);
469
+
470
+ await callVerifyRegistration();
471
+
472
+ expect(regenerateSpy).not.toHaveBeenCalled();
473
+ expect(deleteAllSpy).not.toHaveBeenCalled();
474
+ });
475
+ });
476
+
477
+ describe("when minting fails", () => {
478
+ test("still reports the registration as successful", async () => {
479
+ /*
480
+ * The credential row is committed before this line runs. Surfacing the
481
+ * backup-code failure through `next()` would tell the user their key was
482
+ * not registered when it was, and they would register it again -- or,
483
+ * worse, conclude that security keys do not work here and turn the
484
+ * second factor off.
485
+ */
486
+ mintSpy.mockRejectedValue(
487
+ new Error("backup code table is unreachable") as never,
488
+ );
489
+
490
+ const result: RouteCallResult = await callVerifyRegistration();
491
+
492
+ expect(result.nextCallCount).toBe(0);
493
+ expect(result.thrownToNext).toBeUndefined();
494
+ expect(sentJsonObject()).toEqual({ backupCodes: [] });
495
+ });
496
+
497
+ test("logs the failure rather than losing it", async () => {
498
+ /*
499
+ * Swallowed is not the same as ignored. An account that quietly ends
500
+ * enrolment with no recovery codes looks identical from the outside to
501
+ * one that was never meant to have any, so the log line is the only
502
+ * trace an operator has that the mint was attempted and lost.
503
+ */
504
+ const mintFailure: Error = new Error("backup code table is unreachable");
505
+
506
+ mintSpy.mockRejectedValue(mintFailure as never);
507
+
508
+ await callVerifyRegistration();
509
+
510
+ expect(loggerErrorSpy).toHaveBeenCalledWith(mintFailure);
511
+ });
512
+ });
513
+
514
+ describe("who the codes are minted for", () => {
515
+ const IMPERSONATION_ATTEMPTS: Array<
516
+ [string, Required<Omit<CallRouteOptions, "authorization">>]
517
+ > = [
518
+ [
519
+ "a userId in the body",
520
+ {
521
+ params: {},
522
+ query: {},
523
+ body: {
524
+ credential: CREDENTIAL_FROM_THE_BROWSER,
525
+ name: KEY_NAME,
526
+ userId: SOMEBODY_ELSE_ID,
527
+ },
528
+ },
529
+ ],
530
+ [
531
+ "a userId in the route params",
532
+ {
533
+ params: { userId: SOMEBODY_ELSE_ID },
534
+ query: {},
535
+ body: {
536
+ credential: CREDENTIAL_FROM_THE_BROWSER,
537
+ name: KEY_NAME,
538
+ },
539
+ },
540
+ ],
541
+ [
542
+ "a userId in the query string",
543
+ {
544
+ params: {},
545
+ query: { userId: SOMEBODY_ELSE_ID },
546
+ body: {
547
+ credential: CREDENTIAL_FROM_THE_BROWSER,
548
+ name: KEY_NAME,
549
+ },
550
+ },
551
+ ],
552
+ [
553
+ "an id and a _id as well as a userId, plus a props.isRoot",
554
+ {
555
+ params: { id: SOMEBODY_ELSE_ID, userId: SOMEBODY_ELSE_ID },
556
+ query: { _id: SOMEBODY_ELSE_ID },
557
+ body: {
558
+ credential: CREDENTIAL_FROM_THE_BROWSER,
559
+ name: KEY_NAME,
560
+ id: SOMEBODY_ELSE_ID,
561
+ _id: SOMEBODY_ELSE_ID,
562
+ userId: SOMEBODY_ELSE_ID,
563
+ props: { isRoot: true, userId: SOMEBODY_ELSE_ID },
564
+ },
565
+ },
566
+ ],
567
+ ];
568
+
569
+ test.each(IMPERSONATION_ATTEMPTS)(
570
+ "mints for the session's user and not for %s",
571
+ async (
572
+ _name: string,
573
+ attempt: Required<Omit<CallRouteOptions, "authorization">>,
574
+ ) => {
575
+ /*
576
+ * Minting onto another account is not a read. On an account with no
577
+ * codes it CREATES a working set of sign-in credentials and returns
578
+ * the plaintext to the caller -- a second factor bypass handed over by
579
+ * a route the victim never touched.
580
+ */
581
+ await callVerifyRegistration(attempt);
582
+
583
+ const mintArgument: MintArgument = mintSpy.mock
584
+ .calls[0]![0] as MintArgument;
585
+
586
+ expect(mintArgument.userId).toBe(CALLER_ID);
587
+ expect(mintArgument.userId.toString()).not.toBe(SOMEBODY_ELSE_ID);
588
+
589
+ /* The credential is saved for the same user, from the same source. */
590
+ const registrationArgument: VerifyRegistrationArgument =
591
+ verifyRegistrationSpy.mock.calls[0]![0] as VerifyRegistrationArgument;
592
+
593
+ expect(registrationArgument.props.userId).toBe(CALLER_ID);
594
+ },
595
+ );
596
+
597
+ test("mints nothing when the request carries no authenticated user", async () => {
598
+ /*
599
+ * What the handler sees if the middleware in front of it is removed or
600
+ * fails open. The guard matters because `generateForUserIfNone` with an
601
+ * undefined userId does not throw at the service boundary -- it counts
602
+ * rows matching `userId: undefined`, which is a query over the WHOLE
603
+ * table, finds somebody else's codes and concludes this account already
604
+ * has a recovery route. On an empty table it would instead write ten
605
+ * ownerless rows.
606
+ */
607
+ const result: RouteCallResult = await callVerifyRegistration({
608
+ authorization: {},
609
+ });
610
+
611
+ expect(mintSpy).not.toHaveBeenCalled();
612
+ expect(regenerateSpy).not.toHaveBeenCalled();
613
+ expect(result.nextCallCount).toBe(0);
614
+ expect(sentJsonObject()).toEqual({ backupCodes: [] });
615
+ });
616
+ });
617
+
618
+ describe("when the registration itself fails", () => {
619
+ test("mints nothing and answers nothing", async () => {
620
+ /*
621
+ * The mint sits AFTER the await on `verifyRegistration` deliberately.
622
+ * Hoisted above it -- or moved into a `Promise.all` alongside it -- a
623
+ * caller posting a junk credential would still walk away with ten live
624
+ * backup codes for their own account: a route that mints sign-in
625
+ * credentials without ever proving possession of an authenticator.
626
+ */
627
+ const registrationFailure: BadDataException = new BadDataException(
628
+ "Registration verification failed",
629
+ );
630
+
631
+ verifyRegistrationSpy.mockRejectedValue(registrationFailure as never);
632
+
633
+ const result: RouteCallResult = await callVerifyRegistration();
634
+
635
+ expect(result.thrownToNext).toBe(registrationFailure);
636
+ expect(result.nextCallCount).toBe(1);
637
+ expect(mintSpy).not.toHaveBeenCalled();
638
+ expect(Response.sendJsonObjectResponse).not.toHaveBeenCalled();
639
+ });
640
+
641
+ test("mints only once the credential is saved", async () => {
642
+ /*
643
+ * The ordering stated as an invariant rather than inferred from the
644
+ * failure case above, because a refactor that fires the mint first and
645
+ * merely happens to swallow it on a rejected registration would pass
646
+ * that test and still be wrong: the codes would exist, and the response
647
+ * would carry them, for a registration that never completed.
648
+ */
649
+ const callOrder: Array<string> = [];
650
+
651
+ verifyRegistrationSpy.mockImplementation(async (): Promise<void> => {
652
+ await Promise.resolve();
653
+ callOrder.push("verify-registration");
654
+ });
655
+
656
+ mintSpy.mockImplementation(async (): Promise<Array<string>> => {
657
+ callOrder.push("mint");
658
+ return MINTED_CODES;
659
+ });
660
+
661
+ await callVerifyRegistration();
662
+
663
+ expect(callOrder).toEqual(["verify-registration", "mint"]);
664
+ });
665
+
666
+ test("passes the credential and the key's name straight through", async () => {
667
+ /*
668
+ * Cheap, and it keeps the tests above honest: every assertion here is
669
+ * driven through the real handler, so if the body were not reaching
670
+ * `verifyRegistration` at all the enrolment being tested would be a
671
+ * fiction.
672
+ */
673
+ await callVerifyRegistration();
674
+
675
+ const argument: VerifyRegistrationArgument = verifyRegistrationSpy.mock
676
+ .calls[0]![0] as VerifyRegistrationArgument;
677
+
678
+ expect(argument.credential).toEqual(CREDENTIAL_FROM_THE_BROWSER);
679
+ expect(argument.name).toBe(KEY_NAME);
680
+ });
681
+ });
682
+ });