@oneuptime/common 13.0.7 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/AuditLog.ts +23 -15
- package/Models/DatabaseModels/GlobalConfig.ts +24 -0
- package/Models/DatabaseModels/Monitor.ts +3 -2
- package/Models/DatabaseModels/MonitorTemplate.ts +2 -1
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.ts +1 -1
- package/Models/DatabaseModels/ProjectOnCallCalendarFeed.ts +1 -1
- package/Models/DatabaseModels/UserOnCallCalendarFeed.ts +1 -1
- package/Scripts/generate-service-worker.js +65 -4
- package/Server/API/AIBillingAPI.ts +1 -0
- package/Server/API/AIInsightAPI.ts +1 -4
- package/Server/API/AIInvestigationAPI.ts +1 -4
- package/Server/API/AIReadinessAPI.ts +4 -5
- package/Server/API/AlertAPI.ts +1 -0
- package/Server/API/AutoRemediationAPI.ts +1 -4
- package/Server/API/BaseAPI.ts +34 -0
- package/Server/API/BaseAnalyticsAPI.ts +80 -9
- package/Server/API/BillingAPI.ts +2 -0
- package/Server/API/BillingInvoiceAPI.ts +1 -0
- package/Server/API/BillingPaymentMethodAPI.ts +2 -0
- package/Server/API/CodeFixRunAPI.ts +1 -3
- package/Server/API/CommonAPI.ts +68 -4
- package/Server/API/DashboardAPI.ts +12 -12
- package/Server/API/GlobalConfigAPI.ts +243 -460
- package/Server/API/IncidentAPI.ts +2 -0
- package/Server/API/IncidentEpisodeAPI.ts +1 -0
- package/Server/API/NotificationAPI.ts +1 -0
- package/Server/API/OnCallCalendarAPI.ts +4 -5
- package/Server/API/OnCallDutyPolicyAPI.ts +7 -0
- package/Server/API/OnCallReadinessAPI.ts +4 -1
- package/Server/API/OnCallScheduleTimelineAPI.ts +731 -0
- package/Server/API/ProjectAPI.ts +1 -0
- package/Server/API/ProjectOIDC.ts +25 -16
- package/Server/API/ProjectSSO.ts +24 -16
- package/Server/API/ScheduledMaintenanceAPI.ts +1 -0
- package/Server/API/StatusPageAPI.ts +261 -74
- package/Server/API/TeamMemberAPI.ts +13 -1
- package/Server/API/UserCallAPI.ts +2 -0
- package/Server/API/UserEmailAPI.ts +2 -0
- package/Server/API/UserIncomingCallNumberAPI.ts +2 -0
- package/Server/API/UserMicrosoftTeamsAPI.ts +1 -0
- package/Server/API/UserSlackAPI.ts +1 -0
- package/Server/API/UserSmsAPI.ts +2 -0
- package/Server/API/UserTotpAuthAPI.ts +1 -0
- package/Server/API/UserWebAuthnAPI.ts +2 -0
- package/Server/API/UserWebhookAPI.ts +1 -0
- package/Server/API/UserWhatsAppAPI.ts +2 -0
- package/Server/Enterprise/EnterpriseEdition.ts +649 -0
- package/Server/Enterprise/EnterpriseFeature.ts +48 -0
- package/Server/Enterprise/EnterpriseLicenseSnapshot.ts +192 -0
- package/Server/Enterprise/EnterpriseServerModule.ts +233 -0
- package/Server/EnvironmentConfig.ts +147 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1793900000000-AddEnterpriseEditionFirstSeenAt.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Middleware/MasterAdminAuthorization.ts +13 -2
- package/Server/Middleware/UserAuthorization.ts +117 -21
- package/Server/Services/ApiKeyPermissionService.ts +101 -4
- package/Server/Services/AuditLogService.ts +84 -1079
- package/Server/Services/DatabaseService.ts +245 -0
- package/Server/Services/DetectionRuleService.ts +5 -4
- package/Server/Services/EnterpriseLicenseService.ts +38 -0
- package/Server/Services/GlobalConfigService.ts +80 -1
- package/Server/Services/MonitorProbeService.ts +116 -20
- package/Server/Services/MonitorService.ts +56 -4
- package/Server/Services/MonitorStatusTimelineService.ts +284 -0
- package/Server/Services/MonitorTemplateService.ts +26 -0
- package/Server/Services/OnCallDutyPolicyChildService.ts +261 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +2 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +2 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +2 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +2 -2
- package/Server/Services/PayAsYouGoBillingService.ts +23 -28
- package/Server/Services/ProjectService.ts +302 -0
- package/Server/Services/RumSessionPinService.ts +293 -22
- package/Server/Services/StatusPagePrivateUserService.ts +7 -3
- package/Server/Services/StatusPageService.ts +78 -1
- package/Server/Services/TeamMemberService.ts +11 -0
- package/Server/Services/TeamPermissionService.ts +120 -26
- package/Server/Services/TeamService.ts +10 -0
- package/Server/Services/ThreatIntelFeedService.ts +6 -3
- package/Server/Services/UserService.ts +10 -17
- package/Server/Types/Database/Permissions/BasePermission.ts +9 -7
- package/Server/Types/Database/Permissions/CreatePermission.ts +15 -0
- package/Server/Types/Database/Permissions/EditionPermission.ts +208 -18
- package/Server/Types/Database/Permissions/Index.ts +75 -11
- package/Server/Types/Database/Permissions/TablePermission.ts +34 -31
- package/Server/Types/Database/Permissions/UpdatePermission.ts +29 -0
- package/Server/Types/Markdown.ts +41 -0
- package/Server/Utils/AI/AIChatPrivacyFilter.ts +8 -0
- package/Server/Utils/AI/AIRunPrivacyFilter.ts +8 -0
- package/Server/Utils/CommunityEditionSsoReport.ts +361 -0
- package/Server/Utils/EditionEnforcement.ts +233 -0
- package/Server/Utils/FrontendEnvironment.ts +41 -2
- package/Server/Utils/InstanceHealth/RedisHealth.ts +12 -277
- package/Server/Utils/MasterAdminPageAccess.ts +61 -0
- package/Server/Utils/Monitor/AffectedResourceList.ts +190 -0
- package/Server/Utils/Monitor/Criteria/EvaluateOverTime.ts +10 -1
- package/Server/Utils/Monitor/MonitorAlert.ts +3 -1
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +543 -333
- package/Server/Utils/Monitor/MonitorIncident.ts +3 -1
- package/Server/Utils/Monitor/MonitoringIntervalValidator.ts +116 -0
- package/Server/Utils/OnCall/OnCallCalendarFeedRenderer.ts +1 -1
- package/Server/Utils/Realtime.ts +163 -45
- package/Server/Utils/SecurityEvent/DetectionRuleEvaluator.ts +11 -28
- package/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.ts +170 -0
- package/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.ts +1 -1
- package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.ts +6 -2
- package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.ts +10 -9
- package/Server/Utils/Workspace/Slack/Slack.ts +423 -10
- package/Tests/App/Accounts/LoginPasskey.test.tsx +18 -0
- package/Tests/App/Accounts/LoginSsoEdition.test.tsx +616 -0
- package/Tests/App/AdminDashboard/AdminAuthenticationSsoEdition.test.tsx +217 -0
- package/Tests/App/AdminDashboard/AdminEnterprisePluginPage.test.tsx +357 -0
- package/Tests/App/AdminDashboard/EnterpriseLicensesShell.test.tsx +214 -0
- package/Tests/App/AdminDashboard/GlobalSSOEnterpriseShells.test.tsx +271 -0
- package/Tests/App/AdminDashboard/HealthShells.test.tsx +659 -0
- package/Tests/App/Dashboard/AffectedResourcesPicker.test.tsx +1059 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerEditForm.test.tsx +376 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerHiddenTypes.test.tsx +757 -0
- package/Tests/App/Dashboard/AffectedResourcesSummaryStep.test.tsx +307 -0
- package/Tests/App/Dashboard/ArgumentsFormGroupByUnlistedAttributes.test.tsx +131 -0
- package/Tests/App/Dashboard/AuditLogsAndComplianceShells.test.tsx +572 -0
- package/Tests/App/Dashboard/DashboardHeaderRequests.test.tsx +1 -1
- package/Tests/App/Dashboard/DashboardMonitorLabelVariable.test.tsx +9 -1
- package/Tests/App/Dashboard/DashboardVariableAllContract.test.tsx +24 -0
- package/Tests/App/Dashboard/DashboardVariableSelector.test.tsx +162 -8
- package/Tests/App/Dashboard/EnterpriseFeatureUpgrade.test.tsx +547 -0
- package/Tests/App/Dashboard/EnterprisePluginPage.test.tsx +667 -0
- package/Tests/App/Dashboard/EntityFilterDropdownArchivedSlos.test.tsx +105 -6
- package/Tests/App/Dashboard/EntityFilterDropdownUnlistedSelection.test.tsx +434 -0
- package/Tests/App/Dashboard/EscalationRuleReadiness.test.tsx +276 -1
- package/Tests/App/Dashboard/IdentityEnterpriseShells.test.tsx +319 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedSideMenus.test.tsx +9 -1
- package/Tests/App/Dashboard/OnboardingSsoEmptyState.test.tsx +185 -0
- package/Tests/App/Dashboard/PayAsYouGoConsentGate.test.tsx +58 -42
- package/Tests/App/Dashboard/PayAsYouGoNotices.test.tsx +42 -5
- package/Tests/App/Dashboard/ResourceAuditLogsSideMenus.test.tsx +34 -23
- package/Tests/App/Dashboard/ScheduleTimeline.test.tsx +1580 -0
- package/Tests/App/Dashboard/ScheduleTimelineAPI.test.ts +280 -0
- package/Tests/App/Dashboard/ScheduleTimelineModel.test.ts +673 -0
- package/Tests/App/Dashboard/SecurityEventConnectionDiagnostics.test.tsx +133 -70
- package/Tests/App/Dashboard/SecurityEventDetailPanel.test.tsx +399 -0
- package/Tests/App/Dashboard/SecurityEventListRow.test.tsx +214 -0
- package/Tests/App/Dashboard/SecurityEventsDetectionRulesPage.test.tsx +86 -3
- package/Tests/App/Dashboard/SecurityEventsEmptyState.test.tsx +1 -58
- package/Tests/App/Dashboard/SecurityEventsGuideContent.test.ts +1313 -0
- package/Tests/App/Dashboard/SecurityEventsHowItWorksCard.test.tsx +536 -0
- package/Tests/App/Dashboard/SecurityEventsNavTabs.test.tsx +248 -0
- package/Tests/App/Dashboard/SecurityEventsNoResults.test.tsx +222 -0
- package/Tests/App/Dashboard/SecurityEventsThreatIntelPage.test.tsx +199 -0
- package/Tests/App/Dashboard/SecurityEventsViewer.test.tsx +1203 -0
- package/Tests/App/Dashboard/SloOverviewHero.test.tsx +171 -36
- package/Tests/App/Dashboard/SloViewSideMenu.test.tsx +215 -0
- package/Tests/App/Dashboard/SloViewSideMenuCounts.test.tsx +40 -3
- package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +11 -91
- package/Tests/App/PublicDashboard/DashboardVariableSelector.test.tsx +12 -4
- package/Tests/App/PublicDashboard/PublicDashboardWidgetListAuth.test.tsx +623 -0
- package/Tests/App/StatusPage/StatusPageSsoEmptyState.test.tsx +319 -0
- package/Tests/Helpers/RefreshAwareApiScan.ts +757 -0
- package/Tests/Helpers/TenantScopedRequestScan.ts +515 -0
- package/Tests/Models/OnCallCalendarFeedModels.test.ts +23 -1
- package/Tests/Scripts/GenerateServiceWorker.test.ts +931 -0
- package/Tests/Server/API/AIChatRouteAuthorization.test.ts +138 -5
- package/Tests/Server/API/AIGenerationProjectAIToggle.test.ts +187 -0
- package/Tests/Server/API/AIInvestigationAvailabilityAuthorization.test.ts +51 -3
- package/Tests/Server/API/AIInvestigationEvidenceAPI.test.ts +55 -2
- package/Tests/Server/API/BaseAPICreateItemDoesNotMutateModel.test.ts +130 -0
- package/Tests/Server/API/BaseAnalyticsAPIAggregateCache.test.ts +729 -0
- package/Tests/Server/API/BillingPayAsYouGoStatus.test.ts +93 -7
- package/Tests/Server/API/BillingPaymentMethodAPI.test.ts +36 -3
- package/Tests/Server/API/CommonAPIAuthGuard.test.ts +1003 -24
- package/Tests/Server/API/DashboardPublicRateLimit.test.ts +6 -3
- package/Tests/Server/API/ExpiredSessionAIRoutes.test.ts +708 -0
- package/Tests/Server/API/ExpiredSessionCustomRoutes.test.ts +928 -0
- package/Tests/Server/API/ExpiredSessionMonitorTemplate.test.ts +319 -0
- package/Tests/Server/API/ExpiredSessionOnCallDutyPolicy.test.ts +336 -0
- package/Tests/Server/API/ExpiredSessionRouteGuards.test.ts +820 -0
- package/Tests/Server/API/GlobalConfigLicense.test.ts +766 -381
- package/Tests/Server/API/NotificationChannelVerificationAPI.test.ts +115 -12
- package/Tests/Server/API/OnCallCalendarAPI.test.ts +375 -8
- package/Tests/Server/API/OnCallReadinessAPI.test.ts +196 -912
- package/Tests/Server/API/OnCallScheduleTimelineAPI.test.ts +1513 -0
- package/Tests/Server/API/OnCallSetupReminderAPI.test.ts +119 -7
- package/Tests/Server/API/ProjectScopedCustomRouteAuth.test.ts +111 -4
- package/Tests/Server/API/PublicRouteInvalidAccessToken.test.ts +615 -0
- package/Tests/Server/API/SecurityEventAttributesAPI.test.ts +89 -2
- package/Tests/Server/API/SessionReplayAPI.test.ts +121 -0
- package/Tests/Server/API/SsoProviderListingsEdition.test.ts +432 -0
- package/Tests/Server/API/StatusPageMasterPasswordRateLimit.test.ts +4 -2
- package/Tests/Server/API/StatusPagePostmortemVisibility.test.ts +441 -0
- package/Tests/Server/API/StatusPageTestEmailReportAuth.test.ts +664 -0
- package/Tests/Server/API/TeamMemberLeaveScimLockEdition.test.ts +252 -0
- package/Tests/Server/API/TeamMemberRemoveUserFromProjectAPI.test.ts +7 -0
- package/Tests/Server/API/UserIncomingCallNumberApi.test.ts +6 -0
- package/Tests/Server/API/UserNotificationSettingAPI.test.ts +65 -4
- package/Tests/Server/API/UserProjectsAPI.test.ts +63 -3
- package/Tests/Server/API/UserTotpAuthAPI.test.ts +48 -2
- package/Tests/Server/API/UserWebAuthnAuthenticationOptionsRoute.test.ts +11 -2
- package/Tests/Server/API/UserWebAuthnBackupCodeMinting.test.ts +46 -3
- package/Tests/Server/API/UserWebAuthnPasskeyAPI.test.ts +18 -2
- package/Tests/Server/API/ZZVerifyChatsAuth.test.ts +24 -7
- package/Tests/Server/Enterprise/EnterpriseEdition.test.ts +824 -0
- package/Tests/Server/Enterprise/EnterpriseFeatureActive.test.ts +643 -0
- package/Tests/Server/Enterprise/EnterpriseLicenseSnapshot.test.ts +294 -0
- package/Tests/Server/Enterprise/EnterpriseModelFeatureMap.test.ts +93 -0
- package/Tests/Server/Enterprise/EnterpriseOnlyModulesLiveInEe.test.ts +582 -0
- package/Tests/Server/Enterprise/EnterpriseServerModule.test.ts +247 -0
- package/Tests/Server/Enterprise/FakeEnterpriseModule.ts +502 -0
- package/Tests/Server/Enterprise/TestBillingFlag.ts +70 -0
- package/Tests/Server/EnvironmentConfigEnterpriseEdition.test.ts +314 -0
- package/Tests/Server/Infrastructure/ContainerBootConfiguration.test.ts +289 -0
- package/Tests/Server/Infrastructure/E2EClickHouseFixtureAccess.test.ts +5 -1
- package/Tests/Server/Middleware/ExpiredSessionUserMiddleware.test.ts +563 -0
- package/Tests/Server/Middleware/MasterAdminAuthorization.test.ts +299 -19
- package/Tests/Server/Middleware/PublicRouteUserMiddleware.test.ts +453 -0
- package/Tests/Server/Middleware/UserAuthorization.test.ts +37 -2
- package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +516 -0
- package/Tests/Server/Services/AIChatPrivacyPin.test.ts +24 -0
- package/Tests/Server/Services/ApiKeyPermissionSecurity.test.ts +2 -0
- package/Tests/Server/Services/ApiKeyPermissionService.test.ts +3 -3
- package/Tests/Server/Services/AuditLogService.test.ts +460 -990
- package/Tests/Server/Services/CreateAndReadResponsesKeepIds.test.ts +263 -0
- package/Tests/Server/Services/DatabaseServiceCreateSuppliedId.test.ts +147 -0
- package/Tests/Server/Services/DatabaseServiceLoginBeforeHooks.test.ts +1078 -0
- package/Tests/Server/Services/DatabaseServiceTenantRelationGuard.test.ts +259 -0
- package/Tests/Server/Services/DatabaseServiceWriteOperatorValues.test.ts +147 -0
- package/Tests/Server/Services/EnterpriseLicenseServiceKeyGeneration.test.ts +151 -0
- package/Tests/Server/Services/GlobalConfigServiceLicenseColumns.test.ts +357 -0
- package/Tests/Server/Services/MonitorDestinationInfoIPv6.test.ts +101 -0
- package/Tests/Server/Services/MonitorPayAsYouGoBilling.test.ts +115 -1
- package/Tests/Server/Services/MonitorProbeServiceIntervalScheduling.test.ts +333 -0
- package/Tests/Server/Services/MonitorStatusTimelineDailyAggregates.test.ts +303 -0
- package/Tests/Server/Services/OnCallChildCreateAuthorizationPostgres.test.ts +711 -0
- package/Tests/Server/Services/OnCallDutyPolicyChildService.test.ts +733 -0
- package/Tests/Server/Services/PayAsYouGoBillingService.test.ts +190 -140
- package/Tests/Server/Services/PayAsYouGoStripeRateLimitBudget.test.ts +4 -9
- package/Tests/Server/Services/PermissionBlockDeletion.test.ts +780 -0
- package/Tests/Server/Services/PermissionBlockDeletionPostgres.test.ts +628 -0
- package/Tests/Server/Services/ProjectServiceAuditLogLicense.test.ts +701 -0
- package/Tests/Server/Services/ProjectServiceAuditLogSettingsCache.test.ts +31 -35
- package/Tests/Server/Services/ProjectServiceCreateSubscriptionStarted.test.ts +77 -1
- package/Tests/Server/Services/RumSessionPinCreatePermission.test.ts +715 -0
- package/Tests/Server/Services/ScimPushGroupsTeamLocksEdition.test.ts +431 -0
- package/Tests/Server/Services/SsoRequirementReadMasking.test.ts +419 -0
- package/Tests/Server/Services/SsoRequirementWriteGuard.test.ts +769 -0
- package/Tests/Server/Services/StatusPagePrivateUserInvitationPolicy.test.ts +94 -0
- package/Tests/Server/Services/TeamMemberMultiTenantReadPostgres.test.ts +394 -0
- package/Tests/Server/Services/TeamPrivilegeEscalation.test.ts +6 -0
- package/Tests/Server/Services/TelemetryPayAsYouGoBilling.test.ts +131 -0
- package/Tests/Server/Services/UserAuthenticationService.test.ts +35 -0
- package/Tests/Server/Services/UserNotificationRuleAdminGuards.test.ts +13 -2
- package/Tests/Server/Services/UserServiceSeatLimit.test.ts +94 -56
- package/Tests/Server/Types/Database/Permissions/EditionPermission.test.ts +1823 -0
- package/Tests/Server/Types/Database/Permissions/ModelPermissionAnonymousRefusal.test.ts +518 -0
- package/Tests/Server/Types/Database/Permissions/MultiTenantPermissions.test.ts +350 -0
- package/Tests/Server/Types/Database/Permissions/OnCallCalendarFeedPermissions.test.ts +282 -25
- package/Tests/Server/Types/Database/Permissions/TableLevelBlockPermission.test.ts +459 -0
- package/Tests/Server/Types/Markdown.test.ts +181 -0
- package/Tests/Server/Utils/AI/AIRunPrivacyFilter.test.ts +101 -9
- package/Tests/Server/Utils/AI/ChatAgentHelpers.test.ts +88 -4
- package/Tests/Server/Utils/AI/Toolbox/ExceptionTools.test.ts +459 -0
- package/Tests/Server/Utils/AI/Toolbox/LogTools.test.ts +794 -0
- package/Tests/Server/Utils/AI/Toolbox/RecentChangesTools.test.ts +574 -0
- package/Tests/Server/Utils/AI/Toolbox/SecurityEventTools.test.ts +596 -0
- package/Tests/Server/Utils/CaptchaRequestAndLogging.test.ts +395 -0
- package/Tests/Server/Utils/CommunityEditionSsoReport.test.ts +565 -0
- package/Tests/Server/Utils/EditionEnforcement.test.ts +303 -0
- package/Tests/Server/Utils/FrontendEnvironment.test.ts +367 -0
- package/Tests/Server/Utils/InstanceHealth/RedisHealth.test.ts +38 -418
- package/Tests/Server/Utils/MasterAdminPageAccess.test.ts +251 -0
- package/Tests/Server/Utils/Monitor/AffectedResourceList.test.ts +518 -0
- package/Tests/Server/Utils/Monitor/Criteria/EvaluateOverTime.test.ts +24 -4
- package/Tests/Server/Utils/Monitor/MonitorActionTimestamps.test.ts +616 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +934 -96
- package/Tests/Server/Utils/Monitor/MonitoringIntervalValidator.test.ts +188 -0
- package/Tests/Server/Utils/Realtime.test.ts +502 -0
- package/Tests/Server/Utils/SecurityEvent/Connectors/GoogleSecOps/GoogleSecOpsConnectorSeverity.test.ts +216 -0
- package/Tests/Server/Utils/SecurityEvent/DetectionRuleEvaluator.test.ts +142 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.test.ts +140 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepairClickhouseIntegration.test.ts +542 -0
- package/Tests/Server/Utils/Telemetry/ChangeEventRow.test.ts +743 -0
- package/Tests/Server/Utils/Telemetry/RuntimeMetrics.test.ts +465 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.test.ts +202 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/Messages/Incident.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/Messages/ScheduledMaintenance.test.ts +231 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/Alert.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/AlertEpisode.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/Incident.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/ScheduledMaintenance.test.ts +247 -0
- package/Tests/Server/Utils/Workspace/Slack/SlackMarkdownSectionSplit.test.ts +1209 -0
- package/Tests/Types/AI/AIInsightEvidence.test.ts +206 -0
- package/Tests/Types/API/HostnameFromAuthority.test.ts +20 -10
- package/Tests/Types/API/HostnameIPv6.test.ts +149 -0
- package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtilAnonymous.test.ts +144 -0
- package/Tests/Types/Call/CallProvider.test.ts +528 -0
- package/Tests/Types/Database/CanonicalModelInstance.test.ts +190 -0
- package/Tests/Types/Kubernetes/KubernetesCostIngest.test.ts +236 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleTimeline.test.ts +736 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleTimelineLayout.test.ts +996 -0
- package/Tests/Types/SecurityEvent/SigmaRule.test.ts +142 -0
- package/Tests/Types/Workflow/Components/JSON.test.ts +182 -0
- package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +116 -1
- package/Tests/UI/Components/Dropdown/DropdownAsyncOptions.test.tsx +81 -0
- package/Tests/UI/Components/EditionLabelLapseCopy.ts +104 -0
- package/Tests/UI/Components/EditionLabelLicenseManagerWiring.test.tsx +254 -0
- package/Tests/UI/Components/EditionLabelLicenseRefresh.test.tsx +165 -171
- package/Tests/UI/Components/EditionLabelLicenseStatus.test.tsx +1586 -0
- package/Tests/UI/Components/EditionLabelLicenseWritesGuard.test.tsx +157 -0
- package/Tests/UI/Components/EventAttachmentList.test.tsx +174 -0
- package/Tests/UI/Components/Forms/BasicFormBurnRateTemplateDefaults.test.tsx +395 -0
- package/Tests/UI/Components/Forms/BasicFormCollapsibleSections.test.tsx +286 -0
- package/Tests/UI/Components/Forms/FormSummary.test.tsx +128 -0
- package/Tests/UI/Components/Graphs/DayUptimeGraph.test.tsx +49 -2
- package/Tests/UI/Components/MarkdownConverters.test.ts +684 -0
- package/Tests/UI/Components/ModelListEmptyState.test.tsx +289 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableQueryChange.test.tsx +365 -0
- package/Tests/UI/Components/OpenAuthenticatedUrl.test.ts +358 -0
- package/Tests/UI/Components/SessionAwareImage.test.tsx +496 -0
- package/Tests/UI/Components/TelemetryHistogramZeroBuckets.test.tsx +190 -0
- package/Tests/UI/Components/TelemetryViewer/TelemetryViewerEmptyContent.test.tsx +131 -0
- package/Tests/UI/Components/TooltipInteractive.test.tsx +97 -0
- package/Tests/UI/EsbuildEnterpriseAlias.test.ts +1127 -0
- package/Tests/UI/MicrosoftTeams/MicrosoftTeamsChatsCardInstallGuidance.test.tsx +1 -1
- package/Tests/UI/Monitor/EvaluationLogListTimestamps.test.tsx +367 -0
- package/Tests/UI/Utils/API/BaseAPIRefreshSession.test.ts +1087 -0
- package/Tests/UI/Utils/API/DashboardHost.ts +12 -0
- package/Tests/UI/Utils/API/FakeAxiosServer.ts +183 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +10 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +2 -0
- package/Tests/UI/Utils/Cookie.test.ts +440 -0
- package/Tests/UI/Utils/ModelAPIRequestClient.test.ts +278 -0
- package/Tests/UI/Utils/Navigation.test.ts +33 -0
- package/Tests/UI/Utils/PricingPlan.test.ts +295 -0
- package/Tests/UI/Utils/Realtime.test.ts +759 -0
- package/Tests/UI/Utils/Telemetry/Telemetry.test.ts +500 -0
- package/Tests/Utils/APIInstanceDispatch.test.ts +311 -0
- package/Tests/Utils/HostAddressUtil.test.ts +138 -0
- package/Tests/Utils/Monitor/MonitorDestinationUtil.test.ts +313 -0
- package/Tests/Utils/Monitor/MonitoringIntervalUtil.test.ts +304 -0
- package/Tests/Utils/SecurityEvent/GoogleSecOpsAlertNormalizerSeverity.test.ts +565 -0
- package/Tests/Utils/StatusPage/UptimeDailyAggregateUtil.test.ts +248 -0
- package/Types/API/Hostname.ts +63 -16
- package/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.ts +40 -0
- package/Types/Database/AccessControl/ColumnAccessControl.ts +19 -7
- package/Types/Database/AccessControl/ColumnBillingAccessControl.ts +19 -7
- package/Types/Database/AccessControl/OwnerOnlyColumn.ts +15 -6
- package/Types/Database/CanonicalModelInstance.ts +102 -0
- package/Types/Database/TableColumn.ts +20 -6
- package/Types/EnterpriseLicense/EnterpriseLicensePeriods.ts +29 -0
- package/Types/IP/IPv6.ts +6 -1
- package/Types/Monitor/MonitorEvaluationSummary.ts +3 -0
- package/Types/Monitor/MonitorStep.ts +6 -1
- package/Types/Monitor/ProxmoxAlertTemplates.ts +1 -1
- package/Types/OnCallDutyPolicy/ScheduleTimeline.ts +507 -0
- package/Types/OnCallDutyPolicy/ScheduleTimelineLayout.ts +589 -0
- package/Types/Realtime/EventName.ts +11 -0
- package/Types/SecurityEvent/DetectionFindingConstants.ts +14 -0
- package/Types/SecurityEvent/OcsfSeverity.ts +31 -26
- package/Types/SecurityEvent/SigmaRule.ts +51 -0
- package/Types/SecurityEvent/ThreatIntelConstants.ts +18 -0
- package/Types/StatusPage/UptimeDailyAggregate.ts +110 -0
- package/UI/Components/AttachmentList/EventAttachmentList.tsx +30 -2
- package/UI/Components/Dashboard/DashboardVariableControl.tsx +12 -2
- package/UI/Components/Dropdown/Dropdown.tsx +6 -1
- package/UI/Components/EditionLabel/EditionLabel.tsx +808 -1195
- package/UI/Components/EditionLabel/LicenseManager.ts +119 -0
- package/UI/Components/EventItem/EventItem.tsx +12 -1
- package/UI/Components/Forms/BasicForm.tsx +151 -126
- package/UI/Components/Forms/CollapsibleFormSection.tsx +63 -0
- package/UI/Components/Forms/Fields/FormField.tsx +10 -4
- package/UI/Components/Forms/FormSummary.tsx +7 -0
- package/UI/Components/Forms/Types/Field.ts +10 -0
- package/UI/Components/Graphs/DayUptimeGraph.tsx +123 -15
- package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +2 -1
- package/UI/Components/Markdown.tsx/SessionAwareImage.tsx +122 -0
- package/UI/Components/ModelList/ModelList.tsx +11 -1
- package/UI/Components/ModelTable/BaseModelTable.tsx +34 -5
- package/UI/Components/ModelTable/TableView.tsx +1 -1
- package/UI/Components/MonitorGraphs/Uptime.tsx +69 -0
- package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +28 -12
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +8 -1
- package/UI/Components/Tooltip/Tooltip.tsx +8 -1
- package/UI/Utils/API/API.ts +173 -12
- package/UI/Utils/API/RequestOptions.ts +11 -0
- package/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.ts +31 -7
- package/UI/Utils/ModelAPI/ModelAPI.ts +30 -9
- package/UI/Utils/Navigation.ts +9 -0
- package/UI/Utils/OpenAuthenticatedUrl.ts +154 -0
- package/UI/Utils/Realtime.ts +176 -30
- package/UI/esbuild-enterprise.js +263 -0
- package/Utils/API.ts +14 -5
- package/Utils/EnterpriseLicense/EnterpriseLicenseUsage.ts +7 -2
- package/Utils/HostAddressUtil.ts +94 -0
- package/Utils/Monitor/MonitorDestinationUtil.ts +157 -0
- package/Utils/Monitor/MonitoringIntervalUtil.ts +436 -0
- package/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.ts +157 -7
- package/Utils/SecurityEvent/Sigma/SigmaRuleParser.ts +9 -17
- package/Utils/Slo/SloBurnRateTemplate.ts +2 -2
- package/Utils/StatusPage/UptimeDailyAggregateUtil.ts +192 -0
- package/build/dist/Models/AnalyticsModels/AuditLog.js +23 -15
- package/build/dist/Models/AnalyticsModels/AuditLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +25 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +2 -2
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js +2 -1
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProjectOnCallCalendarFeed.js +1 -1
- package/build/dist/Models/DatabaseModels/ProjectOnCallCalendarFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallCalendarFeed.js +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallCalendarFeed.js.map +1 -1
- package/build/dist/Server/API/AIBillingAPI.js +1 -1
- package/build/dist/Server/API/AIBillingAPI.js.map +1 -1
- package/build/dist/Server/API/AIInsightAPI.js +1 -4
- package/build/dist/Server/API/AIInsightAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +1 -4
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AIReadinessAPI.js +1 -3
- package/build/dist/Server/API/AIReadinessAPI.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +1 -1
- package/build/dist/Server/API/AlertAPI.js.map +1 -1
- package/build/dist/Server/API/AutoRemediationAPI.js +1 -4
- package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAPI.js +33 -0
- package/build/dist/Server/API/BaseAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAnalyticsAPI.js +55 -10
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/BillingAPI.js +2 -2
- package/build/dist/Server/API/BillingAPI.js.map +1 -1
- package/build/dist/Server/API/BillingInvoiceAPI.js +1 -1
- package/build/dist/Server/API/BillingInvoiceAPI.js.map +1 -1
- package/build/dist/Server/API/BillingPaymentMethodAPI.js +2 -2
- package/build/dist/Server/API/BillingPaymentMethodAPI.js.map +1 -1
- package/build/dist/Server/API/CodeFixRunAPI.js +1 -3
- package/build/dist/Server/API/CodeFixRunAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +50 -5
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +12 -12
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/GlobalConfigAPI.js +158 -342
- package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +2 -2
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
- package/build/dist/Server/API/NotificationAPI.js +1 -1
- package/build/dist/Server/API/NotificationAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallCalendarAPI.js +1 -4
- package/build/dist/Server/API/OnCallCalendarAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallDutyPolicyAPI.js +6 -0
- package/build/dist/Server/API/OnCallDutyPolicyAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallReadinessAPI.js +4 -1
- package/build/dist/Server/API/OnCallReadinessAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallScheduleTimelineAPI.js +494 -0
- package/build/dist/Server/API/OnCallScheduleTimelineAPI.js.map +1 -0
- package/build/dist/Server/API/ProjectAPI.js +1 -1
- package/build/dist/Server/API/ProjectAPI.js.map +1 -1
- package/build/dist/Server/API/ProjectOIDC.js +24 -16
- package/build/dist/Server/API/ProjectOIDC.js.map +1 -1
- package/build/dist/Server/API/ProjectSSO.js +24 -16
- package/build/dist/Server/API/ProjectSSO.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +218 -76
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/TeamMemberAPI.js +11 -4
- package/build/dist/Server/API/TeamMemberAPI.js.map +1 -1
- package/build/dist/Server/API/UserCallAPI.js +2 -2
- package/build/dist/Server/API/UserCallAPI.js.map +1 -1
- package/build/dist/Server/API/UserEmailAPI.js +2 -2
- package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
- package/build/dist/Server/API/UserIncomingCallNumberAPI.js +2 -2
- package/build/dist/Server/API/UserIncomingCallNumberAPI.js.map +1 -1
- package/build/dist/Server/API/UserMicrosoftTeamsAPI.js +1 -1
- package/build/dist/Server/API/UserMicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/UserSlackAPI.js +1 -1
- package/build/dist/Server/API/UserSlackAPI.js.map +1 -1
- package/build/dist/Server/API/UserSmsAPI.js +2 -2
- package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
- package/build/dist/Server/API/UserTotpAuthAPI.js +1 -1
- package/build/dist/Server/API/UserTotpAuthAPI.js.map +1 -1
- package/build/dist/Server/API/UserWebAuthnAPI.js +2 -2
- package/build/dist/Server/API/UserWebAuthnAPI.js.map +1 -1
- package/build/dist/Server/API/UserWebhookAPI.js +1 -1
- package/build/dist/Server/API/UserWebhookAPI.js.map +1 -1
- package/build/dist/Server/API/UserWhatsAppAPI.js +2 -2
- package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -1
- package/build/dist/Server/Enterprise/EnterpriseEdition.js +466 -0
- package/build/dist/Server/Enterprise/EnterpriseEdition.js.map +1 -0
- package/build/dist/Server/Enterprise/EnterpriseFeature.js +39 -0
- package/build/dist/Server/Enterprise/EnterpriseFeature.js.map +1 -0
- package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js +70 -0
- package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js.map +1 -0
- package/build/dist/Server/Enterprise/EnterpriseServerModule.js +84 -0
- package/build/dist/Server/Enterprise/EnterpriseServerModule.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +84 -2
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1793900000000-AddEnterpriseEditionFirstSeenAt.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1793900000000-AddEnterpriseEditionFirstSeenAt.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js +11 -2
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +94 -15
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Services/ApiKeyPermissionService.js +80 -4
- package/build/dist/Server/Services/ApiKeyPermissionService.js.map +1 -1
- package/build/dist/Server/Services/AuditLogService.js +71 -740
- package/build/dist/Server/Services/AuditLogService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +171 -0
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DetectionRuleService.js +4 -4
- package/build/dist/Server/Services/DetectionRuleService.js.map +1 -1
- package/build/dist/Server/Services/EnterpriseLicenseService.js +34 -0
- package/build/dist/Server/Services/EnterpriseLicenseService.js.map +1 -1
- package/build/dist/Server/Services/GlobalConfigService.js +63 -0
- package/build/dist/Server/Services/GlobalConfigService.js.map +1 -1
- package/build/dist/Server/Services/MonitorProbeService.js +90 -17
- package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +45 -4
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorStatusTimelineService.js +242 -0
- package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +16 -0
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyChildService.js +170 -0
- package/build/dist/Server/Services/OnCallDutyPolicyChildService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/PayAsYouGoBillingService.js +20 -27
- package/build/dist/Server/Services/PayAsYouGoBillingService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +231 -0
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/RumSessionPinService.js +198 -16
- package/build/dist/Server/Services/RumSessionPinService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserService.js +7 -3
- package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +71 -0
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +10 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/TeamPermissionService.js +89 -27
- package/build/dist/Server/Services/TeamPermissionService.js.map +1 -1
- package/build/dist/Server/Services/TeamService.js +9 -0
- package/build/dist/Server/Services/TeamService.js.map +1 -1
- package/build/dist/Server/Services/ThreatIntelFeedService.js +5 -4
- package/build/dist/Server/Services/ThreatIntelFeedService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +10 -16
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js +9 -6
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/CreatePermission.js +10 -0
- package/build/dist/Server/Types/Database/Permissions/CreatePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/EditionPermission.js +154 -14
- package/build/dist/Server/Types/Database/Permissions/EditionPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/Index.js +60 -6
- package/build/dist/Server/Types/Database/Permissions/Index.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TablePermission.js +24 -16
- package/build/dist/Server/Types/Database/Permissions/TablePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js +17 -0
- package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +31 -0
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js +7 -0
- package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js.map +1 -1
- package/build/dist/Server/Utils/AI/AIRunPrivacyFilter.js +7 -0
- package/build/dist/Server/Utils/AI/AIRunPrivacyFilter.js.map +1 -1
- package/build/dist/Server/Utils/CommunityEditionSsoReport.js +223 -0
- package/build/dist/Server/Utils/CommunityEditionSsoReport.js.map +1 -0
- package/build/dist/Server/Utils/EditionEnforcement.js +187 -0
- package/build/dist/Server/Utils/EditionEnforcement.js.map +1 -0
- package/build/dist/Server/Utils/FrontendEnvironment.js +31 -2
- package/build/dist/Server/Utils/FrontendEnvironment.js.map +1 -1
- package/build/dist/Server/Utils/InstanceHealth/RedisHealth.js +6 -193
- package/build/dist/Server/Utils/InstanceHealth/RedisHealth.js.map +1 -1
- package/build/dist/Server/Utils/MasterAdminPageAccess.js +39 -0
- package/build/dist/Server/Utils/MasterAdminPageAccess.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/AffectedResourceList.js +96 -0
- package/build/dist/Server/Utils/Monitor/AffectedResourceList.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js +8 -1
- package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +3 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +449 -261
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +3 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitoringIntervalValidator.js +88 -0
- package/build/dist/Server/Utils/Monitor/MonitoringIntervalValidator.js.map +1 -0
- package/build/dist/Server/Utils/Realtime.js +126 -37
- package/build/dist/Server/Utils/Realtime.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js +7 -25
- package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.js +127 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.js +1 -1
- package/build/dist/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.js +3 -2
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.js +4 -8
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +331 -11
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Types/API/Hostname.js +59 -11
- package/build/dist/Types/API/Hostname.js.map +1 -1
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js +31 -1
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js.map +1 -1
- package/build/dist/Types/Database/AccessControl/ColumnAccessControl.js +19 -7
- package/build/dist/Types/Database/AccessControl/ColumnAccessControl.js.map +1 -1
- package/build/dist/Types/Database/AccessControl/ColumnBillingAccessControl.js +19 -7
- package/build/dist/Types/Database/AccessControl/ColumnBillingAccessControl.js.map +1 -1
- package/build/dist/Types/Database/AccessControl/OwnerOnlyColumn.js +13 -6
- package/build/dist/Types/Database/AccessControl/OwnerOnlyColumn.js.map +1 -1
- package/build/dist/Types/Database/CanonicalModelInstance.js +88 -0
- package/build/dist/Types/Database/CanonicalModelInstance.js.map +1 -0
- package/build/dist/Types/Database/TableColumn.js +19 -6
- package/build/dist/Types/Database/TableColumn.js.map +1 -1
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js +28 -0
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js.map +1 -0
- package/build/dist/Types/IP/IPv6.js +6 -1
- package/build/dist/Types/IP/IPv6.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +5 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js +1 -1
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimeline.js +321 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimeline.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimelineLayout.js +372 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimelineLayout.js.map +1 -0
- package/build/dist/Types/Realtime/EventName.js +10 -0
- package/build/dist/Types/Realtime/EventName.js.map +1 -1
- package/build/dist/Types/SecurityEvent/DetectionFindingConstants.js +11 -0
- package/build/dist/Types/SecurityEvent/DetectionFindingConstants.js.map +1 -1
- package/build/dist/Types/SecurityEvent/OcsfSeverity.js +30 -25
- package/build/dist/Types/SecurityEvent/OcsfSeverity.js.map +1 -1
- package/build/dist/Types/SecurityEvent/SigmaRule.js +47 -0
- package/build/dist/Types/SecurityEvent/SigmaRule.js.map +1 -1
- package/build/dist/Types/SecurityEvent/ThreatIntelConstants.js +14 -0
- package/build/dist/Types/SecurityEvent/ThreatIntelConstants.js.map +1 -1
- package/build/dist/Types/StatusPage/UptimeDailyAggregate.js +32 -0
- package/build/dist/Types/StatusPage/UptimeDailyAggregate.js.map +1 -0
- package/build/dist/UI/Components/AttachmentList/EventAttachmentList.js +9 -4
- package/build/dist/UI/Components/AttachmentList/EventAttachmentList.js.map +1 -1
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js +10 -2
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +5 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js +425 -585
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
- package/build/dist/UI/Components/EditionLabel/LicenseManager.js +2 -0
- package/build/dist/UI/Components/EditionLabel/LicenseManager.js.map +1 -0
- package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
- package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +70 -64
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/CollapsibleFormSection.js +27 -0
- package/build/dist/UI/Components/Forms/CollapsibleFormSection.js.map +1 -0
- package/build/dist/UI/Components/Forms/Fields/FormField.js +10 -7
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Forms/FormSummary.js +7 -0
- package/build/dist/UI/Components/Forms/FormSummary.js.map +1 -1
- package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +90 -17
- package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +2 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/SessionAwareImage.js +84 -0
- package/build/dist/UI/Components/Markdown.tsx/SessionAwareImage.js.map +1 -0
- package/build/dist/UI/Components/ModelList/ModelList.js +4 -1
- package/build/dist/UI/Components/ModelList/ModelList.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +14 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/MonitorGraphs/Uptime.js +42 -1
- package/build/dist/UI/Components/MonitorGraphs/Uptime.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +2 -2
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js +2 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js.map +1 -1
- package/build/dist/UI/Utils/API/API.js +143 -19
- package/build/dist/UI/Utils/API/API.js.map +1 -1
- package/build/dist/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.js +21 -7
- package/build/dist/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js +26 -9
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +8 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/OpenAuthenticatedUrl.js +92 -0
- package/build/dist/UI/Utils/OpenAuthenticatedUrl.js.map +1 -0
- package/build/dist/UI/Utils/Realtime.js +120 -15
- package/build/dist/UI/Utils/Realtime.js.map +1 -1
- package/build/dist/Utils/API.js +13 -5
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js +6 -2
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js.map +1 -1
- package/build/dist/Utils/HostAddressUtil.js +80 -0
- package/build/dist/Utils/HostAddressUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorDestinationUtil.js +127 -0
- package/build/dist/Utils/Monitor/MonitorDestinationUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitoringIntervalUtil.js +374 -0
- package/build/dist/Utils/Monitor/MonitoringIntervalUtil.js.map +1 -0
- package/build/dist/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.js +123 -6
- package/build/dist/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.js.map +1 -1
- package/build/dist/Utils/SecurityEvent/Sigma/SigmaRuleParser.js +4 -18
- package/build/dist/Utils/SecurityEvent/Sigma/SigmaRuleParser.js.map +1 -1
- package/build/dist/Utils/Slo/SloBurnRateTemplate.js +2 -2
- package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js +148 -0
- package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js.map +1 -0
- package/jest.config.json +3 -1
- package/package.json +1 -1
- package/test-setup.sh +103 -34
- package/tsconfig.json +13 -0
- package/Server/API/EnterpriseLicenseAPI.ts +0 -925
- package/Server/API/TeamComplianceAPI.ts +0 -158
- package/Server/Middleware/SCIMAuthorization.ts +0 -141
- package/Server/Services/TeamComplianceService.ts +0 -733
- package/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.ts +0 -186
- package/Server/Utils/InstanceHealth/PostgresHealth.ts +0 -286
- package/Tests/App/AdminDashboard/EnterpriseLicenseInstanceActivity.test.tsx +0 -451
- package/Tests/App/Dashboard/AuditLogsTable.test.tsx +0 -598
- package/Tests/App/Dashboard/SecurityEventsSideMenu.test.tsx +0 -247
- package/Tests/App/Dashboard/SecurityEventsTableColumns.test.tsx +0 -382
- package/Tests/Server/API/EnterpriseLicenseReportUserCount.test.ts +0 -1851
- package/Tests/Server/Middleware/SCIMAuthorization.test.ts +0 -525
- package/Tests/Server/Services/TeamComplianceServiceBehaviour.test.ts +0 -1845
- package/Tests/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.test.ts +0 -495
- package/Tests/Server/Utils/InstanceHealth/PostgresHealth.test.ts +0 -337
- package/Tests/Utils/EnterpriseLicenseSeats.test.ts +0 -576
- package/Tests/Utils/EnterpriseLicenseSync.test.ts +0 -568
- package/Utils/EnterpriseLicense/EnterpriseLicenseSeats.ts +0 -287
- package/Utils/EnterpriseLicense/EnterpriseLicenseSync.ts +0 -244
- package/build/dist/Server/API/EnterpriseLicenseAPI.js +0 -646
- package/build/dist/Server/API/EnterpriseLicenseAPI.js.map +0 -1
- package/build/dist/Server/API/TeamComplianceAPI.js +0 -111
- package/build/dist/Server/API/TeamComplianceAPI.js.map +0 -1
- package/build/dist/Server/Middleware/SCIMAuthorization.js +0 -124
- package/build/dist/Server/Middleware/SCIMAuthorization.js.map +0 -1
- package/build/dist/Server/Services/TeamComplianceService.js +0 -537
- package/build/dist/Server/Services/TeamComplianceService.js.map +0 -1
- package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js +0 -145
- package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js.map +0 -1
- package/build/dist/Server/Utils/InstanceHealth/PostgresHealth.js +0 -194
- package/build/dist/Server/Utils/InstanceHealth/PostgresHealth.js.map +0 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js +0 -168
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js.map +0 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSync.js +0 -174
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSync.js.map +0 -1
|
@@ -2,6 +2,8 @@ import CreateBy from "../Types/Database/CreateBy";
|
|
|
2
2
|
import DeleteBy from "../Types/Database/DeleteBy";
|
|
3
3
|
import { OnCreate, OnDelete, OnUpdate } from "../Types/Database/Hooks";
|
|
4
4
|
import UpdateBy from "../Types/Database/UpdateBy";
|
|
5
|
+
import ModelPermission from "../Types/Database/Permissions/Index";
|
|
6
|
+
import QueryHelper from "../Types/Database/QueryHelper";
|
|
5
7
|
import AccessTokenService from "./AccessTokenService";
|
|
6
8
|
import DatabaseService from "./DatabaseService";
|
|
7
9
|
import TeamMemberService from "./TeamMemberService";
|
|
@@ -11,7 +13,7 @@ import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCom
|
|
|
11
13
|
import DatabaseCommonInteractionPropsUtil, {
|
|
12
14
|
PermissionType,
|
|
13
15
|
} from "../../Types/BaseDatabase/DatabaseCommonInteractionPropsUtil";
|
|
14
|
-
import LIMIT_MAX
|
|
16
|
+
import LIMIT_MAX from "../../Types/Database/LimitMax";
|
|
15
17
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
16
18
|
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
17
19
|
import PermissionScope from "../../Types/Database/AccessControl/PermissionScope";
|
|
@@ -112,6 +114,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
112
114
|
data.props,
|
|
113
115
|
PermissionType.Allow,
|
|
114
116
|
);
|
|
117
|
+
const callerBlocks: Array<UserPermission> =
|
|
118
|
+
DatabaseCommonInteractionPropsUtil.getUserPermissions(
|
|
119
|
+
data.props,
|
|
120
|
+
PermissionType.Block,
|
|
121
|
+
);
|
|
115
122
|
|
|
116
123
|
/*
|
|
117
124
|
* ProjectOwner is the sole tenant-level delegation override. In
|
|
@@ -123,6 +130,12 @@ export class Service extends DatabaseService<Model> {
|
|
|
123
130
|
*/
|
|
124
131
|
if (
|
|
125
132
|
callerPermissions.some((permission: UserPermission) => {
|
|
133
|
+
return (
|
|
134
|
+
permission.permission === Permission.ProjectOwner &&
|
|
135
|
+
this.permissionCoversGrant(permission, PermissionScope.All, [])
|
|
136
|
+
);
|
|
137
|
+
}) &&
|
|
138
|
+
!callerBlocks.some((permission: UserPermission) => {
|
|
126
139
|
return permission.permission === Permission.ProjectOwner;
|
|
127
140
|
})
|
|
128
141
|
) {
|
|
@@ -142,7 +155,38 @@ export class Service extends DatabaseService<Model> {
|
|
|
142
155
|
);
|
|
143
156
|
});
|
|
144
157
|
|
|
145
|
-
|
|
158
|
+
const matchingBlocks: Array<UserPermission> = callerBlocks.filter(
|
|
159
|
+
(permission: UserPermission) => {
|
|
160
|
+
return permission.permission === data.permission;
|
|
161
|
+
},
|
|
162
|
+
);
|
|
163
|
+
const targetHasLabelScope: boolean =
|
|
164
|
+
targetLabelIds.length > 0 &&
|
|
165
|
+
data.scope !== PermissionScope.All &&
|
|
166
|
+
data.scope !== PermissionScope.Owned;
|
|
167
|
+
const isBlocked: boolean = matchingBlocks.some(
|
|
168
|
+
(permission: UserPermission) => {
|
|
169
|
+
/*
|
|
170
|
+
* An unrestricted/Owned grant may include resources blocked from the
|
|
171
|
+
* caller. Ownership also cannot be transferred between principals.
|
|
172
|
+
*/
|
|
173
|
+
if (
|
|
174
|
+
!targetHasLabelScope ||
|
|
175
|
+
permission.scope === PermissionScope.All ||
|
|
176
|
+
permission.scope === PermissionScope.Owned ||
|
|
177
|
+
permission.labelIds.length === 0
|
|
178
|
+
) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
return permission.labelIds.some((blockedLabelId: ObjectID) => {
|
|
182
|
+
return targetLabelIds.some((labelId: ObjectID) => {
|
|
183
|
+
return labelId.toString() === blockedLabelId.toString();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
if (!canDelegate || isBlocked) {
|
|
146
190
|
throw new NotAuthorizedException(
|
|
147
191
|
`You cannot grant ${data.permission} because your own access does not include that permission at an equal or broader scope.`,
|
|
148
192
|
);
|
|
@@ -349,13 +393,33 @@ export class Service extends DatabaseService<Model> {
|
|
|
349
393
|
protected override async onBeforeUpdate(
|
|
350
394
|
updateBy: UpdateBy<Model>,
|
|
351
395
|
): Promise<OnUpdate<Model>> {
|
|
352
|
-
|
|
396
|
+
updateBy.query = await ModelPermission.checkUpdateQueryPermissions(
|
|
397
|
+
Model,
|
|
398
|
+
updateBy.query,
|
|
399
|
+
updateBy.data,
|
|
400
|
+
updateBy.props,
|
|
401
|
+
);
|
|
402
|
+
const selectedPermissions: Array<Model> = await this.findAllBy({
|
|
353
403
|
query: updateBy.query,
|
|
404
|
+
select: { _id: true },
|
|
405
|
+
skip: updateBy.skip,
|
|
406
|
+
limit: updateBy.limit,
|
|
407
|
+
props: { isRoot: true },
|
|
408
|
+
});
|
|
409
|
+
const selectedIds: Array<ObjectID> = selectedPermissions.map(
|
|
410
|
+
(row: Model) => {
|
|
411
|
+
return row.id!;
|
|
412
|
+
},
|
|
413
|
+
);
|
|
414
|
+
// Read complete labels independently of any relation filters in the query.
|
|
415
|
+
const teamPermissions: Array<Model> = await this.findAllBy({
|
|
416
|
+
query: { _id: QueryHelper.any(selectedIds) },
|
|
354
417
|
select: {
|
|
355
418
|
_id: true,
|
|
356
419
|
teamId: true,
|
|
357
420
|
projectId: true,
|
|
358
421
|
permission: true,
|
|
422
|
+
isBlockPermission: true,
|
|
359
423
|
labels: {
|
|
360
424
|
_id: true,
|
|
361
425
|
},
|
|
@@ -364,8 +428,6 @@ export class Service extends DatabaseService<Model> {
|
|
|
364
428
|
isPermissionsEditable: true,
|
|
365
429
|
},
|
|
366
430
|
},
|
|
367
|
-
skip: 0,
|
|
368
|
-
limit: LIMIT_MAX,
|
|
369
431
|
props: {
|
|
370
432
|
isRoot: true,
|
|
371
433
|
},
|
|
@@ -404,6 +466,16 @@ export class Service extends DatabaseService<Model> {
|
|
|
404
466
|
? (rawUpdateData.scope as PermissionScope)
|
|
405
467
|
: permission.scope;
|
|
406
468
|
|
|
469
|
+
// Retargeting or narrowing a deny also removes its original restriction.
|
|
470
|
+
if (permission.isBlockPermission) {
|
|
471
|
+
this.assertCanGrantPermission({
|
|
472
|
+
permission: permission.permission!,
|
|
473
|
+
labelIds: this.getLabelIds(permission.labels),
|
|
474
|
+
scope: permission.scope,
|
|
475
|
+
props: updateBy.props,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
407
479
|
this.assertCanGrantPermission({
|
|
408
480
|
permission: requestedPermission,
|
|
409
481
|
labelIds: this.getLabelIds(requestedLabels),
|
|
@@ -413,24 +485,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
413
485
|
}
|
|
414
486
|
|
|
415
487
|
if (updateBy.data.labels && updateBy.data.labels.length > 0) {
|
|
416
|
-
const
|
|
417
|
-
query: updateBy.query,
|
|
418
|
-
select: {
|
|
419
|
-
_id: true,
|
|
420
|
-
labels: true,
|
|
421
|
-
isBlockPermission: true,
|
|
422
|
-
projectId: true,
|
|
423
|
-
teamId: true,
|
|
424
|
-
permission: true,
|
|
425
|
-
},
|
|
426
|
-
limit: LIMIT_PER_PROJECT,
|
|
427
|
-
skip: 0,
|
|
428
|
-
props: {
|
|
429
|
-
isRoot: true,
|
|
430
|
-
},
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
for (const alreadySavedPermission of existingPermissions) {
|
|
488
|
+
for (const alreadySavedPermission of teamPermissions) {
|
|
434
489
|
// check if the
|
|
435
490
|
|
|
436
491
|
const isBlockPermission: boolean =
|
|
@@ -471,6 +526,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
471
526
|
}
|
|
472
527
|
}
|
|
473
528
|
|
|
529
|
+
updateBy.query = { ...updateBy.query, _id: QueryHelper.any(selectedIds) };
|
|
530
|
+
updateBy.skip = 0;
|
|
474
531
|
return { updateBy, carryForward: teamPermissions };
|
|
475
532
|
}
|
|
476
533
|
|
|
@@ -523,31 +580,68 @@ export class Service extends DatabaseService<Model> {
|
|
|
523
580
|
protected override async onBeforeDelete(
|
|
524
581
|
deleteBy: DeleteBy<Model>,
|
|
525
582
|
): Promise<OnDelete<Model>> {
|
|
526
|
-
|
|
583
|
+
// Scope the root lookup using the same delete authorization as the write.
|
|
584
|
+
deleteBy.query = await ModelPermission.checkDeleteQueryPermission(
|
|
585
|
+
Model,
|
|
586
|
+
deleteBy.query,
|
|
587
|
+
deleteBy.props,
|
|
588
|
+
);
|
|
589
|
+
const selectedPermissions: Array<Model> = await this.findAllBy({
|
|
527
590
|
query: deleteBy.query,
|
|
591
|
+
select: { _id: true },
|
|
592
|
+
skip: deleteBy.skip,
|
|
593
|
+
limit: deleteBy.limit,
|
|
594
|
+
props: { isRoot: true },
|
|
595
|
+
});
|
|
596
|
+
const selectedIds: Array<ObjectID> = selectedPermissions.map(
|
|
597
|
+
(row: Model) => {
|
|
598
|
+
return row.id!;
|
|
599
|
+
},
|
|
600
|
+
);
|
|
601
|
+
const teamPermissions: Array<Model> = await this.findAllBy({
|
|
602
|
+
query: { _id: QueryHelper.any(selectedIds) },
|
|
528
603
|
select: {
|
|
529
604
|
_id: true,
|
|
530
605
|
teamId: true,
|
|
531
606
|
projectId: true,
|
|
607
|
+
permission: true,
|
|
608
|
+
isBlockPermission: true,
|
|
609
|
+
labels: { _id: true },
|
|
610
|
+
scope: true,
|
|
532
611
|
team: {
|
|
533
612
|
isPermissionsEditable: true,
|
|
534
613
|
},
|
|
535
614
|
},
|
|
536
|
-
skip: 0,
|
|
537
|
-
limit: LIMIT_MAX,
|
|
538
615
|
props: {
|
|
539
616
|
isRoot: true,
|
|
540
617
|
},
|
|
541
618
|
});
|
|
542
619
|
|
|
543
620
|
for (const permission of teamPermissions) {
|
|
621
|
+
this.assertProjectMatchesTenant(permission.projectId!, deleteBy.props);
|
|
544
622
|
if (!permission.team?.isPermissionsEditable) {
|
|
545
623
|
throw new BadDataException(
|
|
546
624
|
"Permissions for this team is not deleteable. You can create a new team and add permissions to that team instead.",
|
|
547
625
|
);
|
|
548
626
|
}
|
|
627
|
+
|
|
628
|
+
if (permission.isBlockPermission) {
|
|
629
|
+
this.assertCanGrantPermission({
|
|
630
|
+
permission: permission.permission!,
|
|
631
|
+
labelIds: this.getLabelIds(permission.labels),
|
|
632
|
+
scope: permission.scope,
|
|
633
|
+
props: deleteBy.props,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
549
636
|
}
|
|
550
637
|
|
|
638
|
+
// Keep the write restricted to the page whose authority was checked.
|
|
639
|
+
deleteBy.query = {
|
|
640
|
+
...deleteBy.query,
|
|
641
|
+
_id: QueryHelper.any(selectedIds),
|
|
642
|
+
};
|
|
643
|
+
deleteBy.skip = 0;
|
|
644
|
+
|
|
551
645
|
let teamMembers: Array<TeamMember> = [];
|
|
552
646
|
|
|
553
647
|
for (const permission of teamPermissions) {
|
|
@@ -14,6 +14,7 @@ import TeamMember from "../../Models/DatabaseModels/TeamMember";
|
|
|
14
14
|
import TeamMemberService from "./TeamMemberService";
|
|
15
15
|
import ProjectSCIMService from "./ProjectSCIMService";
|
|
16
16
|
import ModelPermission from "../Types/Database/Permissions/Index";
|
|
17
|
+
import EditionEnforcement from "../Utils/EditionEnforcement";
|
|
17
18
|
|
|
18
19
|
export class Service extends DatabaseService<Model> {
|
|
19
20
|
public constructor() {
|
|
@@ -61,6 +62,15 @@ export class Service extends DatabaseService<Model> {
|
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/*
|
|
66
|
+
* The lock exists because the identity provider owns the teams while
|
|
67
|
+
* Push Groups is on. The Community Edition serves no SCIM endpoint, so
|
|
68
|
+
* nothing could manage them there: a leftover lock is not enforced.
|
|
69
|
+
*/
|
|
70
|
+
if (!EditionEnforcement.areScimTeamLocksEnforced()) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
const uniqueProjectIds: Map<string, ObjectID> = new Map();
|
|
65
75
|
|
|
66
76
|
for (const projectId of data.projectIds) {
|
|
@@ -9,6 +9,8 @@ import ObjectID from "../../Types/ObjectID";
|
|
|
9
9
|
import {
|
|
10
10
|
THREAT_INTEL_MINIMUM_CONFIDENCE_MAX,
|
|
11
11
|
THREAT_INTEL_MINIMUM_CONFIDENCE_MIN,
|
|
12
|
+
THREAT_INTEL_POLL_INTERVAL_MAX_IN_MINUTES,
|
|
13
|
+
THREAT_INTEL_POLL_INTERVAL_MIN_IN_MINUTES,
|
|
12
14
|
} from "../../Types/SecurityEvent/ThreatIntelConstants";
|
|
13
15
|
import TaxiiClient from "../Utils/SecurityEvent/ThreatIntel/TaxiiClient";
|
|
14
16
|
|
|
@@ -40,11 +42,12 @@ export class Service extends DatabaseService<Model> {
|
|
|
40
42
|
if (data.pollIntervalInMinutes !== undefined) {
|
|
41
43
|
if (
|
|
42
44
|
!Number.isInteger(data.pollIntervalInMinutes) ||
|
|
43
|
-
data.pollIntervalInMinutes <
|
|
44
|
-
|
|
45
|
+
data.pollIntervalInMinutes <
|
|
46
|
+
THREAT_INTEL_POLL_INTERVAL_MIN_IN_MINUTES ||
|
|
47
|
+
data.pollIntervalInMinutes > THREAT_INTEL_POLL_INTERVAL_MAX_IN_MINUTES
|
|
45
48
|
) {
|
|
46
49
|
throw new BadDataException(
|
|
47
|
-
|
|
50
|
+
`Poll interval must be a whole number of minutes between ${THREAT_INTEL_POLL_INTERVAL_MIN_IN_MINUTES} and ${THREAT_INTEL_POLL_INTERVAL_MAX_IN_MINUTES}.`,
|
|
48
51
|
);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
1
2
|
import DatabaseConfig from "../DatabaseConfig";
|
|
2
3
|
import {
|
|
3
4
|
EncryptionSecret,
|
|
@@ -59,7 +60,7 @@ import Name from "../../Types/Name";
|
|
|
59
60
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
60
61
|
import Timezone from "../../Types/Timezone";
|
|
61
62
|
import InMemoryTTLCache from "../Infrastructure/InMemoryTTLCache";
|
|
62
|
-
import
|
|
63
|
+
import EnterpriseEdition from "../Enterprise/EnterpriseEdition";
|
|
63
64
|
|
|
64
65
|
/*
|
|
65
66
|
* Names the Redis mutex that serializes the first-Master-Admin election across
|
|
@@ -195,22 +196,13 @@ export class Service extends DatabaseService<Model> {
|
|
|
195
196
|
*
|
|
196
197
|
* No isRoot exemption on purpose — invitations create the invited user as
|
|
197
198
|
* root, so exempting root would exempt invitations, which is the exact
|
|
198
|
-
* thing this is here to bound.
|
|
199
|
-
*
|
|
200
|
-
*
|
|
199
|
+
* thing this is here to bound. The limit itself belongs to the Enterprise
|
|
200
|
+
* license client (ee/Server/License): this is a no-op on the Community
|
|
201
|
+
* Edition, on oneuptime.com (billing enabled) and whenever the license is
|
|
202
|
+
* not valid or in grace, and it never counts the User table on a license
|
|
203
|
+
* with no seat limit.
|
|
201
204
|
*/
|
|
202
|
-
await
|
|
203
|
-
getLocalUserCount: async (): Promise<number> => {
|
|
204
|
-
const userCount: PositiveNumber = await this.countBy({
|
|
205
|
-
query: {},
|
|
206
|
-
props: {
|
|
207
|
-
isRoot: true,
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
return userCount.toNumber();
|
|
212
|
-
},
|
|
213
|
-
});
|
|
205
|
+
await EnterpriseEdition.assertSeatAvailableForNewUser();
|
|
214
206
|
|
|
215
207
|
/*
|
|
216
208
|
* clickIds / firstTouchAttribution are publicly creatable jsonb columns
|
|
@@ -1310,7 +1302,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
1310
1302
|
);
|
|
1311
1303
|
}
|
|
1312
1304
|
|
|
1313
|
-
|
|
1305
|
+
// A bearer secret: from the CSPRNG, never ObjectID's non-crypto fallback.
|
|
1306
|
+
const token: string = crypto.randomUUID();
|
|
1314
1307
|
|
|
1315
1308
|
const hashedToken: string = await HashedString.hashValue(
|
|
1316
1309
|
token,
|
|
@@ -70,16 +70,18 @@ export default class BasePermission {
|
|
|
70
70
|
props,
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
/*
|
|
74
|
+
* Only TenantPermission's per-project recursion returns an array of
|
|
75
|
+
* queries whose permissions have already been checked. The incoming
|
|
76
|
+
* query is copied into an ordinary object above, so a caller cannot
|
|
77
|
+
* supply this array. A multi-tenant request scoped to the current user
|
|
78
|
+
* (such as pending team invitations) still needs every check below.
|
|
79
|
+
*/
|
|
80
|
+
if (!Array.isArray(query)) {
|
|
76
81
|
// check model level permissions.
|
|
77
82
|
TablePermission.checkTableLevelPermissions(modelType, props, type);
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
* We will check for this permission in recursive function.
|
|
81
|
-
* check query permissions.
|
|
82
|
-
*/
|
|
84
|
+
// check query permissions.
|
|
83
85
|
QueryPermission.checkQueryPermission(modelType, query, props);
|
|
84
86
|
|
|
85
87
|
query = await AccessControlPermission.addAccessControlIdsToQuery(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import DatabaseRequestType from "../../BaseDatabase/DatabaseRequestType";
|
|
2
2
|
import ColumnPermissions from "./ColumnPermission";
|
|
3
|
+
import EditionPermissions from "./EditionPermission";
|
|
3
4
|
import TablePermission from "./TablePermission";
|
|
4
5
|
import TenantPermission from "./TenantPermission";
|
|
5
6
|
import BaseModel from "../../../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
@@ -15,6 +16,20 @@ export default class CreatePermission {
|
|
|
15
16
|
data: TBaseModel,
|
|
16
17
|
props: DatabaseCommonInteractionProps,
|
|
17
18
|
): void {
|
|
19
|
+
/*
|
|
20
|
+
* Master admins skip every table-level check below, but not the edition
|
|
21
|
+
* check: creating enterprise configuration (global SSO/OIDC providers
|
|
22
|
+
* are only ever created by master admins) needs the license for them
|
|
23
|
+
* too. Everyone else gets the same check through TablePermission.
|
|
24
|
+
*/
|
|
25
|
+
if (props.isMasterAdmin && !props.isRoot) {
|
|
26
|
+
EditionPermissions.checkEditionPermissions(
|
|
27
|
+
modelType,
|
|
28
|
+
props,
|
|
29
|
+
DatabaseRequestType.Create,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
// If system is making this query then let the query run!
|
|
19
34
|
if (props.isRoot || props.isMasterAdmin) {
|
|
20
35
|
return;
|
|
@@ -1,46 +1,236 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { IsBillingEnabled } from "../../../../Server/EnvironmentConfig";
|
|
2
|
+
import EnterpriseEdition from "../../../Enterprise/EnterpriseEdition";
|
|
3
|
+
import EnterpriseFeature, {
|
|
4
|
+
ALL_ENTERPRISE_FEATURES,
|
|
5
|
+
} from "../../../Enterprise/EnterpriseFeature";
|
|
6
|
+
import DatabaseRequestType from "../../BaseDatabase/DatabaseRequestType";
|
|
5
7
|
import BaseModel, {
|
|
6
8
|
DatabaseBaseModelType,
|
|
7
9
|
} from "../../../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
8
10
|
import DatabaseCommonInteractionProps from "../../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
9
|
-
import PaymentRequiredException from "../../../../Types/Exception/PaymentRequiredException";
|
|
10
11
|
import CaptureSpan from "../../../Utils/Telemetry/CaptureSpan";
|
|
11
12
|
|
|
13
|
+
// Whether one column value of an update can only tighten security.
|
|
14
|
+
export type TightenOnlyColumnRule = (value: unknown) => boolean;
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Switching an identity provider off (isEnabled: false). Switching one on is
|
|
18
|
+
* configuration and needs the license; only the literal false counts, so a
|
|
19
|
+
* value the database might coerce ("false", 0) is judged by the full check.
|
|
20
|
+
*/
|
|
21
|
+
const isSwitchingOff: TightenOnlyColumnRule = (value: unknown): boolean => {
|
|
22
|
+
return value === false;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* The shortest SCIM bearer token a rotation may set without the license. The
|
|
27
|
+
* Dashboard's "Reset token" generates a UUID (36 characters) and services
|
|
28
|
+
* default to one, so this only turns away a token short enough to be weaker
|
|
29
|
+
* than the one it replaces.
|
|
30
|
+
*/
|
|
31
|
+
export const MIN_ROTATED_SCIM_BEARER_TOKEN_LENGTH: number = 32;
|
|
32
|
+
|
|
33
|
+
// Replacing a (possibly leaked) SCIM bearer token with a new, long one.
|
|
34
|
+
const isRotatedBearerToken: TightenOnlyColumnRule = (
|
|
35
|
+
value: unknown,
|
|
36
|
+
): boolean => {
|
|
37
|
+
return (
|
|
38
|
+
typeof value === "string" &&
|
|
39
|
+
value.trim().length >= MIN_ROTATED_SCIM_BEARER_TOKEN_LENGTH
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* The updates an administrator may make to enterprise configuration while
|
|
45
|
+
* the feature is unavailable, because they can only tighten security: the
|
|
46
|
+
* incident-response moves. Keyed by table name, like the facade's feature
|
|
47
|
+
* map; a model that is not listed has none.
|
|
48
|
+
*
|
|
49
|
+
* isEnabled: false disable an SSO/OIDC provider (project, status page or
|
|
50
|
+
* global), or a global provider's attachment to a
|
|
51
|
+
* project.
|
|
52
|
+
* bearerToken rotate a leaked SCIM bearer token.
|
|
53
|
+
*
|
|
54
|
+
* TeamComplianceSetting has no entry: switching a compliance rule off
|
|
55
|
+
* relaxes it.
|
|
56
|
+
*/
|
|
57
|
+
const TIGHTEN_ONLY_UPDATES: ReadonlyMap<
|
|
58
|
+
string,
|
|
59
|
+
Readonly<Record<string, TightenOnlyColumnRule>>
|
|
60
|
+
> = new Map<string, Readonly<Record<string, TightenOnlyColumnRule>>>([
|
|
61
|
+
["GlobalSSO", { isEnabled: isSwitchingOff }],
|
|
62
|
+
["GlobalOIDC", { isEnabled: isSwitchingOff }],
|
|
63
|
+
["GlobalSSOProject", { isEnabled: isSwitchingOff }],
|
|
64
|
+
["GlobalOIDCProject", { isEnabled: isSwitchingOff }],
|
|
65
|
+
["ProjectSSO", { isEnabled: isSwitchingOff }],
|
|
66
|
+
["ProjectOIDC", { isEnabled: isSwitchingOff }],
|
|
67
|
+
["StatusPageSSO", { isEnabled: isSwitchingOff }],
|
|
68
|
+
["StatusPageOIDC", { isEnabled: isSwitchingOff }],
|
|
69
|
+
["ProjectSCIM", { bearerToken: isRotatedBearerToken }],
|
|
70
|
+
["StatusPageSCIM", { bearerToken: isRotatedBearerToken }],
|
|
71
|
+
]);
|
|
72
|
+
|
|
12
73
|
export default class EditionPermissions {
|
|
13
74
|
/*
|
|
14
|
-
* Gates
|
|
75
|
+
* Gates the enterprise CONFIGURATION models, the ones marked with
|
|
76
|
+
* @TableEditionAccessControl({ requiresEnterprise: true }): project, global
|
|
77
|
+
* and status page SSO/OIDC providers, SCIM configurations and team
|
|
78
|
+
* compliance settings.
|
|
15
79
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
80
|
+
* Only creating and updating them needs the license. Reading and deleting
|
|
81
|
+
* are always allowed, so an install that dropped to the Community Edition,
|
|
82
|
+
* or whose license lapsed, can still see what it has configured and remove
|
|
83
|
+
* it. Only configuration is gated here, and none of it is ever deleted.
|
|
84
|
+
* Whether what exists RUNS is decided at runtime by
|
|
85
|
+
* EnterpriseEdition.isFeatureActive: SSO, SCIM and audit logging stop while
|
|
86
|
+
* a self-hosted license is lapsed and resume when a license is activated.
|
|
18
87
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
88
|
+
* The one kind of update that needs no license either is a TIGHTEN-ONLY
|
|
89
|
+
* update (see TIGHTEN_ONLY_UPDATES): every column it writes is on the
|
|
90
|
+
* model's list with a value that can only tighten security - disabling an
|
|
91
|
+
* identity provider, rotating a leaked SCIM bearer token. A lapsed license
|
|
92
|
+
* must never stand between an administrator and those moves during an
|
|
93
|
+
* incident. The same holds on the Community Edition, deliberately and for
|
|
94
|
+
* the same reason reads and deletes do: the move can only reduce what the
|
|
95
|
+
* configuration allows, and a provider disabled (or a token rotated) there
|
|
96
|
+
* stays so when the install returns to the Enterprise Edition, instead of
|
|
97
|
+
* coming back live. Anything else in the same update - even one more
|
|
98
|
+
* column - makes it an ordinary update, which needs the license.
|
|
99
|
+
*
|
|
100
|
+
* `updateData` is what the update writes. Only UpdatePermission, which has
|
|
101
|
+
* it, passes it; without it an update is judged by the full check (fail
|
|
102
|
+
* closed). TablePermission leaves updates to UpdatePermission for that
|
|
103
|
+
* reason.
|
|
104
|
+
*
|
|
105
|
+
* Master admins are subject to this check - Create/UpdatePermission call it
|
|
106
|
+
* before their master-admin early return - because the global SSO/OIDC
|
|
107
|
+
* models are only ever written by master admins and would otherwise never
|
|
108
|
+
* be gated. Internal root writes (props.isRoot) are never checked.
|
|
109
|
+
*
|
|
110
|
+
* On the cloud / billing-enabled deployment enforcement is left to
|
|
111
|
+
* BillingPermission: it already gates these models by the plan tier in
|
|
112
|
+
* their @TableBillingAccessControl, so a second check would be redundant.
|
|
113
|
+
*
|
|
114
|
+
* Deliberately synchronous. TablePermission and CreatePermission are
|
|
115
|
+
* synchronous and their callers do not await them, so an async check with a
|
|
116
|
+
* missed await would turn the refusal into an unhandled rejection and let
|
|
117
|
+
* the write through. The license is read from the enterprise module's
|
|
118
|
+
* cached snapshot, and an unknown snapshot refuses the write (fail closed).
|
|
22
119
|
*/
|
|
23
120
|
@CaptureSpan()
|
|
24
121
|
public static checkEditionPermissions(
|
|
25
122
|
modelType: DatabaseBaseModelType,
|
|
26
|
-
|
|
123
|
+
props: DatabaseCommonInteractionProps,
|
|
124
|
+
operation: DatabaseRequestType,
|
|
125
|
+
updateData?: unknown,
|
|
27
126
|
): void {
|
|
28
127
|
if (IsBillingEnabled) {
|
|
29
128
|
return;
|
|
30
129
|
}
|
|
31
130
|
|
|
131
|
+
if (props.isRoot) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (
|
|
136
|
+
operation !== DatabaseRequestType.Create &&
|
|
137
|
+
operation !== DatabaseRequestType.Update
|
|
138
|
+
) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
32
142
|
const model: BaseModel = new modelType();
|
|
33
143
|
|
|
34
144
|
if (!model.requiresEnterprise) {
|
|
35
145
|
return;
|
|
36
146
|
}
|
|
37
147
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
148
|
+
if (
|
|
149
|
+
operation === DatabaseRequestType.Update &&
|
|
150
|
+
EditionPermissions.isTightenOnlyUpdate(model.tableName, updateData)
|
|
151
|
+
) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const feature: EnterpriseFeature | null =
|
|
156
|
+
EnterpriseEdition.getModelFeature(modelType);
|
|
157
|
+
|
|
158
|
+
if (feature) {
|
|
159
|
+
EnterpriseEdition.assertFeatureAvailableSync(feature);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
* An enterprise model the facade has no feature for (its guard test
|
|
165
|
+
* should make this impossible). Fail closed: only a license entitled to
|
|
166
|
+
* every enterprise feature may configure it.
|
|
167
|
+
*/
|
|
168
|
+
for (const enterpriseFeature of ALL_ENTERPRISE_FEATURES) {
|
|
169
|
+
EnterpriseEdition.assertFeatureAvailableSync(enterpriseFeature);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
* True when the update writes at least one column, and every column it
|
|
175
|
+
* writes is on the table's tighten-only list with a value that passes the
|
|
176
|
+
* column's rule. Columns set to undefined are not written and are ignored.
|
|
177
|
+
* Anything that is not a plain object of columns is not tighten-only.
|
|
178
|
+
*/
|
|
179
|
+
public static isTightenOnlyUpdate(
|
|
180
|
+
tableName: string | null | undefined,
|
|
181
|
+
updateData: unknown,
|
|
182
|
+
): boolean {
|
|
183
|
+
const rules: Readonly<Record<string, TightenOnlyColumnRule>> | undefined =
|
|
184
|
+
tableName ? TIGHTEN_ONLY_UPDATES.get(tableName) : undefined;
|
|
185
|
+
|
|
186
|
+
if (!rules) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (
|
|
191
|
+
!updateData ||
|
|
192
|
+
typeof updateData !== "object" ||
|
|
193
|
+
Array.isArray(updateData)
|
|
194
|
+
) {
|
|
195
|
+
return false;
|
|
44
196
|
}
|
|
197
|
+
|
|
198
|
+
const writtenColumns: Array<[string, unknown]> = Object.entries(
|
|
199
|
+
updateData as Record<string, unknown>,
|
|
200
|
+
).filter(([, value]: [string, unknown]): boolean => {
|
|
201
|
+
return value !== undefined;
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
if (writtenColumns.length === 0) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return writtenColumns.every(
|
|
209
|
+
([column, value]: [string, unknown]): boolean => {
|
|
210
|
+
const rule: TightenOnlyColumnRule | undefined =
|
|
211
|
+
Object.prototype.hasOwnProperty.call(rules, column)
|
|
212
|
+
? rules[column]
|
|
213
|
+
: undefined;
|
|
214
|
+
|
|
215
|
+
return Boolean(rule && rule(value));
|
|
216
|
+
},
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// The tables with tighten-only updates, and their columns (for guard tests).
|
|
221
|
+
public static getTightenOnlyColumns(): ReadonlyMap<
|
|
222
|
+
string,
|
|
223
|
+
ReadonlyArray<string>
|
|
224
|
+
> {
|
|
225
|
+
const columns: Map<string, ReadonlyArray<string>> = new Map<
|
|
226
|
+
string,
|
|
227
|
+
ReadonlyArray<string>
|
|
228
|
+
>();
|
|
229
|
+
|
|
230
|
+
for (const [tableName, rules] of TIGHTEN_ONLY_UPDATES) {
|
|
231
|
+
columns.set(tableName, Object.keys(rules));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return columns;
|
|
45
235
|
}
|
|
46
236
|
}
|