@oneuptime/common 14.0.94 → 14.0.96

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 (289) hide show
  1. package/Models/AnalyticsModels/ExceptionInstance.d.mts +2 -0
  2. package/Models/AnalyticsModels/ExceptionInstance.d.ts +2 -0
  3. package/Models/AnalyticsModels/ExceptionInstance.js +7 -0
  4. package/Models/AnalyticsModels/Log.d.mts +2 -0
  5. package/Models/AnalyticsModels/Log.d.ts +2 -0
  6. package/Models/AnalyticsModels/Log.js +7 -0
  7. package/Models/AnalyticsModels/SecurityEvent.d.mts +8 -0
  8. package/Models/AnalyticsModels/SecurityEvent.d.ts +8 -0
  9. package/Models/AnalyticsModels/SecurityEvent.js +55 -0
  10. package/Models/AnalyticsModels/Span.d.mts +4 -0
  11. package/Models/AnalyticsModels/Span.d.ts +4 -0
  12. package/Models/AnalyticsModels/Span.js +63 -0
  13. package/Models/DatabaseModels/CustomNotificationChannel.d.mts +16 -0
  14. package/Models/DatabaseModels/CustomNotificationChannel.d.ts +16 -0
  15. package/Models/DatabaseModels/CustomNotificationChannel.js +337 -0
  16. package/Models/DatabaseModels/CustomNotificationChannel.mjs +2 -0
  17. package/Models/DatabaseModels/DashboardPlaylist.d.mts +16 -0
  18. package/Models/DatabaseModels/DashboardPlaylist.d.ts +16 -0
  19. package/Models/DatabaseModels/DashboardPlaylist.js +314 -0
  20. package/Models/DatabaseModels/DashboardPlaylist.mjs +2 -0
  21. package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +14 -37
  22. package/Models/DatabaseModels/DatabaseBaseModel/OnCallRuleBaseModel.d.mts +1 -0
  23. package/Models/DatabaseModels/DatabaseBaseModel/OnCallRuleBaseModel.d.ts +1 -0
  24. package/Models/DatabaseModels/DatabaseBaseModel/OnCallRuleBaseModel.js +27 -3
  25. package/Models/DatabaseModels/DetectionRuleException.d.mts +25 -0
  26. package/Models/DatabaseModels/DetectionRuleException.d.ts +25 -0
  27. package/Models/DatabaseModels/DetectionRuleException.js +412 -0
  28. package/Models/DatabaseModels/DetectionRuleException.mjs +2 -0
  29. package/Models/DatabaseModels/GlobalConfig.d.mts +5 -0
  30. package/Models/DatabaseModels/GlobalConfig.d.ts +5 -0
  31. package/Models/DatabaseModels/GlobalConfig.js +107 -0
  32. package/Models/DatabaseModels/Index.js +8 -0
  33. package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.mts +2 -0
  34. package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.ts +2 -0
  35. package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +40 -0
  36. package/Models/DatabaseModels/SecurityTelemetrySource.d.mts +21 -0
  37. package/Models/DatabaseModels/SecurityTelemetrySource.d.ts +21 -0
  38. package/Models/DatabaseModels/SecurityTelemetrySource.js +357 -0
  39. package/Models/DatabaseModels/SecurityTelemetrySource.mjs +2 -0
  40. package/Models/DatabaseModels/TeamComplianceSetting.js +2 -2
  41. package/Models/DatabaseModels/TeamPermission.js +5 -7
  42. package/Models/DatabaseModels/UserNotificationRule.d.mts +3 -0
  43. package/Models/DatabaseModels/UserNotificationRule.d.ts +3 -0
  44. package/Models/DatabaseModels/UserNotificationRule.js +67 -0
  45. package/Models/DatabaseModels/UserNotificationSetting.d.mts +1 -0
  46. package/Models/DatabaseModels/UserNotificationSetting.d.ts +1 -0
  47. package/Models/DatabaseModels/UserNotificationSetting.js +26 -0
  48. package/Models/DatabaseModels/UserOnCallLogTimeline.d.mts +3 -0
  49. package/Models/DatabaseModels/UserOnCallLogTimeline.d.ts +3 -0
  50. package/Models/DatabaseModels/UserOnCallLogTimeline.js +53 -0
  51. package/Types/AI/AIChatPermissionMode.js +11 -5
  52. package/Types/AI/ResourceCardFacts.d.mts +11 -0
  53. package/Types/AI/ResourceCardFacts.d.ts +11 -0
  54. package/Types/AI/ResourceCardFacts.js +80 -0
  55. package/Types/AI/ResourceCardFacts.mjs +4 -0
  56. package/Types/AnalyticsDatabase/TableColumn.d.mts +4 -0
  57. package/Types/AnalyticsDatabase/TableColumn.d.ts +4 -0
  58. package/Types/AnalyticsDatabase/TableColumn.js +7 -0
  59. package/Types/AuditLog/Export/AuditLogExportDestinationCatalog.d.mts +2 -0
  60. package/Types/AuditLog/Export/AuditLogExportDestinationCatalog.d.ts +2 -0
  61. package/Types/AuditLog/Export/AuditLogExportDestinationCatalog.js +4 -0
  62. package/Types/Backup/BackupDestinationCatalog.d.mts +2 -0
  63. package/Types/Backup/BackupDestinationCatalog.d.ts +2 -0
  64. package/Types/Backup/BackupDestinationCatalog.js +8 -0
  65. package/Types/CallAndSMS/CallAndSmsGatewayPayload.d.mts +25 -0
  66. package/Types/CallAndSMS/CallAndSmsGatewayPayload.d.ts +25 -0
  67. package/Types/CallAndSMS/CallAndSmsGatewayPayload.js +86 -0
  68. package/Types/CallAndSMS/CallAndSmsGatewayPayload.mjs +6 -0
  69. package/Types/CallAndSMS/CallAndSmsProvider.d.mts +23 -0
  70. package/Types/CallAndSMS/CallAndSmsProvider.d.ts +23 -0
  71. package/Types/CallAndSMS/CallAndSmsProvider.js +107 -0
  72. package/Types/CallAndSMS/CallAndSmsProvider.mjs +7 -0
  73. package/Types/CloudConnection/CloudConnectionCatalog.d.mts +2 -0
  74. package/Types/CloudConnection/CloudConnectionCatalog.d.ts +2 -0
  75. package/Types/CloudConnection/CloudConnectionCatalog.js +4 -0
  76. package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.d.mts +95 -0
  77. package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.d.ts +95 -0
  78. package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.js +236 -0
  79. package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.mjs +16 -0
  80. package/Types/Dashboard/DashboardPlaylist.d.mts +21 -0
  81. package/Types/Dashboard/DashboardPlaylist.d.ts +21 -0
  82. package/Types/Dashboard/DashboardPlaylist.js +197 -0
  83. package/Types/Dashboard/DashboardPlaylist.mjs +19 -0
  84. package/Types/Database/TableColumn.d.mts +8 -0
  85. package/Types/Database/TableColumn.d.ts +8 -0
  86. package/Types/Database/TableColumn.js +69 -23
  87. package/Types/Database/TableColumn.mjs +1 -0
  88. package/Types/HeldPermissions.d.mts +2 -0
  89. package/Types/HeldPermissions.d.ts +2 -0
  90. package/Types/HeldPermissions.js +32 -8
  91. package/Types/Icon/IconProp.d.mts +3 -0
  92. package/Types/Icon/IconProp.d.ts +3 -0
  93. package/Types/Icon/IconProp.js +4 -0
  94. package/Types/JSONFunctions.js +16 -1
  95. package/Types/LlmObservability/LlmConnectionCatalog.d.mts +2 -0
  96. package/Types/LlmObservability/LlmConnectionCatalog.d.ts +2 -0
  97. package/Types/LlmObservability/LlmConnectionCatalog.js +8 -0
  98. package/Types/Monitor/MonitorType.js +5 -4
  99. package/Types/Monitor/TelemetryAlertRule.d.mts +111 -0
  100. package/Types/Monitor/TelemetryAlertRule.d.ts +111 -0
  101. package/Types/Monitor/TelemetryAlertRule.js +886 -0
  102. package/Types/Monitor/TelemetryAlertRule.mjs +5 -0
  103. package/Types/Monitor/TelemetryRulePreview.d.mts +57 -0
  104. package/Types/Monitor/TelemetryRulePreview.d.ts +57 -0
  105. package/Types/Monitor/TelemetryRulePreview.js +190 -0
  106. package/Types/Monitor/TelemetryRulePreview.mjs +6 -0
  107. package/Types/OnCallDutyPolicy/EveryNewEventRules.d.mts +23 -0
  108. package/Types/OnCallDutyPolicy/EveryNewEventRules.d.ts +23 -0
  109. package/Types/OnCallDutyPolicy/EveryNewEventRules.js +105 -0
  110. package/Types/OnCallDutyPolicy/EveryNewEventRules.mjs +9 -0
  111. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.d.mts +3 -0
  112. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.d.ts +3 -0
  113. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.js +23 -8
  114. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.mjs +2 -0
  115. package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.d.mts +47 -0
  116. package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.d.ts +47 -0
  117. package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.js +122 -0
  118. package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.mjs +12 -0
  119. package/Types/OnCallDutyPolicy/OnCallRuleWhenToPage.d.mts +2 -1
  120. package/Types/OnCallDutyPolicy/OnCallRuleWhenToPage.d.ts +2 -1
  121. package/Types/OnCallDutyPolicy/OnCallRuleWhenToPage.js +10 -1
  122. package/Types/Permission.d.mts +10 -0
  123. package/Types/Permission.d.ts +10 -0
  124. package/Types/Permission.js +83 -19
  125. package/Types/ProviderLogo/ProviderLogo.d.mts +87 -0
  126. package/Types/ProviderLogo/ProviderLogo.d.ts +87 -0
  127. package/Types/ProviderLogo/ProviderLogo.js +215 -0
  128. package/Types/ProviderLogo/ProviderLogo.mjs +6 -0
  129. package/Types/PushNotification/PushNotificationsTurnedOff.d.mts +3 -0
  130. package/Types/PushNotification/PushNotificationsTurnedOff.d.ts +3 -0
  131. package/Types/PushNotification/PushNotificationsTurnedOff.js +32 -0
  132. package/Types/PushNotification/PushNotificationsTurnedOff.mjs +4 -0
  133. package/Types/RollingTime/RollingTimeUtil.js +20 -10
  134. package/Types/Runbook/RunbookTriggerType.d.mts +2 -1
  135. package/Types/Runbook/RunbookTriggerType.d.ts +2 -1
  136. package/Types/Runbook/RunbookTriggerType.js +5 -1
  137. package/Types/SecurityCase/SecurityCaseContext.d.mts +188 -0
  138. package/Types/SecurityCase/SecurityCaseContext.d.ts +188 -0
  139. package/Types/SecurityCase/SecurityCaseContext.js +165 -0
  140. package/Types/SecurityCase/SecurityCaseContext.mjs +30 -0
  141. package/Types/SecurityCase/SecurityEntityRisk.d.mts +11 -0
  142. package/Types/SecurityCase/SecurityEntityRisk.d.ts +11 -0
  143. package/Types/SecurityCase/SecurityEntityRisk.js +9 -1
  144. package/Types/SecurityCase/SecurityEntityRisk.mjs +1 -0
  145. package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.d.mts +2 -0
  146. package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.d.ts +2 -0
  147. package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +9 -0
  148. package/Types/SecurityEvent/Destinations/SecurityEventDestinationCatalog.d.mts +2 -0
  149. package/Types/SecurityEvent/Destinations/SecurityEventDestinationCatalog.d.ts +2 -0
  150. package/Types/SecurityEvent/Destinations/SecurityEventDestinationCatalog.js +5 -0
  151. package/Types/SecurityEvent/DetectionRetrohunt.d.mts +38 -0
  152. package/Types/SecurityEvent/DetectionRetrohunt.d.ts +38 -0
  153. package/Types/SecurityEvent/DetectionRetrohunt.js +147 -0
  154. package/Types/SecurityEvent/DetectionRetrohunt.mjs +10 -0
  155. package/Types/SecurityEvent/DetectionRuleDataKind.d.mts +5 -1
  156. package/Types/SecurityEvent/DetectionRuleDataKind.d.ts +5 -1
  157. package/Types/SecurityEvent/DetectionRuleDataKind.js +42 -0
  158. package/Types/SecurityEvent/DetectionRuleException.d.mts +65 -0
  159. package/Types/SecurityEvent/DetectionRuleException.d.ts +65 -0
  160. package/Types/SecurityEvent/DetectionRuleException.js +441 -0
  161. package/Types/SecurityEvent/DetectionRuleException.mjs +24 -0
  162. package/Types/SecurityEvent/DetectionRuleLibrary.js +330 -0
  163. package/Types/SecurityEvent/NormalizedSecurityEvent.d.mts +5 -0
  164. package/Types/SecurityEvent/NormalizedSecurityEvent.d.ts +5 -0
  165. package/Types/SecurityEvent/SecurityAttackCampaign.d.mts +31 -0
  166. package/Types/SecurityEvent/SecurityAttackCampaign.d.ts +31 -0
  167. package/Types/SecurityEvent/SecurityAttackCampaign.js +81 -0
  168. package/Types/SecurityEvent/SecurityAttackCampaign.mjs +8 -0
  169. package/Types/SecurityEvent/SecurityEventRequestOutcome.d.mts +28 -0
  170. package/Types/SecurityEvent/SecurityEventRequestOutcome.d.ts +28 -0
  171. package/Types/SecurityEvent/SecurityEventRequestOutcome.js +78 -0
  172. package/Types/SecurityEvent/SecurityEventRequestOutcome.mjs +6 -0
  173. package/Types/SecurityEvent/SecurityTelemetrySource.d.mts +39 -0
  174. package/Types/SecurityEvent/SecurityTelemetrySource.d.ts +39 -0
  175. package/Types/SecurityEvent/SecurityTelemetrySource.js +127 -0
  176. package/Types/SecurityEvent/SecurityTelemetrySource.mjs +12 -0
  177. package/Types/SecurityEvent/TurnOnRecommended.d.mts +2 -0
  178. package/Types/SecurityEvent/TurnOnRecommended.d.ts +2 -0
  179. package/Types/SecurityEvent/TurnOnRecommended.js +7 -0
  180. package/Types/SecurityPlaybook/SecurityPlaybookAction.d.mts +7 -1
  181. package/Types/SecurityPlaybook/SecurityPlaybookAction.d.ts +7 -1
  182. package/Types/SecurityPlaybook/SecurityPlaybookAction.js +46 -0
  183. package/Types/SecurityPlaybook/SecurityPlaybookAction.mjs +1 -0
  184. package/Types/SecurityPlaybook/SecurityPlaybookStep.d.mts +10 -0
  185. package/Types/SecurityPlaybook/SecurityPlaybookStep.d.ts +10 -0
  186. package/Types/SecurityPlaybook/SecurityPlaybookStep.js +37 -1
  187. package/Types/SecurityPlaybook/SecurityPlaybookStep.mjs +1 -0
  188. package/Types/SecurityPlaybook/SecurityPlaybookTemplates.js +17 -0
  189. package/Types/Team/ComplianceNotificationChannel.d.mts +2 -1
  190. package/Types/Team/ComplianceNotificationChannel.d.ts +2 -1
  191. package/Types/Team/ComplianceNotificationChannel.js +10 -1
  192. package/Types/Team/ComplianceRule.d.mts +8 -3
  193. package/Types/Team/ComplianceRule.d.ts +8 -3
  194. package/Types/Team/ComplianceRule.js +34 -22
  195. package/Types/Team/TeamComplianceStatus.d.mts +1 -0
  196. package/Types/Team/TeamComplianceStatus.d.ts +1 -0
  197. package/Types/Telemetry/OpenTelemetryGuides.d.mts +52 -0
  198. package/Types/Telemetry/OpenTelemetryGuides.d.ts +52 -0
  199. package/Types/Telemetry/OpenTelemetryGuides.js +419 -0
  200. package/Types/Telemetry/OpenTelemetryGuides.mjs +17 -0
  201. package/Types/Telemetry/TelemetrySavedViewState.d.mts +1 -0
  202. package/Types/Telemetry/TelemetrySavedViewState.d.ts +1 -0
  203. package/Types/Telemetry/TraceHealth.d.mts +24 -0
  204. package/Types/Telemetry/TraceHealth.d.ts +24 -0
  205. package/Types/Telemetry/TraceHealth.js +97 -0
  206. package/Types/Telemetry/TraceHealth.mjs +4 -0
  207. package/Types/Telemetry/TraceSpanType.d.mts +90 -0
  208. package/Types/Telemetry/TraceSpanType.d.ts +90 -0
  209. package/Types/Telemetry/TraceSpanType.js +238 -0
  210. package/Types/Telemetry/TraceSpanType.mjs +19 -0
  211. package/Types/Theme/ThemePreference.d.mts +26 -0
  212. package/Types/Theme/ThemePreference.d.ts +26 -0
  213. package/Types/Theme/ThemePreference.js +104 -0
  214. package/Types/Theme/ThemePreference.mjs +12 -0
  215. package/Types/Workflow/Component.d.mts +3 -0
  216. package/Types/Workflow/Component.d.ts +3 -0
  217. package/Types/Workflow/Components/Discord.js +2 -0
  218. package/Types/Workflow/Components/Mattermost.js +2 -0
  219. package/Types/Workflow/Components/MicrosoftTeams.js +2 -0
  220. package/Types/Workflow/Components/Slack.js +2 -0
  221. package/Types/Workflow/Components/Telegram.js +2 -0
  222. package/Types/Workflow/Components.js +6 -0
  223. package/Types/Workflow/Templates.js +5 -3
  224. package/Utils/ColorContrast.d.mts +0 -3
  225. package/Utils/ColorContrast.d.ts +0 -3
  226. package/Utils/ColorContrast.js +3 -41
  227. package/Utils/ColorContrast.mjs +0 -2
  228. package/Utils/NameInitials.d.mts +5 -0
  229. package/Utils/NameInitials.d.ts +5 -0
  230. package/Utils/NameInitials.js +92 -0
  231. package/Utils/NameInitials.mjs +6 -0
  232. package/Utils/OldestKeyCursor.d.mts +7 -0
  233. package/Utils/OldestKeyCursor.d.ts +7 -0
  234. package/Utils/OldestKeyCursor.js +68 -0
  235. package/Utils/OldestKeyCursor.mjs +2 -0
  236. package/Utils/Schema/OpenApiMetadataRegistry.d.mts +4 -0
  237. package/Utils/Schema/OpenApiMetadataRegistry.d.ts +4 -0
  238. package/Utils/Schema/OpenApiMetadataRegistry.js +20 -0
  239. package/Utils/Schema/OpenApiMetadataRegistry.mjs +2 -0
  240. package/Utils/Schema/Zod.js +6 -0
  241. package/Utils/SecurityCase/SecurityCaseImpactFacts.d.mts +41 -0
  242. package/Utils/SecurityCase/SecurityCaseImpactFacts.d.ts +41 -0
  243. package/Utils/SecurityCase/SecurityCaseImpactFacts.js +215 -0
  244. package/Utils/SecurityCase/SecurityCaseImpactFacts.mjs +6 -0
  245. package/Utils/SecurityCase/SecurityCaseStoryItems.d.mts +46 -0
  246. package/Utils/SecurityCase/SecurityCaseStoryItems.d.ts +46 -0
  247. package/Utils/SecurityCase/SecurityCaseStoryItems.js +327 -0
  248. package/Utils/SecurityCase/SecurityCaseStoryItems.mjs +17 -0
  249. package/Utils/SecurityEvent/LogParsers/SecurityLogLine.d.mts +5 -0
  250. package/Utils/SecurityEvent/LogParsers/SecurityLogLine.d.ts +5 -0
  251. package/Utils/SecurityEvent/LogParsers/SecurityLogLine.js +22 -2
  252. package/Utils/SecurityEvent/LogParsers/SecurityLogLine.mjs +2 -0
  253. package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.d.mts +20 -0
  254. package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.d.ts +20 -0
  255. package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.js +347 -31
  256. package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.mjs +11 -0
  257. package/Utils/SecurityEvent/RequestFollowUp.d.mts +4 -0
  258. package/Utils/SecurityEvent/RequestFollowUp.d.ts +4 -0
  259. package/Utils/SecurityEvent/RequestFollowUp.js +127 -0
  260. package/Utils/SecurityEvent/RequestFollowUp.mjs +3 -0
  261. package/Utils/SecurityEvent/RequestOutcome.d.mts +80 -0
  262. package/Utils/SecurityEvent/RequestOutcome.d.ts +80 -0
  263. package/Utils/SecurityEvent/RequestOutcome.js +371 -0
  264. package/Utils/SecurityEvent/RequestOutcome.mjs +18 -0
  265. package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.d.mts +76 -0
  266. package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.d.ts +76 -0
  267. package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.js +348 -0
  268. package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.mjs +15 -0
  269. package/Utils/SecurityEvent/TelemetryScan/FlowSignals.d.mts +61 -0
  270. package/Utils/SecurityEvent/TelemetryScan/FlowSignals.d.ts +61 -0
  271. package/Utils/SecurityEvent/TelemetryScan/FlowSignals.js +260 -0
  272. package/Utils/SecurityEvent/TelemetryScan/FlowSignals.mjs +17 -0
  273. package/Utils/SecurityEvent/TelemetryScan/RumSignals.d.mts +30 -0
  274. package/Utils/SecurityEvent/TelemetryScan/RumSignals.d.ts +30 -0
  275. package/Utils/SecurityEvent/TelemetryScan/RumSignals.js +134 -0
  276. package/Utils/SecurityEvent/TelemetryScan/RumSignals.mjs +8 -0
  277. package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.d.mts +40 -0
  278. package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.d.ts +40 -0
  279. package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.js +190 -0
  280. package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.mjs +6 -0
  281. package/Utils/SecurityEvent/TelemetryScan/TraceSignals.d.mts +57 -0
  282. package/Utils/SecurityEvent/TelemetryScan/TraceSignals.d.ts +57 -0
  283. package/Utils/SecurityEvent/TelemetryScan/TraceSignals.js +491 -0
  284. package/Utils/SecurityEvent/TelemetryScan/TraceSignals.mjs +27 -0
  285. package/Utils/Telemetry/EntrySpan.d.mts +8 -0
  286. package/Utils/Telemetry/EntrySpan.d.ts +8 -0
  287. package/Utils/Telemetry/EntrySpan.js +53 -0
  288. package/Utils/Telemetry/EntrySpan.mjs +4 -0
  289. package/package.json +1 -1
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.pickLastChange = pickLastChange;
37
+ exports.toImpactPeers = toImpactPeers;
38
+ exports.buildInternetExposure = buildInternetExposure;
39
+ exports.summarizeImpact = summarizeImpact;
40
+ exports.getImpactRecordsInOrder = getImpactRecordsInOrder;
41
+ const SecurityCaseContext_1 = require("../../Types/SecurityCase/SecurityCaseContext");
42
+ const SecurityConnection_1 = require("../../Types/SecurityCase/SecurityConnection");
43
+ const SecurityEventRequestOutcome_1 = __importStar(require("../../Types/SecurityEvent/SecurityEventRequestOutcome"));
44
+ const SecurityConnectionMatch_1 = require("./SecurityConnectionMatch");
45
+ function timeOf(value) {
46
+ const time = new Date(value).getTime();
47
+ return Number.isNaN(time) ? NaN : time;
48
+ }
49
+ /*
50
+ * The change that tells most about the attack: the latest at or before the
51
+ * case's first detection (the release it found), else the first after it.
52
+ */
53
+ function pickLastChange(changes, firstDetectedAt) {
54
+ const dated = changes.filter((change) => {
55
+ return !Number.isNaN(timeOf(change.time));
56
+ });
57
+ if (dated.length === 0) {
58
+ return null;
59
+ }
60
+ const firstDetection = firstDetectedAt
61
+ ? firstDetectedAt.getTime()
62
+ : Number.POSITIVE_INFINITY;
63
+ let before = null;
64
+ let after = null;
65
+ for (const change of dated) {
66
+ const time = timeOf(change.time);
67
+ if (time <= firstDetection) {
68
+ if (!before || time > timeOf(before.time)) {
69
+ before = change;
70
+ }
71
+ }
72
+ else if (!after || time < timeOf(after.time)) {
73
+ after = change;
74
+ }
75
+ }
76
+ if (before) {
77
+ return Object.assign(Object.assign({}, before), { isBeforeFirstDetection: true });
78
+ }
79
+ return after ? Object.assign(Object.assign({}, after), { isBeforeFirstDetection: false }) : null;
80
+ }
81
+ /*
82
+ * The service map's rows for one section as peers: known ones first, the
83
+ * busiest calls first, then by name; at most `max`.
84
+ */
85
+ function toImpactPeers(rows, max = SecurityCaseContext_1.SECURITY_CASE_IMPACT_MAX_PEERS) {
86
+ return [...rows]
87
+ .sort((first, second) => {
88
+ if (first.otherKnown !== second.otherKnown) {
89
+ return first.otherKnown ? -1 : 1;
90
+ }
91
+ const byCalls = (second.callCount || 0) - (first.callCount || 0);
92
+ if (byCalls !== 0) {
93
+ return byCalls;
94
+ }
95
+ const firstName = first.otherName || first.otherKey;
96
+ const secondName = second.otherName || second.otherKey;
97
+ return firstName < secondName ? -1 : firstName > secondName ? 1 : 0;
98
+ })
99
+ .slice(0, Math.max(0, max))
100
+ .map((row) => {
101
+ return {
102
+ key: row.otherKey,
103
+ name: row.otherName || row.otherKey,
104
+ type: row.otherType || "",
105
+ callCount: row.callCount,
106
+ errorCount: row.errorCount,
107
+ };
108
+ });
109
+ }
110
+ // The outcomes that mean a request reached the app, not just its door.
111
+ const REACHED_APP_RANK = (0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(SecurityEventRequestOutcome_1.default.ReachedApp);
112
+ /*
113
+ * Whether OneUptime has seen the case's records reachable from the
114
+ * internet, and why: requests from public addresses that reached the app
115
+ * (the furthest-reaching first, then the earliest), then public addresses the
116
+ * records report. Each address is evidence once; at most `max` pieces.
117
+ */
118
+ function buildInternetExposure(data) {
119
+ const max = Math.max(0, data.max === undefined ? SecurityCaseContext_1.SECURITY_CASE_IMPACT_MAX_EVIDENCE : data.max);
120
+ const evidence = [];
121
+ const seen = new Set();
122
+ const requests = data.requests
123
+ .filter((request) => {
124
+ return ((0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(request.requestOutcome) >= REACHED_APP_RANK &&
125
+ (0, SecurityConnectionMatch_1.getSecurityAddressScope)(request.address) === SecurityConnectionMatch_1.SecurityAddressScope.Public);
126
+ })
127
+ .sort((first, second) => {
128
+ const byRank = (0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(second.requestOutcome) -
129
+ (0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(first.requestOutcome);
130
+ return byRank !== 0
131
+ ? byRank
132
+ : first.time.getTime() - second.time.getTime();
133
+ });
134
+ for (const request of requests) {
135
+ const address = (0, SecurityConnectionMatch_1.canonicalAddress)(request.address) || "";
136
+ if (!address || seen.has(address) || evidence.length >= max) {
137
+ continue;
138
+ }
139
+ seen.add(address);
140
+ evidence.push({
141
+ kind: SecurityCaseContext_1.SecurityCaseExposureEvidenceKind.PublicRequestReachedApp,
142
+ address,
143
+ time: request.time.toISOString(),
144
+ requestOutcome: request.requestOutcome,
145
+ });
146
+ }
147
+ for (const record of data.recordAddresses) {
148
+ const address = (0, SecurityConnectionMatch_1.canonicalAddress)(record.address) || "";
149
+ if (!address ||
150
+ seen.has(address) ||
151
+ evidence.length >= max ||
152
+ (0, SecurityConnectionMatch_1.getSecurityAddressScope)(address) !== SecurityConnectionMatch_1.SecurityAddressScope.Public) {
153
+ continue;
154
+ }
155
+ seen.add(address);
156
+ evidence.push({
157
+ kind: SecurityCaseContext_1.SecurityCaseExposureEvidenceKind.PublicAddress,
158
+ address,
159
+ recordName: record.recordName,
160
+ });
161
+ }
162
+ return {
163
+ exposure: evidence.length > 0
164
+ ? SecurityCaseContext_1.SecurityCaseInternetExposure.Yes
165
+ : SecurityCaseContext_1.SecurityCaseInternetExposure.Unknown,
166
+ evidence,
167
+ };
168
+ }
169
+ function summarizeImpact(impact) {
170
+ var _a, _b, _c, _d;
171
+ const downstream = new Set();
172
+ const upstream = new Set();
173
+ const teams = new Set();
174
+ const users = new Set();
175
+ let monitorCount = 0;
176
+ let hasDependencies = false;
177
+ for (const record of impact.records) {
178
+ if (record.calls || record.calledBy) {
179
+ hasDependencies = true;
180
+ }
181
+ for (const peer of record.calls || []) {
182
+ downstream.add(peer.key);
183
+ }
184
+ for (const peer of record.calledBy || []) {
185
+ upstream.add(peer.key);
186
+ }
187
+ monitorCount += ((_a = record.monitors) === null || _a === void 0 ? void 0 : _a.count) || 0;
188
+ for (const team of ((_b = record.owners) === null || _b === void 0 ? void 0 : _b.teams) || []) {
189
+ teams.add(team.id);
190
+ }
191
+ for (const user of ((_c = record.owners) === null || _c === void 0 ? void 0 : _c.users) || []) {
192
+ users.add(user.id);
193
+ }
194
+ }
195
+ return {
196
+ recordCount: impact.records.length,
197
+ downstreamCount: downstream.size,
198
+ upstreamCount: upstream.size,
199
+ monitorCount,
200
+ statusPageCount: ((_d = impact.statusPages) === null || _d === void 0 ? void 0 : _d.length) || 0,
201
+ ownerTeamCount: teams.size,
202
+ ownerUserCount: users.size,
203
+ isInternetFacing: impact.internet.exposure === SecurityCaseContext_1.SecurityCaseInternetExposure.Yes,
204
+ hasDependencies,
205
+ };
206
+ }
207
+ // The records the impact lists first: exact connections, then by name.
208
+ function getImpactRecordsInOrder(records) {
209
+ return [...records].sort((first, second) => {
210
+ if (first.certainty !== second.certainty) {
211
+ return first.certainty === SecurityConnection_1.SecurityConnectionCertainty.Exact ? -1 : 1;
212
+ }
213
+ return first.name < second.name ? -1 : first.name > second.name ? 1 : 0;
214
+ });
215
+ }
@@ -0,0 +1,6 @@
1
+ import commonJsModule from "./SecurityCaseImpactFacts.js";
2
+ export const buildInternetExposure = commonJsModule.buildInternetExposure;
3
+ export const getImpactRecordsInOrder = commonJsModule.getImpactRecordsInOrder;
4
+ export const pickLastChange = commonJsModule.pickLastChange;
5
+ export const summarizeImpact = commonJsModule.summarizeImpact;
6
+ export const toImpactPeers = commonJsModule.toImpactPeers;
@@ -0,0 +1,46 @@
1
+ import { JSONObject, JSONValue } from "../../Types/JSON.mjs";
2
+ import { SecurityCaseStoryFilter, SecurityCaseStoryItemJson, SecurityCaseStoryItemKind } from "../../Types/SecurityCase/SecurityCaseContext.mjs";
3
+ export interface StoryEventRow {
4
+ time: Date;
5
+ eventUid: string;
6
+ className: string;
7
+ message: string;
8
+ severityName: string;
9
+ severityId: number;
10
+ principalUser: string;
11
+ principalHost: string;
12
+ principalIp: string;
13
+ targetResource: string;
14
+ requestOutcome: string;
15
+ traceId: string;
16
+ spanId: string;
17
+ sessionId: string;
18
+ attackKind: string;
19
+ exceptionFingerprint: string;
20
+ exceptionType: string;
21
+ exceptionMessage: string;
22
+ }
23
+ export declare const STORY_EVENT_ATTRIBUTE_KEYS: {
24
+ attackKind: string;
25
+ exceptionFingerprint: string;
26
+ exceptionType: string;
27
+ exceptionMessage: string;
28
+ };
29
+ export declare function cutStoryText(value: string | null | undefined, limit?: number): string;
30
+ export declare function firstLine(value: string | null | undefined): string;
31
+ export declare function readClickhouseTime(value: JSONValue | undefined): Date | null;
32
+ export declare function readStoryEventRow(row: JSONObject): StoryEventRow | null;
33
+ export declare function getStoryEventPrincipal(row: StoryEventRow): string;
34
+ export declare function getStoryEventRunKey(row: StoryEventRow): string;
35
+ export declare function isMoreTelling(candidate: StoryEventRow, current: StoryEventRow): boolean;
36
+ export declare function runStoryEvents(rows: ReadonlyArray<StoryEventRow>, gapInMinutes?: number): Array<SecurityCaseStoryItemJson>;
37
+ export declare function buildStoryExceptionItems(rows: ReadonlyArray<StoryEventRow>): Array<SecurityCaseStoryItemJson>;
38
+ export declare const SECURITY_CASE_STORY_KEEP_ORDER: ReadonlyArray<SecurityCaseStoryItemKind>;
39
+ export declare const SECURITY_CASE_STORY_SAME_TIME_ORDER: ReadonlyArray<SecurityCaseStoryItemKind>;
40
+ export declare function compareStoryItems(first: SecurityCaseStoryItemJson, second: SecurityCaseStoryItemJson): number;
41
+ export declare function mergeStoryItems(items: ReadonlyArray<SecurityCaseStoryItemJson>, max: number): {
42
+ items: Array<SecurityCaseStoryItemJson>;
43
+ isTruncated: boolean;
44
+ };
45
+ export declare function filterStoryItems(items: ReadonlyArray<SecurityCaseStoryItemJson>, filter: SecurityCaseStoryFilter): Array<SecurityCaseStoryItemJson>;
46
+ export declare function countStoryItemsByFilter(items: ReadonlyArray<SecurityCaseStoryItemJson>): Record<SecurityCaseStoryFilter, number>;
@@ -0,0 +1,46 @@
1
+ import { JSONObject, JSONValue } from "../../Types/JSON";
2
+ import { SecurityCaseStoryFilter, SecurityCaseStoryItemJson, SecurityCaseStoryItemKind } from "../../Types/SecurityCase/SecurityCaseContext";
3
+ export interface StoryEventRow {
4
+ time: Date;
5
+ eventUid: string;
6
+ className: string;
7
+ message: string;
8
+ severityName: string;
9
+ severityId: number;
10
+ principalUser: string;
11
+ principalHost: string;
12
+ principalIp: string;
13
+ targetResource: string;
14
+ requestOutcome: string;
15
+ traceId: string;
16
+ spanId: string;
17
+ sessionId: string;
18
+ attackKind: string;
19
+ exceptionFingerprint: string;
20
+ exceptionType: string;
21
+ exceptionMessage: string;
22
+ }
23
+ export declare const STORY_EVENT_ATTRIBUTE_KEYS: {
24
+ attackKind: string;
25
+ exceptionFingerprint: string;
26
+ exceptionType: string;
27
+ exceptionMessage: string;
28
+ };
29
+ export declare function cutStoryText(value: string | null | undefined, limit?: number): string;
30
+ export declare function firstLine(value: string | null | undefined): string;
31
+ export declare function readClickhouseTime(value: JSONValue | undefined): Date | null;
32
+ export declare function readStoryEventRow(row: JSONObject): StoryEventRow | null;
33
+ export declare function getStoryEventPrincipal(row: StoryEventRow): string;
34
+ export declare function getStoryEventRunKey(row: StoryEventRow): string;
35
+ export declare function isMoreTelling(candidate: StoryEventRow, current: StoryEventRow): boolean;
36
+ export declare function runStoryEvents(rows: ReadonlyArray<StoryEventRow>, gapInMinutes?: number): Array<SecurityCaseStoryItemJson>;
37
+ export declare function buildStoryExceptionItems(rows: ReadonlyArray<StoryEventRow>): Array<SecurityCaseStoryItemJson>;
38
+ export declare const SECURITY_CASE_STORY_KEEP_ORDER: ReadonlyArray<SecurityCaseStoryItemKind>;
39
+ export declare const SECURITY_CASE_STORY_SAME_TIME_ORDER: ReadonlyArray<SecurityCaseStoryItemKind>;
40
+ export declare function compareStoryItems(first: SecurityCaseStoryItemJson, second: SecurityCaseStoryItemJson): number;
41
+ export declare function mergeStoryItems(items: ReadonlyArray<SecurityCaseStoryItemJson>, max: number): {
42
+ items: Array<SecurityCaseStoryItemJson>;
43
+ isTruncated: boolean;
44
+ };
45
+ export declare function filterStoryItems(items: ReadonlyArray<SecurityCaseStoryItemJson>, filter: SecurityCaseStoryFilter): Array<SecurityCaseStoryItemJson>;
46
+ export declare function countStoryItemsByFilter(items: ReadonlyArray<SecurityCaseStoryItemJson>): Record<SecurityCaseStoryFilter, number>;
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SECURITY_CASE_STORY_SAME_TIME_ORDER = exports.SECURITY_CASE_STORY_KEEP_ORDER = exports.STORY_EVENT_ATTRIBUTE_KEYS = void 0;
4
+ exports.cutStoryText = cutStoryText;
5
+ exports.firstLine = firstLine;
6
+ exports.readClickhouseTime = readClickhouseTime;
7
+ exports.readStoryEventRow = readStoryEventRow;
8
+ exports.getStoryEventPrincipal = getStoryEventPrincipal;
9
+ exports.getStoryEventRunKey = getStoryEventRunKey;
10
+ exports.isMoreTelling = isMoreTelling;
11
+ exports.runStoryEvents = runStoryEvents;
12
+ exports.buildStoryExceptionItems = buildStoryExceptionItems;
13
+ exports.compareStoryItems = compareStoryItems;
14
+ exports.mergeStoryItems = mergeStoryItems;
15
+ exports.filterStoryItems = filterStoryItems;
16
+ exports.countStoryItemsByFilter = countStoryItemsByFilter;
17
+ const SecurityCaseContext_1 = require("../../Types/SecurityCase/SecurityCaseContext");
18
+ const SecurityEventRequestOutcome_1 = require("../../Types/SecurityEvent/SecurityEventRequestOutcome");
19
+ // The attributes the story reads off an event, beside its columns.
20
+ exports.STORY_EVENT_ATTRIBUTE_KEYS = {
21
+ attackKind: "web.attack.kind",
22
+ exceptionFingerprint: "oneuptime.exception.fingerprint",
23
+ exceptionType: "oneuptime.exception.type",
24
+ exceptionMessage: "oneuptime.exception.message",
25
+ };
26
+ function cutStoryText(value, limit = SecurityCaseContext_1.SECURITY_CASE_STORY_MAX_TEXT_LENGTH) {
27
+ const text = (value || "").trim();
28
+ return text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
29
+ }
30
+ // The first line of a text a person wrote, for a note's item.
31
+ function firstLine(value) {
32
+ const text = (value || "").trim();
33
+ const end = text.indexOf("\n");
34
+ return cutStoryText(end === -1 ? text : text.slice(0, end));
35
+ }
36
+ function readText(value) {
37
+ if (value === null || value === undefined) {
38
+ return "";
39
+ }
40
+ return (typeof value === "string" ? value : String(value)).trim();
41
+ }
42
+ /*
43
+ * A ClickHouse time as JavaScript reads it: DateTime64 is written
44
+ * "2026-10-27 06:45:00.123456789", in UTC, with no zone.
45
+ */
46
+ function readClickhouseTime(value) {
47
+ const text = readText(value);
48
+ if (!text) {
49
+ return null;
50
+ }
51
+ const date = new Date(text.includes("T") || text.endsWith("Z")
52
+ ? text
53
+ : `${text.replace(" ", "T")}Z`);
54
+ return Number.isNaN(date.getTime()) ? null : date;
55
+ }
56
+ // A row of the events read, or null when it has no usable time.
57
+ function readStoryEventRow(row) {
58
+ const time = readClickhouseTime(row["time"]);
59
+ if (!time) {
60
+ return null;
61
+ }
62
+ const attributes = row["attributes"] &&
63
+ typeof row["attributes"] === "object" &&
64
+ !Array.isArray(row["attributes"])
65
+ ? row["attributes"]
66
+ : {};
67
+ const severityId = Number(row["severityId"]);
68
+ return {
69
+ time,
70
+ eventUid: readText(row["eventUid"]),
71
+ className: readText(row["className"]),
72
+ message: readText(row["message"]),
73
+ severityName: readText(row["severityName"]),
74
+ severityId: Number.isFinite(severityId) ? severityId : 0,
75
+ principalUser: readText(row["principalUser"]),
76
+ principalHost: readText(row["principalHost"]),
77
+ principalIp: readText(row["principalIp"]),
78
+ targetResource: readText(row["targetResource"]),
79
+ requestOutcome: readText(row["requestOutcome"]),
80
+ traceId: readText(row["traceId"]),
81
+ spanId: readText(row["spanId"]),
82
+ sessionId: readText(row["sessionId"]),
83
+ attackKind: readText(attributes[exports.STORY_EVENT_ATTRIBUTE_KEYS.attackKind]),
84
+ exceptionFingerprint: readText(attributes[exports.STORY_EVENT_ATTRIBUTE_KEYS.exceptionFingerprint]),
85
+ exceptionType: readText(attributes[exports.STORY_EVENT_ATTRIBUTE_KEYS.exceptionType]),
86
+ exceptionMessage: readText(attributes[exports.STORY_EVENT_ATTRIBUTE_KEYS.exceptionMessage]),
87
+ };
88
+ }
89
+ /*
90
+ * Who acted, as a run is told by: the address the event came from, else the
91
+ * user, else the host. '' when the event names none.
92
+ */
93
+ function getStoryEventPrincipal(row) {
94
+ return row.principalIp || row.principalUser || row.principalHost || "";
95
+ }
96
+ // Events that are told together share this.
97
+ function getStoryEventRunKey(row) {
98
+ return [
99
+ row.className.toLowerCase(),
100
+ getStoryEventPrincipal(row).toLowerCase(),
101
+ row.attackKind.toLowerCase(),
102
+ ].join("\u0000");
103
+ }
104
+ /*
105
+ * Whether one event tells a run better than another: its request got
106
+ * further, then it is more severe, then it came first.
107
+ */
108
+ function isMoreTelling(candidate, current) {
109
+ const candidateRank = (0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(candidate.requestOutcome);
110
+ const currentRank = (0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(current.requestOutcome);
111
+ if (candidateRank !== currentRank) {
112
+ return candidateRank > currentRank;
113
+ }
114
+ if (candidate.severityId !== current.severityId) {
115
+ return candidate.severityId > current.severityId;
116
+ }
117
+ return candidate.time.getTime() < current.time.getTime();
118
+ }
119
+ function byTime(first, second) {
120
+ return first.time.getTime() - second.time.getTime();
121
+ }
122
+ /*
123
+ * The events as runs, each one item: in time order, an event joins the run
124
+ * of its kind that its predecessor ended no more than `gapInMinutes` before,
125
+ * and starts a new one otherwise.
126
+ */
127
+ function runStoryEvents(rows, gapInMinutes = SecurityCaseContext_1.SECURITY_CASE_STORY_RUN_GAP_IN_MINUTES) {
128
+ const gapInMs = Math.max(0, gapInMinutes) * 60 * 1000;
129
+ const runs = [];
130
+ const openRuns = new Map();
131
+ for (const row of [...rows].sort(byTime)) {
132
+ const key = getStoryEventRunKey(row);
133
+ const open = openRuns.get(key);
134
+ const last = open
135
+ ? open.rows[open.rows.length - 1]
136
+ : undefined;
137
+ if (open && last && row.time.getTime() - last.time.getTime() <= gapInMs) {
138
+ open.rows.push(row);
139
+ if (isMoreTelling(row, open.lead)) {
140
+ open.lead = row;
141
+ }
142
+ continue;
143
+ }
144
+ const run = { key, rows: [row], lead: row };
145
+ runs.push(run);
146
+ openRuns.set(key, run);
147
+ }
148
+ return runs.map((run, index) => {
149
+ return toEventsItem(run, index);
150
+ });
151
+ }
152
+ function toEventsItem(run, index) {
153
+ const first = run.rows[0];
154
+ const last = run.rows[run.rows.length - 1];
155
+ const lead = run.lead;
156
+ const isRun = run.rows.length > 1;
157
+ const item = {
158
+ key: `events:${first.eventUid || first.time.toISOString()}:${index}`,
159
+ kind: SecurityCaseContext_1.SecurityCaseStoryItemKind.Events,
160
+ time: first.time.toISOString(),
161
+ title: cutStoryText(lead.message || lead.className || "Security event"),
162
+ count: run.rows.length,
163
+ links: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (lead.eventUid ? { eventUid: lead.eventUid } : {})), (lead.traceId ? { traceId: lead.traceId } : {})), (lead.spanId ? { spanId: lead.spanId } : {})), (lead.sessionId ? { sessionId: lead.sessionId } : {})), (getStoryEventPrincipal(lead)
164
+ ? { observable: getStoryEventPrincipal(lead) }
165
+ : {})),
166
+ };
167
+ if (isRun) {
168
+ item.endTime = last.time.toISOString();
169
+ }
170
+ if (lead.className) {
171
+ item.className = lead.className;
172
+ }
173
+ if (lead.severityName) {
174
+ item.severityName = lead.severityName;
175
+ }
176
+ if (lead.requestOutcome) {
177
+ item.requestOutcome = lead.requestOutcome;
178
+ }
179
+ if (lead.targetResource && lead.targetResource !== item.title) {
180
+ item.detail = cutStoryText(lead.targetResource);
181
+ }
182
+ if (isRun) {
183
+ const outcomes = {};
184
+ for (const row of run.rows) {
185
+ outcomes[row.requestOutcome] = (outcomes[row.requestOutcome] || 0) + 1;
186
+ }
187
+ item.outcomes = outcomes;
188
+ }
189
+ return item;
190
+ }
191
+ /*
192
+ * One item for each exception the events' requests threw, at the first
193
+ * time it was thrown, counting the events whose request threw it.
194
+ */
195
+ function buildStoryExceptionItems(rows) {
196
+ const byFingerprint = new Map();
197
+ for (const row of [...rows].sort(byTime)) {
198
+ if (!row.exceptionFingerprint) {
199
+ continue;
200
+ }
201
+ const seen = byFingerprint.get(row.exceptionFingerprint);
202
+ if (seen) {
203
+ seen.count += 1;
204
+ continue;
205
+ }
206
+ byFingerprint.set(row.exceptionFingerprint, { first: row, count: 1 });
207
+ }
208
+ return Array.from(byFingerprint.entries()).map(([fingerprint, seen]) => {
209
+ const item = {
210
+ key: `exception:${fingerprint}`,
211
+ kind: SecurityCaseContext_1.SecurityCaseStoryItemKind.Exception,
212
+ time: seen.first.time.toISOString(),
213
+ title: cutStoryText(seen.first.exceptionType || "Exception"),
214
+ count: seen.count,
215
+ links: Object.assign(Object.assign(Object.assign({ exceptionFingerprint: fingerprint }, (seen.first.traceId ? { traceId: seen.first.traceId } : {})), (seen.first.spanId ? { spanId: seen.first.spanId } : {})), (seen.first.sessionId ? { sessionId: seen.first.sessionId } : {})),
216
+ };
217
+ if (seen.first.exceptionMessage) {
218
+ item.detail = cutStoryText(seen.first.exceptionMessage);
219
+ }
220
+ return item;
221
+ });
222
+ }
223
+ /*
224
+ * What a story keeps when it holds too much, most telling first: how the
225
+ * case opened and where it stands, then its detections, the incidents it set
226
+ * off and the exceptions its requests threw, then the runs of events (the
227
+ * furthest-reaching first), then alerts, changes, playbook runs and notes.
228
+ */
229
+ exports.SECURITY_CASE_STORY_KEEP_ORDER = [
230
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.CaseOpened,
231
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Milestone,
232
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Detection,
233
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Incident,
234
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Exception,
235
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Events,
236
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Alert,
237
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Change,
238
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.PlaybookRun,
239
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Note,
240
+ ];
241
+ /*
242
+ * Items at the same moment, in the order they are read: what changed, then
243
+ * what fired, then what it set off, then the response.
244
+ */
245
+ exports.SECURITY_CASE_STORY_SAME_TIME_ORDER = [
246
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Change,
247
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Events,
248
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Exception,
249
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Detection,
250
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.CaseOpened,
251
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Incident,
252
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Alert,
253
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.PlaybookRun,
254
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Note,
255
+ SecurityCaseContext_1.SecurityCaseStoryItemKind.Milestone,
256
+ ];
257
+ function timeOf(item) {
258
+ const time = new Date(item.time).getTime();
259
+ return Number.isNaN(time) ? 0 : time;
260
+ }
261
+ // How telling an item is among those of its own kind: the higher, the more.
262
+ function weightOf(item) {
263
+ return (0, SecurityEventRequestOutcome_1.getRequestOutcomeRank)(item.requestOutcome) * 1000 + (item.count || 1);
264
+ }
265
+ function compareStoryItems(first, second) {
266
+ const byTimeDifference = timeOf(first) - timeOf(second);
267
+ if (byTimeDifference !== 0) {
268
+ return byTimeDifference;
269
+ }
270
+ const byKind = exports.SECURITY_CASE_STORY_SAME_TIME_ORDER.indexOf(first.kind) -
271
+ exports.SECURITY_CASE_STORY_SAME_TIME_ORDER.indexOf(second.kind);
272
+ if (byKind !== 0) {
273
+ return byKind;
274
+ }
275
+ return first.key < second.key ? -1 : first.key > second.key ? 1 : 0;
276
+ }
277
+ /*
278
+ * The story's items, each once (by key), oldest first, at most `max` of
279
+ * them - and whether any were left out.
280
+ */
281
+ function mergeStoryItems(items, max) {
282
+ const unique = new Map();
283
+ for (const item of items) {
284
+ if (!unique.has(item.key)) {
285
+ unique.set(item.key, item);
286
+ }
287
+ }
288
+ let kept = Array.from(unique.values());
289
+ const isTruncated = kept.length > Math.max(0, max);
290
+ if (isTruncated) {
291
+ kept = [...kept]
292
+ .sort((first, second) => {
293
+ const byKind = exports.SECURITY_CASE_STORY_KEEP_ORDER.indexOf(first.kind) -
294
+ exports.SECURITY_CASE_STORY_KEEP_ORDER.indexOf(second.kind);
295
+ if (byKind !== 0) {
296
+ return byKind;
297
+ }
298
+ const byWeight = weightOf(second) - weightOf(first);
299
+ return byWeight !== 0 ? byWeight : compareStoryItems(first, second);
300
+ })
301
+ .slice(0, Math.max(0, max));
302
+ }
303
+ return { items: kept.sort(compareStoryItems), isTruncated };
304
+ }
305
+ // The items a filter shows: all of them, or those of one group.
306
+ function filterStoryItems(items, filter) {
307
+ if (filter === SecurityCaseContext_1.SecurityCaseStoryFilter.All) {
308
+ return [...items];
309
+ }
310
+ return items.filter((item) => {
311
+ return SecurityCaseContext_1.SECURITY_CASE_STORY_FILTER_OF_KIND[item.kind] === filter;
312
+ });
313
+ }
314
+ // How many items each filter shows, for the counts beside them.
315
+ function countStoryItemsByFilter(items) {
316
+ const counts = {
317
+ [SecurityCaseContext_1.SecurityCaseStoryFilter.All]: items.length,
318
+ [SecurityCaseContext_1.SecurityCaseStoryFilter.Attack]: 0,
319
+ [SecurityCaseContext_1.SecurityCaseStoryFilter.Changes]: 0,
320
+ [SecurityCaseContext_1.SecurityCaseStoryFilter.IncidentsAndAlerts]: 0,
321
+ [SecurityCaseContext_1.SecurityCaseStoryFilter.Response]: 0,
322
+ };
323
+ for (const item of items) {
324
+ counts[SecurityCaseContext_1.SECURITY_CASE_STORY_FILTER_OF_KIND[item.kind]] += 1;
325
+ }
326
+ return counts;
327
+ }
@@ -0,0 +1,17 @@
1
+ import commonJsModule from "./SecurityCaseStoryItems.js";
2
+ export const SECURITY_CASE_STORY_KEEP_ORDER = commonJsModule.SECURITY_CASE_STORY_KEEP_ORDER;
3
+ export const SECURITY_CASE_STORY_SAME_TIME_ORDER = commonJsModule.SECURITY_CASE_STORY_SAME_TIME_ORDER;
4
+ export const STORY_EVENT_ATTRIBUTE_KEYS = commonJsModule.STORY_EVENT_ATTRIBUTE_KEYS;
5
+ export const buildStoryExceptionItems = commonJsModule.buildStoryExceptionItems;
6
+ export const compareStoryItems = commonJsModule.compareStoryItems;
7
+ export const countStoryItemsByFilter = commonJsModule.countStoryItemsByFilter;
8
+ export const cutStoryText = commonJsModule.cutStoryText;
9
+ export const filterStoryItems = commonJsModule.filterStoryItems;
10
+ export const firstLine = commonJsModule.firstLine;
11
+ export const getStoryEventPrincipal = commonJsModule.getStoryEventPrincipal;
12
+ export const getStoryEventRunKey = commonJsModule.getStoryEventRunKey;
13
+ export const isMoreTelling = commonJsModule.isMoreTelling;
14
+ export const mergeStoryItems = commonJsModule.mergeStoryItems;
15
+ export const readClickhouseTime = commonJsModule.readClickhouseTime;
16
+ export const readStoryEventRow = commonJsModule.readStoryEventRow;
17
+ export const runStoryEvents = commonJsModule.runStoryEvents;
@@ -11,10 +11,14 @@ export interface SecurityLogLine {
11
11
  serviceName?: string | undefined;
12
12
  resourceId?: string | undefined;
13
13
  resourceType?: string | undefined;
14
+ traceId?: string | undefined;
15
+ spanId?: string | undefined;
16
+ sessionId?: string | undefined;
14
17
  }
15
18
  export declare const MAX_TEXT_LINE_LENGTH: number;
16
19
  export declare const MAX_JSON_LINE_LENGTH: number;
17
20
  export declare const MAX_EVENT_MESSAGE_LENGTH: number;
21
+ export declare const MAX_TELEMETRY_ID_LENGTH: number;
18
22
  export declare function cutText(text: string, limit: number): string;
19
23
  export declare function readWord(text: string, from: number): string;
20
24
  export declare function readIpAddress(value: string): string;
@@ -48,3 +52,4 @@ export interface LogSecurityEventInput {
48
52
  mitreTechniques?: Array<string> | undefined;
49
53
  }
50
54
  export declare function buildLogSecurityEvent(input: LogSecurityEventInput): NormalizedSecurityEvent;
55
+ export declare function readTelemetryId(value: string | undefined): string;