@oneuptime/common 12.0.15 → 12.0.17
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.
- package/Models/AnalyticsModels/Index.ts +10 -0
- package/Models/AnalyticsModels/LogCountBaseline.ts +174 -0
- package/Models/AnalyticsModels/SecurityEvent.ts +794 -0
- package/Models/AnalyticsModels/Span.ts +29 -1
- package/Models/AnalyticsModels/SpanCountBaseline.ts +198 -0
- package/Models/DatabaseModels/Alert.ts +42 -0
- package/Models/DatabaseModels/AlertMeasurement.ts +1114 -0
- package/Models/DatabaseModels/AlertMeasurementValue.ts +501 -0
- package/Models/DatabaseModels/AlertStateTimeline.ts +10 -2
- package/Models/DatabaseModels/BillingPaymentMethod.ts +8 -10
- package/Models/DatabaseModels/DetectionRule.ts +568 -0
- package/Models/DatabaseModels/GoogleSecOpsConnection.ts +382 -0
- package/Models/DatabaseModels/Incident.ts +42 -0
- package/Models/DatabaseModels/IncidentMeasurement.ts +1114 -0
- package/Models/DatabaseModels/IncidentMeasurementValue.ts +501 -0
- package/Models/DatabaseModels/IncidentStateTimeline.ts +10 -2
- package/Models/DatabaseModels/IncomingCallPolicyLabelRule.ts +36 -0
- package/Models/DatabaseModels/IncomingCallPolicyOwnerRule.ts +42 -0
- package/Models/DatabaseModels/Index.ts +20 -0
- package/Models/DatabaseModels/Label.ts +11 -0
- package/Models/DatabaseModels/LlmCostBudget.ts +655 -0
- package/Models/DatabaseModels/LlmModelPrice.ts +481 -0
- package/Models/DatabaseModels/LogSavedView.ts +87 -0
- package/Models/DatabaseModels/MarketingConversion.ts +210 -8
- package/Models/DatabaseModels/MetricSavedView.ts +59 -0
- package/Models/DatabaseModels/OnCallDutyPolicyLabelRule.ts +36 -0
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerRule.ts +42 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLabelRule.ts +36 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleOwnerRule.ts +42 -0
- package/Models/DatabaseModels/Probe.ts +21 -0
- package/Models/DatabaseModels/RunbookLabelRule.ts +36 -0
- package/Models/DatabaseModels/RunbookOwnerRule.ts +42 -0
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.ts +1104 -0
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.ts +491 -0
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.ts +10 -2
- package/Models/DatabaseModels/StatusPageLabelRule.ts +36 -0
- package/Models/DatabaseModels/StatusPageOwnerRule.ts +42 -0
- package/Models/DatabaseModels/TableView.ts +15 -0
- package/Models/DatabaseModels/Team.ts +13 -0
- package/Models/DatabaseModels/TeamMember.ts +8 -0
- package/Models/DatabaseModels/TraceSavedView.ts +52 -0
- package/Models/DatabaseModels/WorkflowLabelRule.ts +36 -0
- package/Models/DatabaseModels/WorkflowOwnerRule.ts +42 -0
- package/Server/API/TelemetryAPI.ts +252 -6
- package/Server/API/UserAPI.ts +88 -0
- package/Server/EnvironmentConfig.ts +36 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788000000000-AddDetectionRuleAndGoogleSecOpsConnection.ts +88 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788100000000-AddMeasurements.ts +457 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788200000000-AddLlmCostBudget.ts +97 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788300000000-AddLlmModelPrice.ts +45 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788400000000-AddMarketingConversionAttribution.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788500000000-RemoveLlmCostBudgetAlertColumns.ts +77 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1788600000000-AddDetectionRuleIncidentColumns.ts +39 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +14 -0
- package/Server/Middleware/IdentityRateLimit.ts +672 -0
- package/Server/Services/AccessTokenService.ts +15 -2
- package/Server/Services/AlertMeasurementService.ts +302 -0
- package/Server/Services/AlertMeasurementValueService.ts +508 -0
- package/Server/Services/AlertService.ts +50 -0
- package/Server/Services/AlertStateTimelineService.ts +54 -0
- package/Server/Services/DetectionRuleService.ts +74 -0
- package/Server/Services/GoogleSecOpsConnectionService.ts +89 -0
- package/Server/Services/IncidentMeasurementService.ts +304 -0
- package/Server/Services/IncidentMeasurementValueService.ts +523 -0
- package/Server/Services/IncidentService.ts +51 -0
- package/Server/Services/IncidentStateTimelineService.ts +54 -0
- package/Server/Services/Index.ts +30 -0
- package/Server/Services/LlmCostBudgetService.ts +93 -0
- package/Server/Services/LlmModelPriceService.ts +202 -0
- package/Server/Services/LogAggregationService.ts +1106 -2
- package/Server/Services/LogCountBaselineService.ts +163 -0
- package/Server/Services/MutableMetricService.ts +30 -9
- package/Server/Services/ScheduledMaintenanceMeasurementService.ts +311 -0
- package/Server/Services/ScheduledMaintenanceMeasurementValueService.ts +546 -0
- package/Server/Services/ScheduledMaintenanceService.ts +53 -0
- package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +188 -1
- package/Server/Services/SecurityEventService.ts +104 -0
- package/Server/Services/SpanCountBaselineService.ts +173 -0
- package/Server/Services/StatusPageService.ts +4 -3
- package/Server/Services/TelemetryUsageBillingService.ts +17 -2
- package/Server/Services/UserService.ts +284 -51
- package/Server/Services/UserTotpAuthService.ts +27 -86
- package/Server/Services/UserWebAuthnService.ts +26 -86
- package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +14 -0
- package/Server/Types/Database/Permissions/TenantPermission.ts +10 -0
- package/Server/Types/Database/QueryHelper.ts +1 -1
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +1 -1
- package/Server/Utils/AI/Toolbox/Index.ts +6 -0
- package/Server/Utils/AI/Toolbox/SecurityEventTools.ts +349 -0
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +13 -4
- package/Server/Utils/Attribution.ts +130 -34
- package/Server/Utils/Marketing/ConversionUploadProvider.ts +98 -16
- package/Server/Utils/Marketing/Providers/GoogleAds.ts +70 -7
- package/Server/Utils/Marketing/Providers/LinkedIn.ts +54 -16
- package/Server/Utils/Marketing/Providers/Meta.ts +52 -18
- package/Server/Utils/Marketing/Providers/MicrosoftAds.ts +37 -10
- package/Server/Utils/Marketing/Providers/Reddit.ts +45 -15
- package/Server/Utils/Measurement/MeasurementDefinitionValidator.ts +209 -0
- package/Server/Utils/Measurement/MeasurementMetricWriter.ts +189 -0
- package/Server/Utils/Monitor/Criteria/CountAnomaly.ts +182 -0
- package/Server/Utils/Monitor/Criteria/LogMonitorCriteria.ts +132 -0
- package/Server/Utils/Monitor/Criteria/SecurityEventsMonitorCriteria.ts +35 -0
- package/Server/Utils/Monitor/Criteria/TraceMonitorCriteria.ts +132 -0
- package/Server/Utils/Monitor/DataToProcess.ts +2 -0
- package/Server/Utils/Monitor/MonitorCriteriaDataExtractor.ts +14 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +15 -0
- package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +20 -0
- package/Server/Utils/Monitor/MonitorResource.ts +16 -0
- package/Server/Utils/Monitor/MonitorStepResourceIdentity.ts +1 -0
- package/Server/Utils/Monitor/MonitorStepsReferenceExtractor.ts +1 -0
- package/Server/Utils/SecurityEvent/DetectionRuleEvaluator.ts +805 -0
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.ts +262 -0
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.ts +212 -0
- package/Server/Utils/SecurityEvent/SecurityEventRow.ts +101 -0
- package/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.ts +635 -0
- package/Server/Utils/Telemetry/LlmCostBudgetEvaluator.ts +379 -0
- package/Server/Utils/Telemetry/LlmSpan.ts +83 -4
- package/Server/Utils/Telemetry/LogErrorPatternSql.ts +136 -0
- package/Server/Utils/UserPermission/UserPermission.ts +57 -1
- package/Tests/App/Dashboard/AlertsSideMenu.test.tsx +4 -0
- package/Tests/App/Dashboard/CreatePageEntryPointPermissions.test.tsx +306 -0
- package/Tests/App/Dashboard/DangerZone.test.tsx +11 -0
- package/Tests/App/Dashboard/IncidentsSideMenu.test.tsx +4 -0
- package/Tests/App/Dashboard/LogMonitorAttributeOperatorPreview.test.tsx +459 -0
- package/Tests/App/Dashboard/OverviewCustomFields.test.tsx +24 -0
- package/Tests/App/Dashboard/ScheduledMaintenanceSideMenu.test.tsx +6 -0
- package/Tests/App/Dashboard/SecurityEventsDetectionRulesPage.test.tsx +250 -0
- package/Tests/App/Dashboard/SecurityEventsMonitorStepForm.test.tsx +106 -0
- package/Tests/App/Dashboard/SecurityEventsMonitorsPage.test.tsx +185 -0
- package/Tests/App/Dashboard/SecurityEventsSetupGuide.test.tsx +200 -0
- package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +323 -0
- package/Tests/Models/DatabaseModels/ProjectSharedResources.test.ts +386 -0
- package/Tests/Models/DetectionRuleCreateContract.test.ts +35 -0
- package/Tests/Server/API/LogErrorPatternAPI.test.ts +811 -0
- package/Tests/Server/API/UserAuthenticationAPI.test.ts +11 -0
- package/Tests/Server/API/UserProjectsAPI.test.ts +11 -2
- package/Tests/Server/API/UserTwoFactorAuthAdminAPI.test.ts +918 -0
- package/Tests/Server/Infrastructure/LocalCache.test.ts +149 -0
- package/Tests/Server/Services/AccessTokenProjectUserGrant.test.ts +249 -0
- package/Tests/Server/Services/AlertMeasurementService.test.ts +665 -0
- package/Tests/Server/Services/AlertMeasurementValueService.test.ts +389 -0
- package/Tests/Server/Services/DetectionRuleService.test.ts +254 -0
- package/Tests/Server/Services/IncidentMeasurementService.test.ts +394 -0
- package/Tests/Server/Services/IncidentMeasurementValueService.test.ts +816 -0
- package/Tests/Server/Services/LlmCostBudgetService.test.ts +104 -0
- package/Tests/Server/Services/LogAggregationAttributeOperators.test.ts +405 -0
- package/Tests/Server/Services/LogErrorPatternAggregation.test.ts +804 -0
- package/Tests/Server/Services/MutableMetricNameRouting.test.ts +83 -0
- package/Tests/Server/Services/ScheduledMaintenanceMeasurementService.test.ts +750 -0
- package/Tests/Server/Services/ScheduledMaintenanceMeasurementValueService.test.ts +478 -0
- package/Tests/Server/Services/UserAuthenticationService.test.ts +216 -4
- package/Tests/Server/Services/UserTwoFactorAuthAdmin.test.ts +1190 -0
- package/Tests/Server/Types/Database/Permissions/ScopedRoleSharedResourceAccess.test.ts +466 -0
- package/Tests/Server/Types/Database/QueryHelperOperators.test.ts +265 -0
- package/Tests/Server/Types/Database/QueryHelperTextAndStructuralOperators.test.ts +206 -0
- package/Tests/Server/Utils/AnalyticsDatabase/ClusterAwareSchema.test.ts +6 -0
- package/Tests/Server/Utils/AnalyticsDatabase/FractionalAttributeThreshold.test.ts +224 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +172 -2
- package/Tests/Server/Utils/Attribution.test.ts +228 -1
- package/Tests/Server/Utils/Marketing/AdUploadableConversionTypes.test.ts +153 -92
- package/Tests/Server/Utils/Marketing/ConversionUploadProvider.test.ts +123 -6
- package/Tests/Server/Utils/Marketing/GoogleAds.test.ts +253 -1
- package/Tests/Server/Utils/Marketing/LinkedIn.test.ts +282 -0
- package/Tests/Server/Utils/Marketing/Meta.test.ts +304 -0
- package/Tests/Server/Utils/Marketing/MicrosoftAds.test.ts +263 -0
- package/Tests/Server/Utils/Marketing/Reddit.test.ts +259 -0
- package/Tests/Server/Utils/Measurement/MeasurementDefinitionValidator.test.ts +322 -0
- package/Tests/Server/Utils/Measurement/MeasurementMetricWriter.test.ts +373 -0
- package/Tests/Server/Utils/Monitor/Criteria/CountAnomaly.test.ts +221 -0
- package/Tests/Server/Utils/Monitor/Criteria/LogMonitorCriteria.test.ts +236 -0
- package/Tests/Server/Utils/Monitor/Criteria/SecurityEventsMonitorCriteria.test.ts +147 -0
- package/Tests/Server/Utils/Monitor/Criteria/TraceMonitorCriteria.test.ts +274 -0
- package/Tests/Server/Utils/Monitor/SecurityEventsMonitorDataExtractor.test.ts +93 -0
- package/Tests/Server/Utils/SecurityEvent/DetectionRuleEvaluator.test.ts +1098 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsClient.test.ts +308 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPoller.test.ts +271 -0
- package/Tests/Server/Utils/SecurityEvent/SecurityEventRow.test.ts +272 -0
- package/Tests/Server/Utils/SecurityEvent/SigmaClickhouseCompiler.test.ts +511 -0
- package/Tests/Server/Utils/Telemetry/LlmCostBudgetEvaluator.test.ts +497 -0
- package/Tests/Server/Utils/Telemetry/LlmSpan.test.ts +380 -0
- package/Tests/Server/Utils/Telemetry/LogErrorPatternSql.test.ts +207 -0
- package/Tests/Server/Utils/UserPermission/ProjectUserGrant.test.ts +293 -0
- package/Tests/Types/Monitor/MonitorStepInfraMonitorUtils.test.ts +194 -0
- package/Tests/Types/Monitor/MonitorStepSecurityEventsMonitor.test.ts +201 -0
- package/Tests/Types/SecurityEvent/OcsfEventClass.test.ts +105 -0
- package/Tests/Types/SecurityEvent/OcsfSeverity.test.ts +111 -0
- package/Tests/Types/Telemetry/LlmCostCatalog.test.ts +516 -0
- package/Tests/UI/Components/ActiveFilterChipsOperatorValues.test.tsx +222 -0
- package/Tests/UI/Components/BulkActionPermissionGating.test.tsx +296 -0
- package/Tests/UI/Components/CardModelDetailPermissionGating.test.tsx +305 -0
- package/Tests/UI/Components/CustomFields/CustomFieldsDetail.test.tsx +23 -0
- package/Tests/UI/Components/DictionaryFilterOperatorDisplay.test.ts +239 -0
- package/Tests/UI/Components/DisabledButtonTooltip.test.tsx +267 -0
- package/Tests/UI/Components/DuplicateModel.test.tsx +37 -0
- package/Tests/UI/Components/ModelCardPermissionGating.test.tsx +348 -0
- package/Tests/UI/Components/ModelDelete.test.tsx +25 -1
- package/Tests/UI/Components/ModelFormCreatePermission.test.tsx +342 -0
- package/Tests/UI/Components/ModelTable/BaseModelTablePermissionGating.test.tsx +680 -0
- package/Tests/UI/Components/OrderedStatesListCreateGate.test.tsx +174 -0
- package/Tests/UI/Components/SavedViewsDropdownSearch.test.tsx +1127 -0
- package/Tests/UI/Components/SavedViewsFacetSection.test.tsx +958 -0
- package/Tests/UI/Components/SavedViewsList.test.ts +699 -0
- package/Tests/UI/Components/SavedViewsSidebarIntegration.test.tsx +640 -0
- package/Tests/UI/Components/SavedViewsSurfaceParity.test.tsx +679 -0
- package/Tests/UI/Components/TableViewLoadFailure.test.tsx +248 -0
- package/Tests/UI/Types/UseComponentOutsideClick.test.tsx +226 -0
- package/Tests/UI/Utils/PermissionGate.test.ts +467 -0
- package/Tests/Utils/Measurement/MeasurementEvaluator.test.ts +639 -0
- package/Tests/Utils/Monitor/MonitorSummarySnapshotUtil.test.ts +1 -0
- package/Tests/Utils/Monitor/NetworkDeviceLinkRuleUtil.test.ts +285 -0
- package/Tests/Utils/NetworkDevice/DeviceHealthStateUtil.test.ts +433 -0
- package/Tests/Utils/SecurityEvent/GenericNormalizer.test.ts +204 -0
- package/Tests/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.test.ts +252 -0
- package/Tests/Utils/SecurityEvent/NormalizerHelpers.test.ts +274 -0
- package/Tests/Utils/SecurityEvent/OcsfNormalizer.test.ts +208 -0
- package/Tests/Utils/SecurityEvent/SecurityEventNormalizer.test.ts +172 -0
- package/Tests/Utils/SecurityEvent/SigmaRuleParser.test.ts +471 -0
- package/Tests/Utils/SecurityEvent/UdmNormalizer.test.ts +361 -0
- package/Tests/Utils/Telemetry/CrossSignalScope.test.ts +82 -0
- package/Tests/Utils/Telemetry/LogErrorPattern.test.ts +463 -0
- package/Types/AI/AIChatTypes.ts +1 -0
- package/Types/Alerts/AlertMeasurementAnchorType.ts +14 -0
- package/Types/Alerts/AlertStateRole.ts +11 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +16 -0
- package/Types/Dashboard/Chart/ChartType.ts +1 -0
- package/Types/Dashboard/DashboardComponentType.ts +2 -0
- package/Types/Dashboard/DashboardComponents/DashboardSecurityEventsFlowComponent.ts +18 -0
- package/Types/Dashboard/DashboardComponents/DashboardSecurityEventsListComponent.ts +16 -0
- package/Types/Incident/IncidentMeasurementAnchorType.ts +34 -0
- package/Types/Incident/IncidentStateRole.ts +14 -0
- package/Types/Marketing/Attribution.ts +75 -0
- package/Types/Marketing/MarketingConversion.ts +37 -7
- package/Types/Measurement/MeasurementAggregationType.ts +43 -0
- package/Types/Measurement/MeasurementAnchorKind.ts +23 -0
- package/Types/Measurement/MeasurementOccurrence.ts +14 -0
- package/Types/Measurement/MeasurementStatus.ts +34 -0
- package/Types/MeteredPlan/ProductType.ts +1 -0
- package/Types/Monitor/CriteriaFilter.ts +3 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +64 -0
- package/Types/Monitor/MonitorStep.ts +28 -0
- package/Types/Monitor/MonitorStepSecurityEventsMonitor.ts +100 -0
- package/Types/Monitor/MonitorType.ts +20 -0
- package/Types/Monitor/SecurityEventsMonitor/SecurityEventsMonitorResponse.ts +17 -0
- package/Types/Permission.ts +399 -2
- package/Types/ScheduledMaintenance/ScheduledMaintenanceMeasurementAnchorType.ts +20 -0
- package/Types/ScheduledMaintenance/ScheduledMaintenanceStateRole.ts +16 -0
- package/Types/SecurityEvent/DetectionFindingConstants.ts +24 -0
- package/Types/SecurityEvent/NormalizedSecurityEvent.ts +92 -0
- package/Types/SecurityEvent/OcsfEventClass.ts +205 -0
- package/Types/SecurityEvent/OcsfSeverity.ts +88 -0
- package/Types/SecurityEvent/SecurityEventFormat.ts +23 -0
- package/Types/SecurityEvent/SigmaRule.ts +70 -0
- package/Types/Telemetry/LlmConventions.ts +20 -1
- package/Types/Telemetry/LlmCostCatalog.ts +557 -0
- package/Types/Telemetry/ServiceType.ts +1 -0
- package/Types/Telemetry/TelemetryRetentionConfig.ts +5 -1
- package/Types/Telemetry/TelemetryType.ts +1 -0
- package/Types/TwoFactorAuthStatus.ts +42 -0
- package/Types/UserAuthenticationStatus.ts +18 -0
- package/UI/Components/ActionButton/ActionButtonSchema.ts +7 -0
- package/UI/Components/BulkUpdate/BulkArchiveActions.tsx +35 -2
- package/UI/Components/BulkUpdate/BulkLabelActions.tsx +34 -1
- package/UI/Components/BulkUpdate/BulkOwnerActions.tsx +45 -1
- package/UI/Components/BulkUpdate/BulkUpdateForm.tsx +3 -0
- package/UI/Components/Button/Button.tsx +37 -2
- package/UI/Components/Card/Card.tsx +6 -0
- package/UI/Components/CustomFields/CustomFieldsDetail.tsx +24 -1
- package/UI/Components/Dictionary/DictionaryFilterOperator.ts +57 -0
- package/UI/Components/DuplicateModel/DuplicateModel.tsx +16 -0
- package/UI/Components/Forms/ModelForm.tsx +54 -2
- package/UI/Components/List/ListRow.tsx +6 -0
- package/UI/Components/LogsViewer/components/ActiveFilterChips.tsx +34 -7
- package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +7 -40
- package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +155 -3
- package/UI/Components/ModelDelete/ModelDelete.tsx +20 -0
- package/UI/Components/ModelDetail/CardModelDetail.tsx +36 -23
- package/UI/Components/ModelList/ModelList.tsx +21 -2
- package/UI/Components/ModelList/StaticModelList.tsx +11 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +168 -62
- package/UI/Components/ModelTable/ModelTable.tsx +16 -10
- package/UI/Components/ModelTable/TableView.tsx +36 -4
- package/UI/Components/MoreMenu/MoreMenuItem.tsx +36 -4
- package/UI/Components/OrderedStatesList/Item.tsx +6 -0
- package/UI/Components/OrderedStatesList/OrderedStatesList.tsx +81 -47
- package/UI/Components/ResetObjectID/ResetObjectID.tsx +16 -0
- package/UI/Components/SavedViews/SavedViewsFacetSection.tsx +242 -0
- package/UI/Components/SavedViews/SavedViewsList.ts +168 -0
- package/UI/Components/SavedViews/SavedViewsSearchInput.tsx +46 -0
- package/UI/Components/SavedViews/SavedViewsShowMoreButton.tsx +44 -0
- package/UI/Components/Table/TableRow.tsx +12 -0
- package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +152 -2
- package/UI/Types/UseComponentOutsideClick.ts +47 -0
- package/UI/Utils/PermissionGate.ts +277 -0
- package/Utils/Dashboard/Components/DashboardSecurityEventsFlowComponent.ts +84 -0
- package/Utils/Dashboard/Components/DashboardSecurityEventsListComponent.ts +110 -0
- package/Utils/Dashboard/Components/Index.ts +14 -0
- package/Utils/Measurement/MeasurementEvaluator.ts +359 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.ts +1 -0
- package/Utils/Monitor/NetworkDeviceLinkRuleUtil.ts +93 -11
- package/Utils/NetworkDevice/DeviceHealthStateUtil.ts +231 -0
- package/Utils/SecurityEvent/GenericNormalizer.ts +208 -0
- package/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.ts +206 -0
- package/Utils/SecurityEvent/NormalizerHelpers.ts +263 -0
- package/Utils/SecurityEvent/OcsfNormalizer.ts +194 -0
- package/Utils/SecurityEvent/SecurityEventNormalizer.ts +82 -0
- package/Utils/SecurityEvent/Sigma/SigmaRuleParser.ts +579 -0
- package/Utils/SecurityEvent/UdmNormalizer.ts +442 -0
- package/Utils/Telemetry/CrossSignalScope.ts +46 -9
- package/Utils/Telemetry/LogErrorPattern.ts +350 -0
- package/build/dist/Models/AnalyticsModels/Index.js +10 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/LogCountBaseline.js +159 -0
- package/build/dist/Models/AnalyticsModels/LogCountBaseline.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/SecurityEvent.js +596 -0
- package/build/dist/Models/AnalyticsModels/SecurityEvent.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/Span.js +24 -1
- package/build/dist/Models/AnalyticsModels/Span.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/SpanCountBaseline.js +181 -0
- package/build/dist/Models/AnalyticsModels/SpanCountBaseline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Alert.js +43 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertMeasurement.js +1143 -0
- package/build/dist/Models/DatabaseModels/AlertMeasurement.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertMeasurementValue.js +523 -0
- package/build/dist/Models/DatabaseModels/AlertMeasurementValue.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AlertStateTimeline.js +9 -2
- package/build/dist/Models/DatabaseModels/AlertStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/BillingPaymentMethod.js +10 -11
- package/build/dist/Models/DatabaseModels/BillingPaymentMethod.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DetectionRule.js +598 -0
- package/build/dist/Models/DatabaseModels/DetectionRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js +410 -0
- package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Incident.js +43 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentMeasurement.js +1143 -0
- package/build/dist/Models/DatabaseModels/IncidentMeasurement.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentMeasurementValue.js +523 -0
- package/build/dist/Models/DatabaseModels/IncidentMeasurementValue.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +9 -2
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncomingCallPolicyLabelRule.js +36 -0
- package/build/dist/Models/DatabaseModels/IncomingCallPolicyLabelRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncomingCallPolicyOwnerRule.js +42 -0
- package/build/dist/Models/DatabaseModels/IncomingCallPolicyOwnerRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +20 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Label.js +11 -0
- package/build/dist/Models/DatabaseModels/Label.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmCostBudget.js +681 -0
- package/build/dist/Models/DatabaseModels/LlmCostBudget.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LlmModelPrice.js +503 -0
- package/build/dist/Models/DatabaseModels/LlmModelPrice.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LogSavedView.js +87 -0
- package/build/dist/Models/DatabaseModels/LogSavedView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MarketingConversion.js +224 -8
- package/build/dist/Models/DatabaseModels/MarketingConversion.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MetricSavedView.js +59 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyLabelRule.js +36 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyLabelRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyOwnerRule.js +42 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyOwnerRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLabelRule.js +36 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLabelRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleOwnerRule.js +42 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleOwnerRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Probe.js +21 -0
- package/build/dist/Models/DatabaseModels/Probe.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RunbookLabelRule.js +36 -0
- package/build/dist/Models/DatabaseModels/RunbookLabelRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RunbookOwnerRule.js +42 -0
- package/build/dist/Models/DatabaseModels/RunbookOwnerRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +1133 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +515 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +9 -2
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageLabelRule.js +36 -0
- package/build/dist/Models/DatabaseModels/StatusPageLabelRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageOwnerRule.js +42 -0
- package/build/dist/Models/DatabaseModels/StatusPageOwnerRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TableView.js +15 -0
- package/build/dist/Models/DatabaseModels/TableView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Team.js +13 -0
- package/build/dist/Models/DatabaseModels/Team.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamMember.js +8 -0
- package/build/dist/Models/DatabaseModels/TeamMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TraceSavedView.js +52 -0
- package/build/dist/Models/DatabaseModels/TraceSavedView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkflowLabelRule.js +36 -0
- package/build/dist/Models/DatabaseModels/WorkflowLabelRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkflowOwnerRule.js +42 -0
- package/build/dist/Models/DatabaseModels/WorkflowOwnerRule.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +136 -0
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/API/UserAPI.js +75 -2
- package/build/dist/Server/API/UserAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +29 -1
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788000000000-AddDetectionRuleAndGoogleSecOpsConnection.js +36 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788000000000-AddDetectionRuleAndGoogleSecOpsConnection.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788100000000-AddMeasurements.js +162 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788100000000-AddMeasurements.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788200000000-AddLlmCostBudget.js +40 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788200000000-AddLlmCostBudget.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788300000000-AddLlmModelPrice.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788300000000-AddLlmModelPrice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788400000000-AddMarketingConversionAttribution.js +52 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788400000000-AddMarketingConversionAttribution.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788500000000-RemoveLlmCostBudgetAlertColumns.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788500000000-RemoveLlmCostBudgetAlertColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788600000000-AddDetectionRuleIncidentColumns.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788600000000-AddDetectionRuleIncidentColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/IdentityRateLimit.js +491 -0
- package/build/dist/Server/Middleware/IdentityRateLimit.js.map +1 -0
- package/build/dist/Server/Services/AccessTokenService.js +13 -2
- package/build/dist/Server/Services/AccessTokenService.js.map +1 -1
- package/build/dist/Server/Services/AlertMeasurementService.js +250 -0
- package/build/dist/Server/Services/AlertMeasurementService.js.map +1 -0
- package/build/dist/Server/Services/AlertMeasurementValueService.js +400 -0
- package/build/dist/Server/Services/AlertMeasurementValueService.js.map +1 -0
- package/build/dist/Server/Services/AlertService.js +37 -0
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/AlertStateTimelineService.js +48 -0
- package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/DetectionRuleService.js +50 -0
- package/build/dist/Server/Services/DetectionRuleService.js.map +1 -0
- package/build/dist/Server/Services/GoogleSecOpsConnectionService.js +55 -0
- package/build/dist/Server/Services/GoogleSecOpsConnectionService.js.map +1 -0
- package/build/dist/Server/Services/IncidentMeasurementService.js +252 -0
- package/build/dist/Server/Services/IncidentMeasurementService.js.map +1 -0
- package/build/dist/Server/Services/IncidentMeasurementValueService.js +413 -0
- package/build/dist/Server/Services/IncidentMeasurementValueService.js.map +1 -0
- package/build/dist/Server/Services/IncidentService.js +41 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +50 -0
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +30 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/LlmCostBudgetService.js +89 -0
- package/build/dist/Server/Services/LlmCostBudgetService.js.map +1 -0
- package/build/dist/Server/Services/LlmModelPriceService.js +163 -0
- package/build/dist/Server/Services/LlmModelPriceService.js.map +1 -0
- package/build/dist/Server/Services/LogAggregationService.js +709 -0
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/LogCountBaselineService.js +112 -0
- package/build/dist/Server/Services/LogCountBaselineService.js.map +1 -0
- package/build/dist/Server/Services/MutableMetricService.js +28 -9
- package/build/dist/Server/Services/MutableMetricService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceMeasurementService.js +254 -0
- package/build/dist/Server/Services/ScheduledMaintenanceMeasurementService.js.map +1 -0
- package/build/dist/Server/Services/ScheduledMaintenanceMeasurementValueService.js +434 -0
- package/build/dist/Server/Services/ScheduledMaintenanceMeasurementValueService.js.map +1 -0
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +37 -0
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +134 -0
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/SecurityEventService.js +64 -0
- package/build/dist/Server/Services/SecurityEventService.js.map +1 -0
- package/build/dist/Server/Services/SpanCountBaselineService.js +122 -0
- package/build/dist/Server/Services/SpanCountBaselineService.js.map +1 -0
- package/build/dist/Server/Services/StatusPageService.js +4 -3
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +15 -3
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +262 -42
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/UserTotpAuthService.js +0 -73
- package/build/dist/Server/Services/UserTotpAuthService.js.map +1 -1
- package/build/dist/Server/Services/UserWebAuthnService.js +1 -73
- package/build/dist/Server/Services/UserWebAuthnService.js.map +1 -1
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +13 -0
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js +10 -0
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +3 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/SecurityEventTools.js +257 -0
- package/build/dist/Server/Utils/AI/Toolbox/SecurityEventTools.js.map +1 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +13 -4
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Attribution.js +77 -33
- package/build/dist/Server/Utils/Attribution.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js +46 -9
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js +52 -8
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js +41 -17
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js +42 -18
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js +24 -11
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js +34 -15
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js.map +1 -1
- package/build/dist/Server/Utils/Measurement/MeasurementDefinitionValidator.js +109 -0
- package/build/dist/Server/Utils/Measurement/MeasurementDefinitionValidator.js.map +1 -0
- package/build/dist/Server/Utils/Measurement/MeasurementMetricWriter.js +131 -0
- package/build/dist/Server/Utils/Measurement/MeasurementMetricWriter.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/CountAnomaly.js +111 -0
- package/build/dist/Server/Utils/Monitor/Criteria/CountAnomaly.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/LogMonitorCriteria.js +84 -1
- package/build/dist/Server/Utils/Monitor/Criteria/LogMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SecurityEventsMonitorCriteria.js +35 -0
- package/build/dist/Server/Utils/Monitor/Criteria/SecurityEventsMonitorCriteria.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/TraceMonitorCriteria.js +84 -1
- package/build/dist/Server/Utils/Monitor/Criteria/TraceMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaDataExtractor.js +7 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaDataExtractor.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +12 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +9 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +10 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepResourceIdentity.js +6 -5
- package/build/dist/Server/Utils/Monitor/MonitorStepResourceIdentity.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepsReferenceExtractor.js +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorStepsReferenceExtractor.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js +600 -0
- package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js +145 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js +176 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/SecurityEventRow.js +69 -0
- package/build/dist/Server/Utils/SecurityEvent/SecurityEventRow.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.js +493 -0
- package/build/dist/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/LlmCostBudgetEvaluator.js +317 -0
- package/build/dist/Server/Utils/Telemetry/LlmCostBudgetEvaluator.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/LlmSpan.js +56 -4
- package/build/dist/Server/Utils/Telemetry/LlmSpan.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/LogErrorPatternSql.js +112 -0
- package/build/dist/Server/Utils/Telemetry/LogErrorPatternSql.js.map +1 -0
- package/build/dist/Server/Utils/UserPermission/UserPermission.js +46 -1
- package/build/dist/Server/Utils/UserPermission/UserPermission.js.map +1 -1
- package/build/dist/Types/AI/AIChatTypes.js +1 -0
- package/build/dist/Types/AI/AIChatTypes.js.map +1 -1
- package/build/dist/Types/Alerts/AlertMeasurementAnchorType.js +15 -0
- package/build/dist/Types/Alerts/AlertMeasurementAnchorType.js.map +1 -0
- package/build/dist/Types/Alerts/AlertStateRole.js +12 -0
- package/build/dist/Types/Alerts/AlertStateRole.js.map +1 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +16 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/Dashboard/Chart/ChartType.js +1 -0
- package/build/dist/Types/Dashboard/Chart/ChartType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSecurityEventsFlowComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSecurityEventsFlowComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSecurityEventsListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSecurityEventsListComponent.js.map +1 -0
- package/build/dist/Types/Incident/IncidentMeasurementAnchorType.js +29 -0
- package/build/dist/Types/Incident/IncidentMeasurementAnchorType.js.map +1 -0
- package/build/dist/Types/Incident/IncidentStateRole.js +15 -0
- package/build/dist/Types/Incident/IncidentStateRole.js.map +1 -0
- package/build/dist/Types/Marketing/Attribution.js +68 -0
- package/build/dist/Types/Marketing/Attribution.js.map +1 -0
- package/build/dist/Types/Marketing/MarketingConversion.js +36 -7
- package/build/dist/Types/Marketing/MarketingConversion.js.map +1 -1
- package/build/dist/Types/Measurement/MeasurementAggregationType.js +40 -0
- package/build/dist/Types/Measurement/MeasurementAggregationType.js.map +1 -0
- package/build/dist/Types/Measurement/MeasurementAnchorKind.js +22 -0
- package/build/dist/Types/Measurement/MeasurementAnchorKind.js.map +1 -0
- package/build/dist/Types/Measurement/MeasurementOccurrence.js +15 -0
- package/build/dist/Types/Measurement/MeasurementOccurrence.js.map +1 -0
- package/build/dist/Types/Measurement/MeasurementStatus.js +32 -0
- package/build/dist/Types/Measurement/MeasurementStatus.js.map +1 -0
- package/build/dist/Types/MeteredPlan/ProductType.js +1 -0
- package/build/dist/Types/MeteredPlan/ProductType.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +2 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +59 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +17 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSecurityEventsMonitor.js +64 -0
- package/build/dist/Types/Monitor/MonitorStepSecurityEventsMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +19 -0
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SecurityEventsMonitor/SecurityEventsMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/SecurityEventsMonitor/SecurityEventsMonitorResponse.js.map +1 -0
- package/build/dist/Types/Permission.js +347 -2
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/ScheduledMaintenance/ScheduledMaintenanceMeasurementAnchorType.js +19 -0
- package/build/dist/Types/ScheduledMaintenance/ScheduledMaintenanceMeasurementAnchorType.js.map +1 -0
- package/build/dist/Types/ScheduledMaintenance/ScheduledMaintenanceStateRole.js +17 -0
- package/build/dist/Types/ScheduledMaintenance/ScheduledMaintenanceStateRole.js.map +1 -0
- package/build/dist/Types/SecurityEvent/DetectionFindingConstants.js +18 -0
- package/build/dist/Types/SecurityEvent/DetectionFindingConstants.js.map +1 -0
- package/build/dist/Types/SecurityEvent/NormalizedSecurityEvent.js +2 -0
- package/build/dist/Types/SecurityEvent/NormalizedSecurityEvent.js.map +1 -0
- package/build/dist/Types/SecurityEvent/OcsfEventClass.js +181 -0
- package/build/dist/Types/SecurityEvent/OcsfEventClass.js.map +1 -0
- package/build/dist/Types/SecurityEvent/OcsfSeverity.js +81 -0
- package/build/dist/Types/SecurityEvent/OcsfSeverity.js.map +1 -0
- package/build/dist/Types/SecurityEvent/SecurityEventFormat.js +21 -0
- package/build/dist/Types/SecurityEvent/SecurityEventFormat.js.map +1 -0
- package/build/dist/Types/SecurityEvent/SigmaRule.js +16 -0
- package/build/dist/Types/SecurityEvent/SigmaRule.js.map +1 -0
- package/build/dist/Types/Telemetry/LlmConventions.js +19 -1
- package/build/dist/Types/Telemetry/LlmConventions.js.map +1 -1
- package/build/dist/Types/Telemetry/LlmCostCatalog.js +484 -0
- package/build/dist/Types/Telemetry/LlmCostCatalog.js.map +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetryRetentionConfig.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetryType.js +1 -0
- package/build/dist/Types/Telemetry/TelemetryType.js.map +1 -1
- package/build/dist/Types/TwoFactorAuthStatus.js +41 -0
- package/build/dist/Types/TwoFactorAuthStatus.js.map +1 -0
- package/build/dist/UI/Components/BulkUpdate/BulkArchiveActions.js +16 -2
- package/build/dist/UI/Components/BulkUpdate/BulkArchiveActions.js.map +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js +15 -1
- package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js.map +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkOwnerActions.js +20 -1
- package/build/dist/UI/Components/BulkUpdate/BulkOwnerActions.js.map +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +22 -1
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +1 -1
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js +14 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js.map +1 -1
- package/build/dist/UI/Components/Dictionary/DictionaryFilterOperator.js +47 -0
- package/build/dist/UI/Components/Dictionary/DictionaryFilterOperator.js.map +1 -1
- package/build/dist/UI/Components/DuplicateModel/DuplicateModel.js +8 -0
- package/build/dist/UI/Components/DuplicateModel/DuplicateModel.js.map +1 -1
- package/build/dist/UI/Components/Forms/ModelForm.js +40 -1
- package/build/dist/UI/Components/Forms/ModelForm.js.map +1 -1
- package/build/dist/UI/Components/List/ListRow.js +4 -1
- package/build/dist/UI/Components/List/ListRow.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/ActiveFilterChips.js +32 -7
- package/build/dist/UI/Components/LogsViewer/components/ActiveFilterChips.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +2 -17
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +93 -4
- package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Components/ModelDelete/ModelDelete.js +13 -0
- package/build/dist/UI/Components/ModelDelete/ModelDelete.js.map +1 -1
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js +27 -11
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js.map +1 -1
- package/build/dist/UI/Components/ModelList/ModelList.js +13 -2
- package/build/dist/UI/Components/ModelList/ModelList.js.map +1 -1
- package/build/dist/UI/Components/ModelList/StaticModelList.js +4 -1
- package/build/dist/UI/Components/ModelList/StaticModelList.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +101 -40
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/ModelTable.js +9 -7
- package/build/dist/UI/Components/ModelTable/ModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js +32 -4
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js +19 -2
- package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js.map +1 -1
- package/build/dist/UI/Components/OrderedStatesList/Item.js +4 -1
- package/build/dist/UI/Components/OrderedStatesList/Item.js.map +1 -1
- package/build/dist/UI/Components/OrderedStatesList/OrderedStatesList.js +33 -32
- package/build/dist/UI/Components/OrderedStatesList/OrderedStatesList.js.map +1 -1
- package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js +8 -0
- package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js.map +1 -1
- package/build/dist/UI/Components/SavedViews/SavedViewsFacetSection.js +98 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsFacetSection.js.map +1 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsList.js +99 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsList.js.map +1 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsSearchInput.js +17 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsSearchInput.js.map +1 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsShowMoreButton.js +15 -0
- package/build/dist/UI/Components/SavedViews/SavedViewsShowMoreButton.js.map +1 -0
- package/build/dist/UI/Components/Table/TableRow.js +8 -2
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +93 -4
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Types/UseComponentOutsideClick.js +39 -0
- package/build/dist/UI/Types/UseComponentOutsideClick.js.map +1 -1
- package/build/dist/UI/Utils/PermissionGate.js +164 -0
- package/build/dist/UI/Utils/PermissionGate.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSecurityEventsFlowComponent.js +70 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSecurityEventsFlowComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSecurityEventsListComponent.js +92 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSecurityEventsListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +8 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/Measurement/MeasurementEvaluator.js +210 -0
- package/build/dist/Utils/Measurement/MeasurementEvaluator.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorSummarySnapshotUtil.js +1 -0
- package/build/dist/Utils/Monitor/MonitorSummarySnapshotUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkDeviceLinkRuleUtil.js +51 -10
- package/build/dist/Utils/Monitor/NetworkDeviceLinkRuleUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDevice/DeviceHealthStateUtil.js +108 -0
- package/build/dist/Utils/NetworkDevice/DeviceHealthStateUtil.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/GenericNormalizer.js +176 -0
- package/build/dist/Utils/SecurityEvent/GenericNormalizer.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.js +146 -0
- package/build/dist/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/NormalizerHelpers.js +196 -0
- package/build/dist/Utils/SecurityEvent/NormalizerHelpers.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/OcsfNormalizer.js +136 -0
- package/build/dist/Utils/SecurityEvent/OcsfNormalizer.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/SecurityEventNormalizer.js +64 -0
- package/build/dist/Utils/SecurityEvent/SecurityEventNormalizer.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/Sigma/SigmaRuleParser.js +388 -0
- package/build/dist/Utils/SecurityEvent/Sigma/SigmaRuleParser.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/UdmNormalizer.js +328 -0
- package/build/dist/Utils/SecurityEvent/UdmNormalizer.js.map +1 -0
- package/build/dist/Utils/Telemetry/CrossSignalScope.js +29 -7
- package/build/dist/Utils/Telemetry/CrossSignalScope.js.map +1 -1
- package/build/dist/Utils/Telemetry/LogErrorPattern.js +284 -0
- package/build/dist/Utils/Telemetry/LogErrorPattern.js.map +1 -0
- package/package.json +3 -1
|
@@ -19,6 +19,16 @@ import CaptureSpan from "../../../Utils/Telemetry/CaptureSpan";
|
|
|
19
19
|
* Permissions auto-granted to every logged-in tenant user. Holding only these
|
|
20
20
|
* (without an actual role permission) does not signal admin authority and so
|
|
21
21
|
* should not unlock cross-row access on models that scope by user.
|
|
22
|
+
*
|
|
23
|
+
* `Permission.ProjectUser` is auto-granted too (AccessTokenService adds it for
|
|
24
|
+
* every project member) but is deliberately NOT listed here. These three are
|
|
25
|
+
* granted to callers a model never opted into: any logged-in user, anyone at
|
|
26
|
+
* all, anyone mid-SSO. `ProjectUser` is different - a model only sees it if it
|
|
27
|
+
* wrote `Permission.ProjectUser` into its own access list, and that is an
|
|
28
|
+
* explicit statement that the whole project may read the table, rows and all.
|
|
29
|
+
* Treating it as auto-granted would silently re-narrow those tables to the
|
|
30
|
+
* caller's own rows and put the shared owner and label pickers back to empty,
|
|
31
|
+
* which is the bug this permission exists to fix.
|
|
22
32
|
*/
|
|
23
33
|
const AUTO_GRANTED_TENANT_PERMISSIONS: ReadonlyArray<Permission> = [
|
|
24
34
|
Permission.CurrentUser,
|
|
@@ -637,7 +637,7 @@ export default class QueryHelper {
|
|
|
637
637
|
const rid: string = Text.generateRandomText(10);
|
|
638
638
|
return Raw(
|
|
639
639
|
(alias: string) => {
|
|
640
|
-
return `(${alias}
|
|
640
|
+
return `(${alias} > :${rid} or ${alias} IS NULL)`;
|
|
641
641
|
},
|
|
642
642
|
{
|
|
643
643
|
[rid]: value,
|
|
@@ -138,7 +138,7 @@ ${buildActionGuidance(data.permissionMode)}
|
|
|
138
138
|
## How to investigate
|
|
139
139
|
|
|
140
140
|
- Resolve names first: use lookup_context to turn a service name into its ID before filtering other tools by service, and to discover metric names.
|
|
141
|
-
- Prefer aggregations (query_traces, log_histogram, query_metrics, top_exceptions) to establish the shape of a problem, then drill into raw data (search_logs, get_trace) for evidence.
|
|
141
|
+
- Prefer aggregations (query_traces, log_histogram, query_metrics, top_exceptions, security_event_summary) to establish the shape of a problem, then drill into raw data (search_logs, get_trace, search_security_events) for evidence.
|
|
142
142
|
- Always pass explicit ISO 8601 time ranges. If the user did not specify one, use the last hour for logs and the last 24 hours for metrics/traces, and say which window you used.
|
|
143
143
|
- When durations are involved they are in milliseconds unless stated otherwise.
|
|
144
144
|
- Platform questions have direct tools — answer them from those, not from telemetry: who is on call or how escalation works (get_on_call_status, query_on_call_policies); whether a page actually reached anyone (query_on_call_pages); who owns a resource (query_teams); what the runbook says (query_runbooks); what is public or has been announced to subscribers (query_status_pages, query_status_page_announcements); how much SLO error budget is left (query_slos); whether automation ran or failed (query_workflows); probe health (query_probes); early warnings that predate an incident (query_ai_insights).
|
|
@@ -39,6 +39,10 @@ import { QueryTeamsTool } from "./TeamTools";
|
|
|
39
39
|
import { CreateAlertNoteTool, CreateIncidentNoteTool } from "./NoteWriteTools";
|
|
40
40
|
import { TopExceptionsTool } from "./ExceptionTools";
|
|
41
41
|
import { LogHistogramTool, SearchLogsTool } from "./LogTools";
|
|
42
|
+
import {
|
|
43
|
+
SearchSecurityEventsTool,
|
|
44
|
+
SecurityEventSummaryTool,
|
|
45
|
+
} from "./SecurityEventTools";
|
|
42
46
|
import { RecentChangesTool } from "./RecentChangesTools";
|
|
43
47
|
import { BaselineAnomalyTool, QueryMetricsTool } from "./MetricTools";
|
|
44
48
|
import { GetTraceTool, QueryTracesTool } from "./TraceTools";
|
|
@@ -121,6 +125,8 @@ export default class AIToolbox {
|
|
|
121
125
|
QueryAIInsightsTool,
|
|
122
126
|
TopExceptionsTool,
|
|
123
127
|
SearchLogsTool,
|
|
128
|
+
SearchSecurityEventsTool,
|
|
129
|
+
SecurityEventSummaryTool,
|
|
124
130
|
LogHistogramTool,
|
|
125
131
|
QueryMetricsTool,
|
|
126
132
|
BaselineAnomalyTool,
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import SecurityEvent from "../../../../Models/AnalyticsModels/SecurityEvent";
|
|
2
|
+
import InBetween from "../../../../Types/BaseDatabase/InBetween";
|
|
3
|
+
import Includes from "../../../../Types/BaseDatabase/Includes";
|
|
4
|
+
import Search from "../../../../Types/BaseDatabase/Search";
|
|
5
|
+
import SortOrder from "../../../../Types/BaseDatabase/SortOrder";
|
|
6
|
+
import { JSONObject } from "../../../../Types/JSON";
|
|
7
|
+
import Permission from "../../../../Types/Permission";
|
|
8
|
+
import {
|
|
9
|
+
AIChatCitationTarget,
|
|
10
|
+
AIChatCitationTargetType,
|
|
11
|
+
} from "../../../../Types/AI/AIChatTypes";
|
|
12
|
+
import SecurityEventService from "../../../Services/SecurityEventService";
|
|
13
|
+
import ToolResultSerializer, { SerializedResult } from "./Serializer";
|
|
14
|
+
import WidgetBuilder from "./WidgetBuilder";
|
|
15
|
+
import {
|
|
16
|
+
ObservabilityTool,
|
|
17
|
+
TimeRangeSchemaProperties,
|
|
18
|
+
ToolArgs,
|
|
19
|
+
ToolContext,
|
|
20
|
+
ToolExecutionResult,
|
|
21
|
+
} from "./ToolTypes";
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* AI toolbox over the SecurityEvent table — the "AI security analyst"
|
|
25
|
+
* surface. Read-only; executes under the requesting user's permission
|
|
26
|
+
* props like every other analytics tool.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Derived from the model ACL so the tool gate can never drift from RBAC.
|
|
31
|
+
* Resolved lazily — this module loads through the service import graph
|
|
32
|
+
* before the model class is fully wired, so calling a model method at
|
|
33
|
+
* import time throws a circular-dependency TypeError.
|
|
34
|
+
*/
|
|
35
|
+
let cachedReadPermissions: Array<Permission> | null = null;
|
|
36
|
+
const resolveReadPermissions: () => Array<Permission> =
|
|
37
|
+
(): Array<Permission> => {
|
|
38
|
+
if (!cachedReadPermissions) {
|
|
39
|
+
cachedReadPermissions = new SecurityEvent().getReadPermissions();
|
|
40
|
+
}
|
|
41
|
+
return cachedReadPermissions;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const SearchSecurityEventsTool: ObservabilityTool = {
|
|
45
|
+
name: "search_security_events",
|
|
46
|
+
description:
|
|
47
|
+
"Search SIEM security events (normalized to OCSF). Filter by time range, severity, event class, message text, user, host, or any observable (IP, hostname, username). Use this to investigate what security activity involved a given entity, or what fired recently.",
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
...TimeRangeSchemaProperties,
|
|
52
|
+
severityNames: {
|
|
53
|
+
type: "array",
|
|
54
|
+
items: { type: "string" },
|
|
55
|
+
description:
|
|
56
|
+
'Filter by OCSF severity, e.g. ["Critical", "High"] or ["Medium"].',
|
|
57
|
+
},
|
|
58
|
+
classNames: {
|
|
59
|
+
type: "array",
|
|
60
|
+
items: { type: "string" },
|
|
61
|
+
description:
|
|
62
|
+
'Filter by OCSF event class, e.g. ["Authentication", "Detection Finding", "DNS Activity"].',
|
|
63
|
+
},
|
|
64
|
+
messageSearchText: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Only events whose message contains this text.",
|
|
67
|
+
},
|
|
68
|
+
principalUser: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Only events where this user is the actor.",
|
|
71
|
+
},
|
|
72
|
+
principalHost: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "Only events where this host is the actor.",
|
|
75
|
+
},
|
|
76
|
+
observable: {
|
|
77
|
+
type: "string",
|
|
78
|
+
description:
|
|
79
|
+
"Only events mentioning this observable anywhere (user, hostname, IP, domain). Broader than principalUser/principalHost.",
|
|
80
|
+
},
|
|
81
|
+
limit: {
|
|
82
|
+
type: "number",
|
|
83
|
+
description: "Maximum events to return (default 25, max 50).",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
get requiredPermissions(): Array<Permission> {
|
|
88
|
+
return resolveReadPermissions();
|
|
89
|
+
},
|
|
90
|
+
execute: async (
|
|
91
|
+
args: JSONObject,
|
|
92
|
+
ctx: ToolContext,
|
|
93
|
+
): Promise<ToolExecutionResult> => {
|
|
94
|
+
const { startTime, endTime } = ToolArgs.getTimeRange(args, {
|
|
95
|
+
defaultHours: 24,
|
|
96
|
+
maxDays: 30,
|
|
97
|
+
});
|
|
98
|
+
const limit: number = ToolArgs.getNumber(args, "limit", {
|
|
99
|
+
defaultValue: 25,
|
|
100
|
+
min: 1,
|
|
101
|
+
max: 50,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const query: JSONObject = {
|
|
105
|
+
time: new InBetween(startTime, endTime),
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const severityNames: Array<string> | undefined = ToolArgs.getStringArray(
|
|
109
|
+
args,
|
|
110
|
+
"severityNames",
|
|
111
|
+
);
|
|
112
|
+
if (severityNames) {
|
|
113
|
+
query["severityName"] = new Includes(severityNames);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const classNames: Array<string> | undefined = ToolArgs.getStringArray(
|
|
117
|
+
args,
|
|
118
|
+
"classNames",
|
|
119
|
+
);
|
|
120
|
+
if (classNames) {
|
|
121
|
+
query["className"] = new Includes(classNames);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const messageSearchText: string | undefined = ToolArgs.getString(
|
|
125
|
+
args,
|
|
126
|
+
"messageSearchText",
|
|
127
|
+
);
|
|
128
|
+
if (messageSearchText) {
|
|
129
|
+
query["message"] = new Search(messageSearchText);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const principalUser: string | undefined = ToolArgs.getString(
|
|
133
|
+
args,
|
|
134
|
+
"principalUser",
|
|
135
|
+
);
|
|
136
|
+
if (principalUser) {
|
|
137
|
+
query["principalUser"] = principalUser;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const principalHost: string | undefined = ToolArgs.getString(
|
|
141
|
+
args,
|
|
142
|
+
"principalHost",
|
|
143
|
+
);
|
|
144
|
+
if (principalHost) {
|
|
145
|
+
query["principalHost"] = principalHost;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const observable: string | undefined = ToolArgs.getString(
|
|
149
|
+
args,
|
|
150
|
+
"observable",
|
|
151
|
+
);
|
|
152
|
+
if (observable) {
|
|
153
|
+
query["observables"] = new Includes([observable]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const events: Array<SecurityEvent> = await SecurityEventService.findBy({
|
|
157
|
+
query: query as never,
|
|
158
|
+
select: {
|
|
159
|
+
time: true,
|
|
160
|
+
severityName: true,
|
|
161
|
+
className: true,
|
|
162
|
+
message: true,
|
|
163
|
+
principalUser: true,
|
|
164
|
+
principalHost: true,
|
|
165
|
+
principalIp: true,
|
|
166
|
+
targetHost: true,
|
|
167
|
+
vendorName: true,
|
|
168
|
+
ruleName: true,
|
|
169
|
+
} as never,
|
|
170
|
+
sort: {
|
|
171
|
+
time: SortOrder.Descending,
|
|
172
|
+
} as never,
|
|
173
|
+
limit: limit,
|
|
174
|
+
skip: 0,
|
|
175
|
+
props: ctx.props,
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const rows: Array<JSONObject> = events.map(
|
|
179
|
+
(event: SecurityEvent): JSONObject => {
|
|
180
|
+
return {
|
|
181
|
+
time: event.time,
|
|
182
|
+
severity: event.severityName,
|
|
183
|
+
class: event.className,
|
|
184
|
+
message: event.message,
|
|
185
|
+
principalUser: event.principalUser,
|
|
186
|
+
principalHost: event.principalHost,
|
|
187
|
+
principalIp: event.principalIp,
|
|
188
|
+
targetHost: event.targetHost,
|
|
189
|
+
vendor: event.vendorName,
|
|
190
|
+
rule: event.ruleName,
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const serialized: SerializedResult =
|
|
196
|
+
ToolResultSerializer.serializeRows(rows);
|
|
197
|
+
|
|
198
|
+
const securityEventsLink: AIChatCitationTarget = {
|
|
199
|
+
type: AIChatCitationTargetType.SecurityEvents,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
dataForLlm: serialized.text,
|
|
204
|
+
rowCount: serialized.rowCount,
|
|
205
|
+
citationLabel: `Security events ${startTime.toISOString()} – ${endTime.toISOString()} (${serialized.rowCount} shown)`,
|
|
206
|
+
citationTarget: securityEventsLink,
|
|
207
|
+
redactionCount: serialized.redactionCount,
|
|
208
|
+
isTruncated: serialized.isTruncated,
|
|
209
|
+
widget:
|
|
210
|
+
rows.length > 0
|
|
211
|
+
? WidgetBuilder.table({
|
|
212
|
+
title: `Security Events (${rows.length})`,
|
|
213
|
+
description: `${startTime.toISOString()} – ${endTime.toISOString()}`,
|
|
214
|
+
columns: [
|
|
215
|
+
{ key: "time", title: "Time", type: "date" },
|
|
216
|
+
{ key: "severity", title: "Severity", type: "text" },
|
|
217
|
+
{ key: "class", title: "Class", type: "text" },
|
|
218
|
+
{ key: "message", title: "Message", type: "text" },
|
|
219
|
+
{ key: "principalHost", title: "Host", type: "text" },
|
|
220
|
+
],
|
|
221
|
+
rows: rows,
|
|
222
|
+
link: securityEventsLink,
|
|
223
|
+
})
|
|
224
|
+
: undefined,
|
|
225
|
+
};
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// Sample size for the in-code aggregation below.
|
|
230
|
+
const SUMMARY_SAMPLE_LIMIT: number = 500;
|
|
231
|
+
|
|
232
|
+
export const SecurityEventSummaryTool: ObservabilityTool = {
|
|
233
|
+
name: "security_event_summary",
|
|
234
|
+
description:
|
|
235
|
+
"Summarize security event volume by event class and severity over a time range. Use this first to understand the shape of security activity before drilling into raw events with search_security_events.",
|
|
236
|
+
inputSchema: {
|
|
237
|
+
type: "object",
|
|
238
|
+
properties: {
|
|
239
|
+
...TimeRangeSchemaProperties,
|
|
240
|
+
observable: {
|
|
241
|
+
type: "string",
|
|
242
|
+
description:
|
|
243
|
+
"Optionally scope the summary to events mentioning this observable (user, hostname, IP).",
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
get requiredPermissions(): Array<Permission> {
|
|
248
|
+
return resolveReadPermissions();
|
|
249
|
+
},
|
|
250
|
+
execute: async (
|
|
251
|
+
args: JSONObject,
|
|
252
|
+
ctx: ToolContext,
|
|
253
|
+
): Promise<ToolExecutionResult> => {
|
|
254
|
+
const { startTime, endTime } = ToolArgs.getTimeRange(args, {
|
|
255
|
+
defaultHours: 24,
|
|
256
|
+
maxDays: 30,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
const query: JSONObject = {
|
|
260
|
+
time: new InBetween(startTime, endTime),
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const observable: string | undefined = ToolArgs.getString(
|
|
264
|
+
args,
|
|
265
|
+
"observable",
|
|
266
|
+
);
|
|
267
|
+
if (observable) {
|
|
268
|
+
query["observables"] = new Includes([observable]);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/*
|
|
272
|
+
* Aggregate in code over a bounded sample rather than raw SQL: findBy
|
|
273
|
+
* runs the model layer's permission scoping, which raw aggregation
|
|
274
|
+
* would bypass. The sample cap is stated in the result so the model
|
|
275
|
+
* knows when counts are a floor rather than a total.
|
|
276
|
+
*/
|
|
277
|
+
const events: Array<SecurityEvent> = await SecurityEventService.findBy({
|
|
278
|
+
query: query as never,
|
|
279
|
+
select: {
|
|
280
|
+
className: true,
|
|
281
|
+
severityName: true,
|
|
282
|
+
} as never,
|
|
283
|
+
sort: {
|
|
284
|
+
time: SortOrder.Descending,
|
|
285
|
+
} as never,
|
|
286
|
+
limit: SUMMARY_SAMPLE_LIMIT,
|
|
287
|
+
skip: 0,
|
|
288
|
+
props: ctx.props,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
const countsByKey: Map<string, JSONObject> = new Map<string, JSONObject>();
|
|
292
|
+
|
|
293
|
+
for (const event of events) {
|
|
294
|
+
const className: string = event.className || "Base Event";
|
|
295
|
+
const severity: string = event.severityName || "Unknown";
|
|
296
|
+
const key: string = `${className}|${severity}`;
|
|
297
|
+
|
|
298
|
+
const existing: JSONObject | undefined = countsByKey.get(key);
|
|
299
|
+
|
|
300
|
+
if (existing) {
|
|
301
|
+
existing["count"] = (existing["count"] as number) + 1;
|
|
302
|
+
} else {
|
|
303
|
+
countsByKey.set(key, {
|
|
304
|
+
class: className,
|
|
305
|
+
severity: severity,
|
|
306
|
+
count: 1,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const rows: Array<JSONObject> = Array.from(countsByKey.values()).sort(
|
|
312
|
+
(a: JSONObject, b: JSONObject): number => {
|
|
313
|
+
return (b["count"] as number) - (a["count"] as number);
|
|
314
|
+
},
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
const serialized: SerializedResult =
|
|
318
|
+
ToolResultSerializer.serializeRows(rows);
|
|
319
|
+
|
|
320
|
+
const sampleNote: string =
|
|
321
|
+
events.length >= SUMMARY_SAMPLE_LIMIT
|
|
322
|
+
? ` (based on the most recent ${SUMMARY_SAMPLE_LIMIT} events — counts are a floor)`
|
|
323
|
+
: "";
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
dataForLlm: serialized.text + sampleNote,
|
|
327
|
+
rowCount: serialized.rowCount,
|
|
328
|
+
citationLabel: `Security event summary ${startTime.toISOString()} – ${endTime.toISOString()}${sampleNote}`,
|
|
329
|
+
citationTarget: {
|
|
330
|
+
type: AIChatCitationTargetType.SecurityEvents,
|
|
331
|
+
},
|
|
332
|
+
redactionCount: serialized.redactionCount,
|
|
333
|
+
isTruncated: serialized.isTruncated,
|
|
334
|
+
widget:
|
|
335
|
+
rows.length > 0
|
|
336
|
+
? WidgetBuilder.table({
|
|
337
|
+
title: "Security events by class and severity",
|
|
338
|
+
description: `${startTime.toISOString()} – ${endTime.toISOString()}${sampleNote}`,
|
|
339
|
+
columns: [
|
|
340
|
+
{ key: "class", title: "Event Class", type: "text" },
|
|
341
|
+
{ key: "severity", title: "Severity", type: "text" },
|
|
342
|
+
{ key: "count", title: "Count", type: "number" },
|
|
343
|
+
],
|
|
344
|
+
rows: rows,
|
|
345
|
+
})
|
|
346
|
+
: undefined,
|
|
347
|
+
};
|
|
348
|
+
},
|
|
349
|
+
};
|
|
@@ -1068,6 +1068,15 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
1068
1068
|
* values (including the empty-string default for missing
|
|
1069
1069
|
* keys), which compares to false against any numeric
|
|
1070
1070
|
* threshold and naturally drops those rows.
|
|
1071
|
+
*
|
|
1072
|
+
* The threshold binds as Decimal (ClickHouse `Double`), not
|
|
1073
|
+
* Number (`Int32`): the attribute filter form builds these
|
|
1074
|
+
* with `Number(input)` (see buildDictionaryValue in
|
|
1075
|
+
* Common/UI/Components/Dictionary/DictionaryFilterOperator.ts),
|
|
1076
|
+
* so a user can legitimately ask for `duration > 0.5` and an
|
|
1077
|
+
* Int32 bind would fail to parse the fractional value. Double
|
|
1078
|
+
* represents every Int32 exactly, so integer thresholds are
|
|
1079
|
+
* unaffected, and it matches the Float64 comparison side.
|
|
1071
1080
|
*/
|
|
1072
1081
|
if (mapEntry instanceof GreaterThan) {
|
|
1073
1082
|
this.appendMapKeyPresenceFilter({
|
|
@@ -1082,7 +1091,7 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
1082
1091
|
type: TableColumnType.Text,
|
|
1083
1092
|
}}]) > ${{
|
|
1084
1093
|
value: Number((mapEntry as GreaterThan<any>).value),
|
|
1085
|
-
type: TableColumnType.
|
|
1094
|
+
type: TableColumnType.Decimal,
|
|
1086
1095
|
}}`,
|
|
1087
1096
|
);
|
|
1088
1097
|
continue;
|
|
@@ -1101,7 +1110,7 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
1101
1110
|
type: TableColumnType.Text,
|
|
1102
1111
|
}}]) >= ${{
|
|
1103
1112
|
value: Number((mapEntry as GreaterThanOrEqual<any>).value),
|
|
1104
|
-
type: TableColumnType.
|
|
1113
|
+
type: TableColumnType.Decimal,
|
|
1105
1114
|
}}`,
|
|
1106
1115
|
);
|
|
1107
1116
|
continue;
|
|
@@ -1120,7 +1129,7 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
1120
1129
|
type: TableColumnType.Text,
|
|
1121
1130
|
}}]) < ${{
|
|
1122
1131
|
value: Number((mapEntry as LessThan<any>).value),
|
|
1123
|
-
type: TableColumnType.
|
|
1132
|
+
type: TableColumnType.Decimal,
|
|
1124
1133
|
}}`,
|
|
1125
1134
|
);
|
|
1126
1135
|
continue;
|
|
@@ -1139,7 +1148,7 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
1139
1148
|
type: TableColumnType.Text,
|
|
1140
1149
|
}}]) <= ${{
|
|
1141
1150
|
value: Number((mapEntry as LessThanOrEqual<any>).value),
|
|
1142
|
-
type: TableColumnType.
|
|
1151
|
+
type: TableColumnType.Decimal,
|
|
1143
1152
|
}}`,
|
|
1144
1153
|
);
|
|
1145
1154
|
continue;
|
|
@@ -1,55 +1,56 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
2
|
+
import {
|
|
3
|
+
AdClickIdKeys,
|
|
4
|
+
FirstTouchStringKeys,
|
|
5
|
+
MaxAttributionValueLength,
|
|
6
|
+
UtmPropertyKeys,
|
|
7
|
+
UtmUrlPropertyKey,
|
|
8
|
+
UtmWireKeyToPropertyKey,
|
|
9
|
+
} from "../../Types/Marketing/Attribution";
|
|
1
10
|
import { JSONObject, JSONValue } from "../../Types/JSON";
|
|
2
11
|
|
|
3
12
|
/*
|
|
4
|
-
* Sanitizers for
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
13
|
+
* Sanitizers for attribution submitted by unauthenticated callers — the signup
|
|
14
|
+
* form, the Cal.com booking webhook, and the enterprise licence request form.
|
|
15
|
+
*
|
|
16
|
+
* Everything here is a whitelist, never a denylist. Cal booking metadata and
|
|
17
|
+
* form bodies are free-form caller content (names, notes, answers to booking
|
|
18
|
+
* questions), and only the keys named in Common/Types/Marketing/Attribution.ts
|
|
19
|
+
* may be copied into a row that is later forwarded to an ad platform.
|
|
20
|
+
*
|
|
21
|
+
* This file also owns email normalisation and hashing. Meta and Reddit each
|
|
22
|
+
* used to carry a private copy of the hash, and MarketingConversion.emailHash
|
|
23
|
+
* has to agree with all of them or the demo-to-signup identity join silently
|
|
24
|
+
* matches nothing — so there is exactly one definition, tested once.
|
|
9
25
|
*/
|
|
10
26
|
|
|
11
|
-
const MAX_VALUE_LENGTH: number = 500;
|
|
12
|
-
|
|
13
|
-
const CLICK_ID_KEYS: Array<string> = [
|
|
14
|
-
"gclid",
|
|
15
|
-
"wbraid",
|
|
16
|
-
"gbraid",
|
|
17
|
-
"fbclid",
|
|
18
|
-
"msclkid",
|
|
19
|
-
"li_fat_id",
|
|
20
|
-
"twclid",
|
|
21
|
-
"rdt_cid",
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const FIRST_TOUCH_STRING_KEYS: Array<string> = [
|
|
25
|
-
"utmSource",
|
|
26
|
-
"utmMedium",
|
|
27
|
-
"utmCampaign",
|
|
28
|
-
"utmTerm",
|
|
29
|
-
"utmContent",
|
|
30
|
-
"landingUrl",
|
|
31
|
-
"referrer",
|
|
32
|
-
"timestamp",
|
|
33
|
-
];
|
|
34
|
-
|
|
35
27
|
type SanitizeStringValueFunction = (value: JSONValue) => string | null;
|
|
36
28
|
|
|
37
29
|
const sanitizeStringValue: SanitizeStringValueFunction = (
|
|
38
30
|
value: JSONValue,
|
|
39
31
|
): string | null => {
|
|
40
32
|
if (typeof value === "string" && value.length > 0) {
|
|
41
|
-
return value.slice(0,
|
|
33
|
+
return value.slice(0, MaxAttributionValueLength);
|
|
42
34
|
}
|
|
43
35
|
|
|
44
36
|
if (typeof value === "number") {
|
|
45
|
-
return value.toString().slice(0,
|
|
37
|
+
return value.toString().slice(0, MaxAttributionValueLength);
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
return null;
|
|
49
41
|
};
|
|
50
42
|
|
|
43
|
+
export interface UtmAttribution {
|
|
44
|
+
utmSource?: string | undefined;
|
|
45
|
+
utmMedium?: string | undefined;
|
|
46
|
+
utmCampaign?: string | undefined;
|
|
47
|
+
utmTerm?: string | undefined;
|
|
48
|
+
utmContent?: string | undefined;
|
|
49
|
+
utmUrl?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
51
52
|
export default class Attribution {
|
|
52
|
-
// Whitelist known ad-platform click id keys; bound each value
|
|
53
|
+
// Whitelist known ad-platform click id keys; bound each value.
|
|
53
54
|
public static sanitizeClickIds(value: JSONValue): JSONObject | undefined {
|
|
54
55
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
55
56
|
return undefined;
|
|
@@ -58,7 +59,7 @@ export default class Attribution {
|
|
|
58
59
|
const input: JSONObject = value as JSONObject;
|
|
59
60
|
const result: JSONObject = {};
|
|
60
61
|
|
|
61
|
-
for (const key of
|
|
62
|
+
for (const key of AdClickIdKeys) {
|
|
62
63
|
const sanitized: string | null = sanitizeStringValue(input[key]);
|
|
63
64
|
if (sanitized) {
|
|
64
65
|
result[key] = sanitized;
|
|
@@ -79,7 +80,7 @@ export default class Attribution {
|
|
|
79
80
|
const input: JSONObject = value as JSONObject;
|
|
80
81
|
const result: JSONObject = {};
|
|
81
82
|
|
|
82
|
-
for (const key of
|
|
83
|
+
for (const key of FirstTouchStringKeys) {
|
|
83
84
|
const sanitized: string | null = sanitizeStringValue(input[key]);
|
|
84
85
|
if (sanitized) {
|
|
85
86
|
result[key] = sanitized;
|
|
@@ -96,4 +97,99 @@ export default class Attribution {
|
|
|
96
97
|
|
|
97
98
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
98
99
|
}
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* UTM values out of an arbitrary object, accepting either spelling.
|
|
103
|
+
*
|
|
104
|
+
* A URL and Cal booking metadata carry `utm_source`; a JSON body posted by
|
|
105
|
+
* the signup page carries `utmSource`. Both arrive at server doors that
|
|
106
|
+
* write the same columns, so both are read here rather than making each
|
|
107
|
+
* caller remember which shape it is holding. camelCase wins when a caller
|
|
108
|
+
* somehow sends both, because that is the spelling the browser writes
|
|
109
|
+
* deliberately and the snake_case one is the raw URL echo.
|
|
110
|
+
*/
|
|
111
|
+
public static sanitizeUtm(value: JSONValue): UtmAttribution {
|
|
112
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
113
|
+
return {};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const input: JSONObject = value as JSONObject;
|
|
117
|
+
const result: JSONObject = {};
|
|
118
|
+
|
|
119
|
+
for (const wireKey of Object.keys(UtmWireKeyToPropertyKey)) {
|
|
120
|
+
const propertyKey: string = UtmWireKeyToPropertyKey[wireKey]!;
|
|
121
|
+
|
|
122
|
+
const sanitized: string | null =
|
|
123
|
+
sanitizeStringValue(input[propertyKey]) ??
|
|
124
|
+
sanitizeStringValue(input[wireKey]);
|
|
125
|
+
|
|
126
|
+
if (sanitized) {
|
|
127
|
+
result[propertyKey] = sanitized;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const utmUrl: string | null =
|
|
132
|
+
sanitizeStringValue(input[UtmUrlPropertyKey]) ??
|
|
133
|
+
sanitizeStringValue(input["utm_url"]) ??
|
|
134
|
+
sanitizeStringValue(input["landingUrl"]) ??
|
|
135
|
+
sanitizeStringValue(input["landing_url"]);
|
|
136
|
+
|
|
137
|
+
if (utmUrl) {
|
|
138
|
+
result[UtmUrlPropertyKey] = utmUrl;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return result as UtmAttribution;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// True when anything at all identifies where this visitor came from.
|
|
145
|
+
public static hasAnyAttribution(data: {
|
|
146
|
+
clickIds?: JSONObject | undefined;
|
|
147
|
+
utm?: UtmAttribution | undefined;
|
|
148
|
+
}): boolean {
|
|
149
|
+
if (data.clickIds && Object.keys(data.clickIds).length > 0) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!data.utm) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return UtmPropertyKeys.some((key: string) => {
|
|
158
|
+
return Boolean((data.utm as JSONObject)[key]);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
* The form an email is compared and hashed in.
|
|
164
|
+
*
|
|
165
|
+
* Trim and lowercase only — deliberately NOT gmail dot/plus folding. Every
|
|
166
|
+
* ad platform specifies exactly this normalisation before SHA-256, so
|
|
167
|
+
* folding further would produce a digest none of them can match, and the
|
|
168
|
+
* same value is used for OneUptime's own identity join so the two must not
|
|
169
|
+
* diverge.
|
|
170
|
+
*/
|
|
171
|
+
public static normalizeEmail(email: string | undefined): string | null {
|
|
172
|
+
if (typeof email !== "string") {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const normalized: string = email.trim().toLowerCase();
|
|
177
|
+
|
|
178
|
+
return normalized.length > 0 ? normalized : null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/*
|
|
182
|
+
* SHA-256 of the normalised email, hex encoded — the identifier every ad
|
|
183
|
+
* platform's enhanced matching expects, and the key the conversion ledger
|
|
184
|
+
* joins a booked meeting to the signup it later produced.
|
|
185
|
+
*/
|
|
186
|
+
public static hashEmail(email: string | undefined): string | null {
|
|
187
|
+
const normalized: string | null = this.normalizeEmail(email);
|
|
188
|
+
|
|
189
|
+
if (!normalized) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return crypto.createHash("sha256").update(normalized).digest("hex");
|
|
194
|
+
}
|
|
99
195
|
}
|