@oneuptime/common 13.0.7 → 13.0.8
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/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.ts +1 -1
- package/Models/DatabaseModels/ProjectOnCallCalendarFeed.ts +1 -1
- package/Models/DatabaseModels/UserOnCallCalendarFeed.ts +1 -1
- 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 +13 -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 +17 -0
- 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/ScheduledMaintenanceAPI.ts +1 -0
- package/Server/API/StatusPageAPI.ts +161 -32
- package/Server/API/TeamMemberAPI.ts +3 -0
- 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/Middleware/MasterAdminAuthorization.ts +13 -2
- package/Server/Middleware/UserAuthorization.ts +79 -5
- package/Server/Services/ApiKeyPermissionService.ts +101 -4
- package/Server/Services/DatabaseService.ts +245 -0
- package/Server/Services/DetectionRuleService.ts +5 -4
- 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 +18 -0
- package/Server/Services/RumSessionPinService.ts +274 -22
- package/Server/Services/TeamPermissionService.ts +120 -26
- package/Server/Services/ThreatIntelFeedService.ts +6 -3
- package/Server/Types/Database/Permissions/BasePermission.ts +9 -7
- package/Server/Types/Database/Permissions/Index.ts +75 -11
- package/Server/Types/Database/Permissions/TablePermission.ts +24 -28
- package/Server/Utils/AI/AIChatPrivacyFilter.ts +8 -0
- package/Server/Utils/AI/AIRunPrivacyFilter.ts +8 -0
- package/Server/Utils/MasterAdminPageAccess.ts +61 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +3 -1
- package/Server/Utils/Monitor/MonitorIncident.ts +3 -1
- 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/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/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/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/OnCallCalendarFeedSideMenus.test.tsx +9 -1
- 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 +95 -68
- package/Tests/App/Dashboard/SecurityEventsDetectionRulesPage.test.tsx +86 -3
- package/Tests/App/Dashboard/SecurityEventsEmptyState.test.tsx +28 -3
- package/Tests/App/Dashboard/SecurityEventsExplorer.test.tsx +761 -0
- package/Tests/App/Dashboard/SecurityEventsGuideContent.test.ts +1313 -0
- package/Tests/App/Dashboard/SecurityEventsHowItWorksCard.test.tsx +536 -0
- package/Tests/App/Dashboard/SecurityEventsNoResults.test.tsx +222 -0
- package/Tests/App/Dashboard/SecurityEventsThreatIntelPage.test.tsx +199 -0
- package/Tests/App/Dashboard/SecurityEventsVolumeChart.test.tsx +321 -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/PublicDashboard/DashboardVariableSelector.test.tsx +12 -4
- package/Tests/App/PublicDashboard/PublicDashboardWidgetListAuth.test.tsx +623 -0
- package/Tests/Models/OnCallCalendarFeedModels.test.ts +23 -1
- 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/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 +140 -0
- 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 +175 -17
- 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/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/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/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/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/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/MonitorPayAsYouGoBilling.test.ts +115 -1
- 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/ProjectServiceCreateSubscriptionStarted.test.ts +77 -1
- package/Tests/Server/Services/RumSessionPinCreatePermission.test.ts +715 -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/UserNotificationRuleAdminGuards.test.ts +13 -2
- 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/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/MasterAdminPageAccess.test.ts +251 -0
- package/Tests/Server/Utils/Monitor/MonitorActionTimestamps.test.ts +616 -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/Types/AI/AIInsightEvidence.test.ts +206 -0
- package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtilAnonymous.test.ts +144 -0
- package/Tests/Types/Call/CallProvider.test.ts +528 -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/EditionLabelLicenseRefresh.test.tsx +89 -1
- 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/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/TooltipInteractive.test.tsx +97 -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/SecurityEvent/GoogleSecOpsAlertNormalizerSeverity.test.ts +565 -0
- package/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.ts +40 -0
- package/Types/Monitor/MonitorEvaluationSummary.ts +3 -0
- 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/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 +12 -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/Markdown.tsx/MarkdownViewer.tsx +2 -1
- package/UI/Components/Markdown.tsx/SessionAwareImage.tsx +122 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +34 -5
- package/UI/Components/ModelTable/TableView.tsx +1 -1
- 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/Utils/API.ts +14 -5
- package/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.ts +157 -7
- package/Utils/SecurityEvent/Sigma/SigmaRuleParser.ts +9 -17
- package/Utils/Slo/SloBurnRateTemplate.ts +2 -2
- 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 +12 -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 +12 -0
- 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/ScheduledMaintenanceAPI.js +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +125 -33
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/TeamMemberAPI.js +3 -3
- 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/Middleware/MasterAdminAuthorization.js +11 -2
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +64 -4
- 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/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/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 +17 -0
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/RumSessionPinService.js +180 -16
- package/build/dist/Server/Services/RumSessionPinService.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/ThreatIntelFeedService.js +5 -4
- package/build/dist/Server/Services/ThreatIntelFeedService.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/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 +14 -13
- package/build/dist/Server/Types/Database/Permissions/TablePermission.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/MasterAdminPageAccess.js +39 -0
- package/build/dist/Server/Utils/MasterAdminPageAccess.js.map +1 -0
- 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/MonitorIncident.js +3 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- 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/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js +31 -1
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js.map +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/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 +11 -0
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
- 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/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/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/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/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/package.json +1 -1
package/Server/API/ProjectAPI.ts
CHANGED
|
@@ -48,6 +48,7 @@ export default class ProjectAPI extends BaseAPI<Project, ProjectServiceType> {
|
|
|
48
48
|
this.router.put(
|
|
49
49
|
`${new this.entityType().getCrudApiPath()?.toString()}/:id/change-plan`,
|
|
50
50
|
UserMiddleware.getUserMiddleware,
|
|
51
|
+
UserMiddleware.requireUserAuthentication,
|
|
51
52
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
52
53
|
try {
|
|
53
54
|
if (!IsBillingEnabled) {
|
|
@@ -43,6 +43,7 @@ export default class ScheduledMaintenanceAPI extends BaseAPI<
|
|
|
43
43
|
.getCrudApiPath()
|
|
44
44
|
?.toString()}/generate-note-from-ai/:scheduledMaintenanceId`,
|
|
45
45
|
UserMiddleware.getUserMiddleware,
|
|
46
|
+
UserMiddleware.requireUserAuthentication,
|
|
46
47
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
47
48
|
try {
|
|
48
49
|
await this.generateNoteFromAI(req, res);
|
|
@@ -31,6 +31,7 @@ import StatusPageService, {
|
|
|
31
31
|
import StatusPageSsoService from "../Services/StatusPageSsoService";
|
|
32
32
|
import StatusPageOidcService from "../Services/StatusPageOidcService";
|
|
33
33
|
import StatusPageSubscriberService from "../Services/StatusPageSubscriberService";
|
|
34
|
+
import ModelPermission from "../Types/Database/Permissions/Index";
|
|
34
35
|
import Query from "../Types/Database/Query";
|
|
35
36
|
import QueryHelper from "../Types/Database/QueryHelper";
|
|
36
37
|
import Select from "../Types/Database/Select";
|
|
@@ -46,8 +47,10 @@ import {
|
|
|
46
47
|
} from "../../Types/StatusPage/SearchEngineIndexing";
|
|
47
48
|
import Response from "../Utils/Response";
|
|
48
49
|
import BaseAPI from "./BaseAPI";
|
|
50
|
+
import CommonAPI from "./CommonAPI";
|
|
49
51
|
import BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
50
52
|
import ArrayUtil from "../../Utils/Array";
|
|
53
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
51
54
|
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
52
55
|
import { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
|
|
53
56
|
import OneUptimeDate from "../../Types/Date";
|
|
@@ -55,6 +58,7 @@ import Dictionary from "../../Types/Dictionary";
|
|
|
55
58
|
import Email from "../../Types/Email";
|
|
56
59
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
57
60
|
import NotAuthenticatedException from "../../Types/Exception/NotAuthenticatedException";
|
|
61
|
+
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
58
62
|
import NotFoundException from "../../Types/Exception/NotFoundException";
|
|
59
63
|
import { JSONArray, JSONObject } from "../../Types/JSON";
|
|
60
64
|
import JSONFunctions from "../../Types/JSONFunctions";
|
|
@@ -196,13 +200,63 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
196
200
|
this.overviewResponseInFlight.clear();
|
|
197
201
|
}
|
|
198
202
|
|
|
203
|
+
/*
|
|
204
|
+
* Holding one of StatusPage's update roles is not the same as being allowed
|
|
205
|
+
* to update a given page: team block rows, label-restricted grants and
|
|
206
|
+
* Owned-scoped grants all narrow it. Apply the checks a CRUD update of this
|
|
207
|
+
* page would run - block and label rules against the loaded page, then the
|
|
208
|
+
* query narrowing (tenant, labels, Owned scope) - and require the page to
|
|
209
|
+
* survive them. `statusPage` must have been loaded with its labels.
|
|
210
|
+
*/
|
|
211
|
+
private static async assertCanUpdateStatusPage(data: {
|
|
212
|
+
statusPage: StatusPage;
|
|
213
|
+
projectId: ObjectID;
|
|
214
|
+
props: DatabaseCommonInteractionProps;
|
|
215
|
+
}): Promise<void> {
|
|
216
|
+
await ModelPermission.checkUpdatePermissionByModel({
|
|
217
|
+
modelType: StatusPage,
|
|
218
|
+
fetchModelWithAccessControlIds: async (): Promise<StatusPage> => {
|
|
219
|
+
return data.statusPage;
|
|
220
|
+
},
|
|
221
|
+
props: data.props,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const permittedQuery: Query<StatusPage> =
|
|
225
|
+
await ModelPermission.checkUpdateQueryPermissions(
|
|
226
|
+
StatusPage,
|
|
227
|
+
{
|
|
228
|
+
_id: data.statusPage.id!,
|
|
229
|
+
projectId: data.projectId,
|
|
230
|
+
},
|
|
231
|
+
{},
|
|
232
|
+
data.props,
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
const permittedStatusPage: StatusPage | null =
|
|
236
|
+
await StatusPageService.findOneBy({
|
|
237
|
+
query: permittedQuery,
|
|
238
|
+
select: {
|
|
239
|
+
_id: true,
|
|
240
|
+
},
|
|
241
|
+
props: {
|
|
242
|
+
isRoot: true,
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
if (!permittedStatusPage) {
|
|
247
|
+
throw new NotAuthorizedException(
|
|
248
|
+
"You do not have permission to send this status page's report.",
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
199
253
|
public constructor() {
|
|
200
254
|
super(StatusPage, StatusPageService);
|
|
201
255
|
|
|
202
256
|
// get title, description of the page. This is used for SEO.
|
|
203
257
|
this.router.get(
|
|
204
258
|
`${new this.entityType().getCrudApiPath()?.toString()}/seo/:statusPageIdOrDomain`,
|
|
205
|
-
UserMiddleware.
|
|
259
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
206
260
|
async (req: ExpressRequest, res: ExpressResponse) => {
|
|
207
261
|
const statusPageIdOrDomain: string = req.params[
|
|
208
262
|
"statusPageIdOrDomain"
|
|
@@ -430,7 +484,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
430
484
|
`${new this.entityType()
|
|
431
485
|
.getCrudApiPath()
|
|
432
486
|
?.toString()}/incident-public-note/attachment/:statusPageId/:incidentId/:noteId/:fileId`,
|
|
433
|
-
UserMiddleware.
|
|
487
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
434
488
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
435
489
|
try {
|
|
436
490
|
await this.getIncidentPublicNoteAttachment(req, res);
|
|
@@ -444,7 +498,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
444
498
|
`${new this.entityType()
|
|
445
499
|
.getCrudApiPath()
|
|
446
500
|
?.toString()}/incident-episode-public-note/attachment/:statusPageId/:episodeId/:noteId/:fileId`,
|
|
447
|
-
UserMiddleware.
|
|
501
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
448
502
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
449
503
|
try {
|
|
450
504
|
await this.getIncidentEpisodePublicNoteAttachment(req, res);
|
|
@@ -458,7 +512,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
458
512
|
`${new this.entityType()
|
|
459
513
|
.getCrudApiPath()
|
|
460
514
|
?.toString()}/incident/postmortem/attachment/:statusPageId/:incidentId/:fileId`,
|
|
461
|
-
UserMiddleware.
|
|
515
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
462
516
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
463
517
|
try {
|
|
464
518
|
await this.getIncidentPostmortemAttachment(req, res);
|
|
@@ -472,7 +526,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
472
526
|
`${new this.entityType()
|
|
473
527
|
.getCrudApiPath()
|
|
474
528
|
?.toString()}/scheduled-maintenance-public-note/attachment/:statusPageId/:scheduledMaintenanceId/:noteId/:fileId`,
|
|
475
|
-
UserMiddleware.
|
|
529
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
476
530
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
477
531
|
try {
|
|
478
532
|
await this.getScheduledMaintenancePublicNoteAttachment(req, res);
|
|
@@ -486,7 +540,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
486
540
|
`${new this.entityType()
|
|
487
541
|
.getCrudApiPath()
|
|
488
542
|
?.toString()}/status-page-announcement/attachment/:statusPageId/:announcementId/:fileId`,
|
|
489
|
-
UserMiddleware.
|
|
543
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
490
544
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
491
545
|
try {
|
|
492
546
|
await this.getStatusPageAnnouncementAttachment(req, res);
|
|
@@ -795,16 +849,74 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
795
849
|
},
|
|
796
850
|
);
|
|
797
851
|
|
|
852
|
+
/*
|
|
853
|
+
* Sends the status page's report to an address the caller chooses, so it
|
|
854
|
+
* is gated like editing the status page: an authenticated member of the
|
|
855
|
+
* project that owns it who could update this particular page.
|
|
856
|
+
*/
|
|
798
857
|
this.router.post(
|
|
799
858
|
`${new this.entityType().getCrudApiPath()?.toString()}/test-email-report`,
|
|
800
859
|
UserMiddleware.getUserMiddleware,
|
|
860
|
+
UserMiddleware.requireUserAuthentication,
|
|
801
861
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
802
862
|
try {
|
|
863
|
+
/*
|
|
864
|
+
* This route acts on one page in one project, and the permission
|
|
865
|
+
* checks below must be evaluated for that single tenant, so the
|
|
866
|
+
* request is never treated as multi-tenant.
|
|
867
|
+
*/
|
|
868
|
+
const props: DatabaseCommonInteractionProps = {
|
|
869
|
+
...(await CommonAPI.getDatabaseCommonInteractionProps(req)),
|
|
870
|
+
isMultiTenantRequest: false,
|
|
871
|
+
};
|
|
872
|
+
const projectId: ObjectID =
|
|
873
|
+
CommonAPI.assertAuthenticatedProjectMember(props);
|
|
874
|
+
CommonAPI.assertPermittedInProject({
|
|
875
|
+
databaseProps: props,
|
|
876
|
+
allowedPermissions: new StatusPage().getUpdatePermissions(),
|
|
877
|
+
errorMessage:
|
|
878
|
+
"You do not have permission to send this status page's report.",
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
if (
|
|
882
|
+
!req.body["statusPageId"] ||
|
|
883
|
+
!ObjectID.isValidUUID(req.body["statusPageId"].toString())
|
|
884
|
+
) {
|
|
885
|
+
throw new BadDataException("A valid statusPageId is required.");
|
|
886
|
+
}
|
|
887
|
+
|
|
803
888
|
const email: Email = new Email(req.body["email"] as string);
|
|
804
889
|
const statusPageId: ObjectID = new ObjectID(
|
|
805
890
|
req.body["statusPageId"].toString() as string,
|
|
806
891
|
);
|
|
807
892
|
|
|
893
|
+
const statusPage: StatusPage | null =
|
|
894
|
+
await StatusPageService.findOneById({
|
|
895
|
+
id: statusPageId,
|
|
896
|
+
select: {
|
|
897
|
+
_id: true,
|
|
898
|
+
projectId: true,
|
|
899
|
+
labels: {
|
|
900
|
+
_id: true,
|
|
901
|
+
name: true,
|
|
902
|
+
},
|
|
903
|
+
},
|
|
904
|
+
props: {
|
|
905
|
+
isRoot: true,
|
|
906
|
+
},
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
910
|
+
resourceProjectId: statusPage?.projectId,
|
|
911
|
+
projectId,
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
await StatusPageAPI.assertCanUpdateStatusPage({
|
|
915
|
+
statusPage: statusPage!,
|
|
916
|
+
projectId,
|
|
917
|
+
props,
|
|
918
|
+
});
|
|
919
|
+
|
|
808
920
|
await StatusPageService.sendEmailReport({
|
|
809
921
|
email: email,
|
|
810
922
|
statusPageId,
|
|
@@ -819,7 +931,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
819
931
|
|
|
820
932
|
this.router.post(
|
|
821
933
|
`${new this.entityType().getCrudApiPath()?.toString()}/domain`,
|
|
822
|
-
UserMiddleware.
|
|
934
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
823
935
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
824
936
|
try {
|
|
825
937
|
if (!req.body["domain"]) {
|
|
@@ -863,7 +975,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
863
975
|
`${new this.entityType()
|
|
864
976
|
.getCrudApiPath()
|
|
865
977
|
?.toString()}/master-page/:statusPageId`,
|
|
866
|
-
UserMiddleware.
|
|
978
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
867
979
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
868
980
|
try {
|
|
869
981
|
const statusPageIdParam: string = req.params[
|
|
@@ -1046,7 +1158,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1046
1158
|
PublicDashboardRateLimit.getMiddleware(
|
|
1047
1159
|
PublicDashboardRateLimitBucket.StatusPageMasterPassword,
|
|
1048
1160
|
),
|
|
1049
|
-
UserMiddleware.
|
|
1161
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1050
1162
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1051
1163
|
try {
|
|
1052
1164
|
if (!req.params["statusPageId"]) {
|
|
@@ -1120,7 +1232,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1120
1232
|
|
|
1121
1233
|
this.router.post(
|
|
1122
1234
|
`${new this.entityType().getCrudApiPath()?.toString()}/sso/:statusPageId`,
|
|
1123
|
-
UserMiddleware.
|
|
1235
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1124
1236
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1125
1237
|
try {
|
|
1126
1238
|
const objectId: ObjectID = new ObjectID(
|
|
@@ -1160,7 +1272,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1160
1272
|
|
|
1161
1273
|
this.router.post(
|
|
1162
1274
|
`${new this.entityType().getCrudApiPath()?.toString()}/oidc/:statusPageId`,
|
|
1163
|
-
UserMiddleware.
|
|
1275
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1164
1276
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1165
1277
|
try {
|
|
1166
1278
|
const objectId: ObjectID = new ObjectID(
|
|
@@ -1203,7 +1315,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1203
1315
|
`${new this.entityType()
|
|
1204
1316
|
.getCrudApiPath()
|
|
1205
1317
|
?.toString()}/resources/:statusPageId`,
|
|
1206
|
-
UserMiddleware.
|
|
1318
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1207
1319
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1208
1320
|
try {
|
|
1209
1321
|
const statusPageId: ObjectID = new ObjectID(
|
|
@@ -1254,7 +1366,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1254
1366
|
`${new this.entityType()
|
|
1255
1367
|
.getCrudApiPath()
|
|
1256
1368
|
?.toString()}/uptime/:statusPageId`,
|
|
1257
|
-
UserMiddleware.
|
|
1369
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1258
1370
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1259
1371
|
try {
|
|
1260
1372
|
// This reosurce ID can be of a status page resource OR a status page group.
|
|
@@ -1698,7 +1810,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1698
1810
|
|
|
1699
1811
|
this.router.post(
|
|
1700
1812
|
overviewApiPath,
|
|
1701
|
-
UserMiddleware.
|
|
1813
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1702
1814
|
overviewHandler,
|
|
1703
1815
|
);
|
|
1704
1816
|
|
|
@@ -1709,7 +1821,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1709
1821
|
*/
|
|
1710
1822
|
this.router.get(
|
|
1711
1823
|
overviewApiPath,
|
|
1712
|
-
UserMiddleware.
|
|
1824
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1713
1825
|
overviewHandler,
|
|
1714
1826
|
);
|
|
1715
1827
|
|
|
@@ -1717,7 +1829,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1717
1829
|
`${new this.entityType()
|
|
1718
1830
|
.getCrudApiPath()
|
|
1719
1831
|
?.toString()}/update-subscription/:statusPageId/:subscriberId`,
|
|
1720
|
-
UserMiddleware.
|
|
1832
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1721
1833
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1722
1834
|
try {
|
|
1723
1835
|
await this.subscribeToStatusPage(req);
|
|
@@ -1732,7 +1844,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1732
1844
|
`${new this.entityType()
|
|
1733
1845
|
.getCrudApiPath()
|
|
1734
1846
|
?.toString()}/get-subscription/:statusPageId/:subscriberId`,
|
|
1735
|
-
UserMiddleware.
|
|
1847
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1736
1848
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1737
1849
|
try {
|
|
1738
1850
|
const subscriber: StatusPageSubscriber =
|
|
@@ -1754,7 +1866,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1754
1866
|
`${new this.entityType()
|
|
1755
1867
|
.getCrudApiPath()
|
|
1756
1868
|
?.toString()}/subscribe/:statusPageId`,
|
|
1757
|
-
UserMiddleware.
|
|
1869
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1758
1870
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1759
1871
|
try {
|
|
1760
1872
|
await this.subscribeToStatusPage(req);
|
|
@@ -1770,7 +1882,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1770
1882
|
`${new this.entityType()
|
|
1771
1883
|
.getCrudApiPath()
|
|
1772
1884
|
?.toString()}/manage-subscription/:statusPageId`,
|
|
1773
|
-
UserMiddleware.
|
|
1885
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1774
1886
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1775
1887
|
try {
|
|
1776
1888
|
await this.manageExistingSubscription(req);
|
|
@@ -1821,13 +1933,13 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1821
1933
|
|
|
1822
1934
|
this.router.post(
|
|
1823
1935
|
incidentsListApiPath,
|
|
1824
|
-
UserMiddleware.
|
|
1936
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1825
1937
|
incidentsListHandler,
|
|
1826
1938
|
);
|
|
1827
1939
|
|
|
1828
1940
|
this.router.get(
|
|
1829
1941
|
incidentsListApiPath,
|
|
1830
|
-
UserMiddleware.
|
|
1942
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1831
1943
|
incidentsListHandler,
|
|
1832
1944
|
);
|
|
1833
1945
|
|
|
@@ -1872,13 +1984,13 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1872
1984
|
|
|
1873
1985
|
this.router.post(
|
|
1874
1986
|
scheduledMaintenanceEventsListApiPath,
|
|
1875
|
-
UserMiddleware.
|
|
1987
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1876
1988
|
scheduledMaintenanceEventsListHandler,
|
|
1877
1989
|
);
|
|
1878
1990
|
|
|
1879
1991
|
this.router.get(
|
|
1880
1992
|
scheduledMaintenanceEventsListApiPath,
|
|
1881
|
-
UserMiddleware.
|
|
1993
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1882
1994
|
scheduledMaintenanceEventsListHandler,
|
|
1883
1995
|
);
|
|
1884
1996
|
|
|
@@ -1922,13 +2034,13 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1922
2034
|
|
|
1923
2035
|
this.router.post(
|
|
1924
2036
|
announcementsListApiPath,
|
|
1925
|
-
UserMiddleware.
|
|
2037
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1926
2038
|
announcementsListHandler,
|
|
1927
2039
|
);
|
|
1928
2040
|
|
|
1929
2041
|
this.router.get(
|
|
1930
2042
|
announcementsListApiPath,
|
|
1931
|
-
UserMiddleware.
|
|
2043
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1932
2044
|
announcementsListHandler,
|
|
1933
2045
|
);
|
|
1934
2046
|
|
|
@@ -1936,7 +2048,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1936
2048
|
`${new this.entityType()
|
|
1937
2049
|
.getCrudApiPath()
|
|
1938
2050
|
?.toString()}/incidents/:statusPageIdOrDomain/:incidentId`,
|
|
1939
|
-
UserMiddleware.
|
|
2051
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1940
2052
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1941
2053
|
try {
|
|
1942
2054
|
const objectId: ObjectID = await resolveStatusPageIdOrThrow(
|
|
@@ -1964,7 +2076,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1964
2076
|
`${new this.entityType()
|
|
1965
2077
|
.getCrudApiPath()
|
|
1966
2078
|
?.toString()}/scheduled-maintenance-events/:statusPageIdOrDomain/:scheduledMaintenanceId`,
|
|
1967
|
-
UserMiddleware.
|
|
2079
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1968
2080
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1969
2081
|
try {
|
|
1970
2082
|
const objectId: ObjectID = await resolveStatusPageIdOrThrow(
|
|
@@ -1993,7 +2105,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1993
2105
|
`${new this.entityType()
|
|
1994
2106
|
.getCrudApiPath()
|
|
1995
2107
|
?.toString()}/announcements/:statusPageIdOrDomain/:announcementId`,
|
|
1996
|
-
UserMiddleware.
|
|
2108
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
1997
2109
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
1998
2110
|
try {
|
|
1999
2111
|
const objectId: ObjectID = await resolveStatusPageIdOrThrow(
|
|
@@ -2023,7 +2135,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
2023
2135
|
`${new this.entityType()
|
|
2024
2136
|
.getCrudApiPath()
|
|
2025
2137
|
?.toString()}/episodes/:statusPageIdOrDomain`,
|
|
2026
|
-
UserMiddleware.
|
|
2138
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
2027
2139
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
2028
2140
|
try {
|
|
2029
2141
|
const objectId: ObjectID = await resolveStatusPageIdOrThrow(
|
|
@@ -2047,7 +2159,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
2047
2159
|
`${new this.entityType()
|
|
2048
2160
|
.getCrudApiPath()
|
|
2049
2161
|
?.toString()}/episodes/:statusPageIdOrDomain/:episodeId`,
|
|
2050
|
-
UserMiddleware.
|
|
2162
|
+
UserMiddleware.getPublicRouteUserMiddleware,
|
|
2051
2163
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
2052
2164
|
try {
|
|
2053
2165
|
const objectId: ObjectID = await resolveStatusPageIdOrThrow(
|
|
@@ -3508,6 +3620,23 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
3508
3620
|
return statusPageSubscriber;
|
|
3509
3621
|
}
|
|
3510
3622
|
|
|
3623
|
+
private serializeIncidentsForStatusPage(
|
|
3624
|
+
incidents: Array<Incident>,
|
|
3625
|
+
): JSONArray {
|
|
3626
|
+
return incidents.map((incident: Incident): JSONObject => {
|
|
3627
|
+
const incidentJson: JSONObject = BaseModel.toJSON(incident, Incident);
|
|
3628
|
+
|
|
3629
|
+
// Enforce postmortem visibility before sending or caching status-page JSON.
|
|
3630
|
+
if (incident.showPostmortemOnStatusPage !== true) {
|
|
3631
|
+
delete incidentJson["postmortemNote"];
|
|
3632
|
+
delete incidentJson["postmortemPostedAt"];
|
|
3633
|
+
delete incidentJson["postmortemAttachments"];
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
return incidentJson;
|
|
3637
|
+
});
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3511
3640
|
@CaptureSpan()
|
|
3512
3641
|
public async getIncidents(
|
|
3513
3642
|
statusPageId: ObjectID,
|
|
@@ -3771,7 +3900,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
3771
3900
|
IncidentPublicNote,
|
|
3772
3901
|
),
|
|
3773
3902
|
incidentStates: BaseModel.toJSONArray(incidentStates, IncidentState),
|
|
3774
|
-
incidents:
|
|
3903
|
+
incidents: this.serializeIncidentsForStatusPage(incidents),
|
|
3775
3904
|
statusPageResources: BaseModel.toJSONArray(
|
|
3776
3905
|
statusPageResources,
|
|
3777
3906
|
StatusPageResource,
|
|
@@ -5374,7 +5503,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
5374
5503
|
IncidentPublicNote,
|
|
5375
5504
|
),
|
|
5376
5505
|
|
|
5377
|
-
activeIncidents:
|
|
5506
|
+
activeIncidents: this.serializeIncidentsForStatusPage(activeIncidents),
|
|
5378
5507
|
|
|
5379
5508
|
activeEpisodes: activeEpisodesJson,
|
|
5380
5509
|
episodePublicNotes: BaseModel.toJSONArray(
|
|
@@ -39,6 +39,7 @@ export default class TeamMemberAPI extends BaseAPI<
|
|
|
39
39
|
this.router.post(
|
|
40
40
|
`${new this.entityType().getCrudApiPath()?.toString()}/is-user-registered`,
|
|
41
41
|
UserMiddleware.getUserMiddleware,
|
|
42
|
+
UserMiddleware.requireUserAuthentication,
|
|
42
43
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
43
44
|
try {
|
|
44
45
|
const oneUptimeRequest: OneUptimeRequest = req as OneUptimeRequest;
|
|
@@ -103,6 +104,7 @@ export default class TeamMemberAPI extends BaseAPI<
|
|
|
103
104
|
this.router.post(
|
|
104
105
|
`${new this.entityType().getCrudApiPath()?.toString()}/remove-user-from-project`,
|
|
105
106
|
UserMiddleware.getUserMiddleware,
|
|
107
|
+
UserMiddleware.requireUserAuthentication,
|
|
106
108
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
107
109
|
try {
|
|
108
110
|
const oneUptimeRequest: OneUptimeRequest = req as OneUptimeRequest;
|
|
@@ -165,6 +167,7 @@ export default class TeamMemberAPI extends BaseAPI<
|
|
|
165
167
|
this.router.post(
|
|
166
168
|
`${new this.entityType().getCrudApiPath()?.toString()}/:id/leave`,
|
|
167
169
|
UserMiddleware.getUserMiddleware,
|
|
170
|
+
UserMiddleware.requireUserAuthentication,
|
|
168
171
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
169
172
|
try {
|
|
170
173
|
const oneUptimeRequest: OneUptimeRequest = req as OneUptimeRequest;
|
|
@@ -49,6 +49,7 @@ export default class UserCallAPI extends BaseAPI<
|
|
|
49
49
|
this.router.post(
|
|
50
50
|
`/user-call/verify`,
|
|
51
51
|
UserMiddleware.getUserMiddleware,
|
|
52
|
+
UserMiddleware.requireUserAuthentication,
|
|
52
53
|
VerificationCodeRateLimit.getMiddleware(
|
|
53
54
|
VerificationCodeRateLimitBucket.Verify,
|
|
54
55
|
),
|
|
@@ -127,6 +128,7 @@ export default class UserCallAPI extends BaseAPI<
|
|
|
127
128
|
this.router.post(
|
|
128
129
|
`/user-call/resend-verification-code`,
|
|
129
130
|
UserMiddleware.getUserMiddleware,
|
|
131
|
+
UserMiddleware.requireUserAuthentication,
|
|
130
132
|
VerificationCodeRateLimit.getMiddleware(
|
|
131
133
|
VerificationCodeRateLimitBucket.Resend,
|
|
132
134
|
),
|
|
@@ -49,6 +49,7 @@ export default class UserEmailAPI extends BaseAPI<
|
|
|
49
49
|
this.router.post(
|
|
50
50
|
`${new this.entityType().getCrudApiPath()?.toString()}/verify`,
|
|
51
51
|
UserMiddleware.getUserMiddleware,
|
|
52
|
+
UserMiddleware.requireUserAuthentication,
|
|
52
53
|
VerificationCodeRateLimit.getMiddleware(
|
|
53
54
|
VerificationCodeRateLimitBucket.Verify,
|
|
54
55
|
),
|
|
@@ -129,6 +130,7 @@ export default class UserEmailAPI extends BaseAPI<
|
|
|
129
130
|
.getCrudApiPath()
|
|
130
131
|
?.toString()}/resend-verification-code`,
|
|
131
132
|
UserMiddleware.getUserMiddleware,
|
|
133
|
+
UserMiddleware.requireUserAuthentication,
|
|
132
134
|
VerificationCodeRateLimit.getMiddleware(
|
|
133
135
|
VerificationCodeRateLimitBucket.Resend,
|
|
134
136
|
),
|
|
@@ -47,6 +47,7 @@ export default class UserIncomingCallNumberAPI extends BaseAPI<
|
|
|
47
47
|
this.router.post(
|
|
48
48
|
`/user-incoming-call-number/verify`,
|
|
49
49
|
UserMiddleware.getUserMiddleware,
|
|
50
|
+
UserMiddleware.requireUserAuthentication,
|
|
50
51
|
VerificationCodeRateLimit.getMiddleware(
|
|
51
52
|
VerificationCodeRateLimitBucket.Verify,
|
|
52
53
|
),
|
|
@@ -107,6 +108,7 @@ export default class UserIncomingCallNumberAPI extends BaseAPI<
|
|
|
107
108
|
this.router.post(
|
|
108
109
|
`/user-incoming-call-number/resend-verification-code`,
|
|
109
110
|
UserMiddleware.getUserMiddleware,
|
|
111
|
+
UserMiddleware.requireUserAuthentication,
|
|
110
112
|
VerificationCodeRateLimit.getMiddleware(
|
|
111
113
|
VerificationCodeRateLimitBucket.Resend,
|
|
112
114
|
),
|
|
@@ -32,6 +32,7 @@ export default class UserMicrosoftTeamsAPI extends BaseAPI<
|
|
|
32
32
|
this.router.post(
|
|
33
33
|
`${new this.entityType().getCrudApiPath()?.toString()}/test`,
|
|
34
34
|
UserMiddleware.getUserMiddleware,
|
|
35
|
+
UserMiddleware.requireUserAuthentication,
|
|
35
36
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
36
37
|
try {
|
|
37
38
|
req = req as OneUptimeRequest;
|
|
@@ -31,6 +31,7 @@ export default class UserSlackAPI extends BaseAPI<
|
|
|
31
31
|
this.router.post(
|
|
32
32
|
`${new this.entityType().getCrudApiPath()?.toString()}/test`,
|
|
33
33
|
UserMiddleware.getUserMiddleware,
|
|
34
|
+
UserMiddleware.requireUserAuthentication,
|
|
34
35
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
35
36
|
try {
|
|
36
37
|
req = req as OneUptimeRequest;
|
package/Server/API/UserSmsAPI.ts
CHANGED
|
@@ -46,6 +46,7 @@ export default class UserSMSAPI extends BaseAPI<UserSMS, UserSMSServiceType> {
|
|
|
46
46
|
this.router.post(
|
|
47
47
|
`/user-sms/verify`,
|
|
48
48
|
UserMiddleware.getUserMiddleware,
|
|
49
|
+
UserMiddleware.requireUserAuthentication,
|
|
49
50
|
VerificationCodeRateLimit.getMiddleware(
|
|
50
51
|
VerificationCodeRateLimitBucket.Verify,
|
|
51
52
|
),
|
|
@@ -124,6 +125,7 @@ export default class UserSMSAPI extends BaseAPI<UserSMS, UserSMSServiceType> {
|
|
|
124
125
|
this.router.post(
|
|
125
126
|
`/user-sms/resend-verification-code`,
|
|
126
127
|
UserMiddleware.getUserMiddleware,
|
|
128
|
+
UserMiddleware.requireUserAuthentication,
|
|
127
129
|
VerificationCodeRateLimit.getMiddleware(
|
|
128
130
|
VerificationCodeRateLimitBucket.Resend,
|
|
129
131
|
),
|
|
@@ -31,6 +31,7 @@ export default class UserTotpAuthAPI extends BaseAPI<
|
|
|
31
31
|
this.router.post(
|
|
32
32
|
`${new this.entityType().getCrudApiPath()?.toString()}/validate`,
|
|
33
33
|
UserMiddleware.getUserMiddleware,
|
|
34
|
+
UserMiddleware.requireUserAuthentication,
|
|
34
35
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
35
36
|
try {
|
|
36
37
|
const userTotpAuth: UserTotpAuth | null =
|
|
@@ -34,6 +34,7 @@ export default class UserWebAuthnAPI extends BaseAPI<
|
|
|
34
34
|
this.router.post(
|
|
35
35
|
`${new this.entityType().getCrudApiPath()?.toString()}/generate-registration-options`,
|
|
36
36
|
UserMiddleware.getUserMiddleware,
|
|
37
|
+
UserMiddleware.requireUserAuthentication,
|
|
37
38
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
38
39
|
try {
|
|
39
40
|
const userId: ObjectID = (req as OneUptimeRequest).userAuthorization!
|
|
@@ -55,6 +56,7 @@ export default class UserWebAuthnAPI extends BaseAPI<
|
|
|
55
56
|
this.router.post(
|
|
56
57
|
`${new this.entityType().getCrudApiPath()?.toString()}/verify-registration`,
|
|
57
58
|
UserMiddleware.getUserMiddleware,
|
|
59
|
+
UserMiddleware.requireUserAuthentication,
|
|
58
60
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
59
61
|
try {
|
|
60
62
|
const data: JSONObject = req.body;
|
|
@@ -26,6 +26,7 @@ export default class UserWebhookAPI extends BaseAPI<
|
|
|
26
26
|
this.router.post(
|
|
27
27
|
`${new this.entityType().getCrudApiPath()?.toString()}/test`,
|
|
28
28
|
UserMiddleware.getUserMiddleware,
|
|
29
|
+
UserMiddleware.requireUserAuthentication,
|
|
29
30
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
30
31
|
try {
|
|
31
32
|
req = req as OneUptimeRequest;
|
|
@@ -49,6 +49,7 @@ export default class UserWhatsAppAPI extends BaseAPI<
|
|
|
49
49
|
this.router.post(
|
|
50
50
|
`${new this.entityType().getCrudApiPath()?.toString()}/verify`,
|
|
51
51
|
UserMiddleware.getUserMiddleware,
|
|
52
|
+
UserMiddleware.requireUserAuthentication,
|
|
52
53
|
VerificationCodeRateLimit.getMiddleware(
|
|
53
54
|
VerificationCodeRateLimitBucket.Verify,
|
|
54
55
|
),
|
|
@@ -129,6 +130,7 @@ export default class UserWhatsAppAPI extends BaseAPI<
|
|
|
129
130
|
.getCrudApiPath()
|
|
130
131
|
?.toString()}/resend-verification-code`,
|
|
131
132
|
UserMiddleware.getUserMiddleware,
|
|
133
|
+
UserMiddleware.requireUserAuthentication,
|
|
132
134
|
VerificationCodeRateLimit.getMiddleware(
|
|
133
135
|
VerificationCodeRateLimitBucket.Resend,
|
|
134
136
|
),
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
NextFunction,
|
|
9
9
|
} from "../Utils/Express";
|
|
10
10
|
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
11
|
+
import NotAuthenticatedException from "../../Types/Exception/NotAuthenticatedException";
|
|
11
12
|
import JSONWebTokenData from "../../Types/JsonWebTokenData";
|
|
12
13
|
import ObjectID from "../../Types/ObjectID";
|
|
13
14
|
|
|
@@ -21,11 +22,21 @@ export default class MasterAdminAuthorization {
|
|
|
21
22
|
const accessToken: string | undefined =
|
|
22
23
|
UserMiddleware.getAccessTokenFromExpressRequest(req);
|
|
23
24
|
|
|
25
|
+
/*
|
|
26
|
+
* No token and an undecodable one are both 401, not 422: the access-token
|
|
27
|
+
* cookie expires with the JWT inside it, so an Admin Dashboard tab left
|
|
28
|
+
* idle past the token lifetime arrives here with no token at all. Only a
|
|
29
|
+
* 401 makes the browser client refresh the session and replay the
|
|
30
|
+
* request; a 422 left the admin looking at "Unauthorized" until a reload.
|
|
31
|
+
* A valid session that simply is not a master admin stays 422.
|
|
32
|
+
*/
|
|
24
33
|
if (!accessToken) {
|
|
25
34
|
Response.sendErrorResponse(
|
|
26
35
|
req,
|
|
27
36
|
res,
|
|
28
|
-
new
|
|
37
|
+
new NotAuthenticatedException(
|
|
38
|
+
"Unauthorized: Access token is required.",
|
|
39
|
+
),
|
|
29
40
|
);
|
|
30
41
|
return;
|
|
31
42
|
}
|
|
@@ -48,7 +59,7 @@ export default class MasterAdminAuthorization {
|
|
|
48
59
|
Response.sendErrorResponse(
|
|
49
60
|
req,
|
|
50
61
|
res,
|
|
51
|
-
new
|
|
62
|
+
new NotAuthenticatedException(
|
|
52
63
|
"Unauthorized: Invalid or expired access token.",
|
|
53
64
|
),
|
|
54
65
|
);
|