@oneuptime/common 14.0.9 → 14.0.10
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/AutoRemediationSuggestion.ts +60 -0
- package/Models/DatabaseModels/CephCluster.ts +213 -0
- package/Models/DatabaseModels/DatabaseServer.ts +213 -0
- package/Models/DatabaseModels/DockerHost.ts +213 -0
- package/Models/DatabaseModels/DockerSwarmCluster.ts +213 -0
- package/Models/DatabaseModels/GlobalConfig.ts +1 -1
- package/Models/DatabaseModels/Host.ts +213 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/PodmanHost.ts +213 -0
- package/Models/DatabaseModels/ProxmoxCluster.ts +213 -0
- package/Models/DatabaseModels/ResourceAiAgent.ts +419 -0
- package/Models/DatabaseModels/RunnerJob.ts +144 -0
- package/Models/DatabaseModels/VMwareVCenter.ts +213 -0
- package/Server/API/AutoRemediationAPI.ts +392 -1
- package/Server/API/ResourceAiAccessAPI.ts +1669 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.ts +423 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Infrastructure/Semaphore.ts +22 -0
- package/Server/Middleware/TelemetryIngest.ts +15 -5
- package/Server/Services/AnalyticsDatabaseService.ts +45 -1
- package/Server/Services/AutoRemediationRuleEngineService.ts +940 -112
- package/Server/Services/CephClusterService.ts +109 -1
- package/Server/Services/DatabaseServerService.ts +116 -1
- package/Server/Services/DockerHostService.ts +109 -1
- package/Server/Services/DockerSwarmClusterService.ts +113 -1
- package/Server/Services/HostService.ts +126 -4
- package/Server/Services/MetricRecordingRuleService.ts +47 -0
- package/Server/Services/PodmanHostService.ts +109 -1
- package/Server/Services/ProxmoxClusterService.ts +110 -1
- package/Server/Services/ResourceAiAccessService.ts +1439 -0
- package/Server/Services/ResourceAiAgentJobService.ts +202 -0
- package/Server/Services/ResourceAiAgentService.ts +2432 -0
- package/Server/Services/RunnerJobService.ts +611 -4
- package/Server/Services/TelemetryUsageBillingService.ts +28 -0
- package/Server/Services/TraceRecordingRuleService.ts +33 -0
- package/Server/Services/VMwareVCenterService.ts +110 -1
- package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +1434 -32
- package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +935 -21
- package/Server/Utils/AI/Remediation/RemediationPlanRunner.ts +25 -1
- package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +577 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAccessContext.ts +271 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.ts +45 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.ts +964 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.ts +333 -0
- package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +873 -0
- package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +72 -2
- package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +72 -5
- package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +72 -5
- package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +396 -13
- package/Server/Utils/AutoRemediation/RemediationVerifier.ts +35 -2
- package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +9 -1
- package/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.ts +920 -0
- package/Server/Utils/SessionReplay/SessionReplayUsage.ts +84 -6
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +35 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +33 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +21 -1
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +298 -224
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +35 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +389 -175
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +366 -143
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.ts +163 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.ts +396 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.ts +418 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.ts +152 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.ts +251 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.ts +214 -0
- package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +93 -0
- package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +18 -6
- package/Tests/App/Dashboard/InvestigationInfrastructureTools.test.tsx +506 -0
- package/Tests/App/Dashboard/RemediationSuggestionCardDescription.test.tsx +209 -0
- package/Tests/App/Dashboard/RemediationSuggestionCardResource.test.tsx +317 -0
- package/Tests/App/Dashboard/ResourceAiAccessSettingsUtil.test.ts +921 -0
- package/Tests/App/Dashboard/ResourceAiAgentInstall.test.ts +860 -0
- package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +1721 -0
- package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +1002 -0
- package/Tests/App/Dashboard/ResourceAiInsightsPage.test.tsx +931 -0
- package/Tests/App/Dashboard/ResourceAiNavigation.test.tsx +575 -0
- package/Tests/App/Dashboard/RunbookStepTypeMaps.test.ts +38 -7
- package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +33 -1
- package/Tests/Models/DatabaseModels/ResourceAiAccessColumns.test.ts +738 -0
- package/Tests/Models/DatabaseModels/ResourceAiAgentModel.test.ts +842 -0
- package/Tests/Server/API/AutoRemediationApproveResourceRound.test.ts +835 -0
- package/Tests/Server/API/ResourceAiAccessAPI.test.ts +2730 -0
- package/Tests/Server/Infrastructure/Postgres/AddDatabaseServerTablesMigration.test.ts +60 -0
- package/Tests/Server/Infrastructure/Postgres/AddResourceAiAgentsMigration.test.ts +659 -0
- package/Tests/Server/Infrastructure/SemaphoreMutex.test.ts +31 -0
- package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +63 -5
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +103 -5
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +19 -1
- package/Tests/Server/Services/AutoRemediationResourceRuleEngine.test.ts +1279 -0
- package/Tests/Server/Services/DatabaseServerService.test.ts +55 -0
- package/Tests/Server/Services/GroupTelemetryUsageExcludeNames.test.ts +299 -0
- package/Tests/Server/Services/HostServiceFindOrCreateMemo.test.ts +44 -0
- package/Tests/Server/Services/MonitorProbeServiceIntervalScheduling.test.ts +45 -6
- package/Tests/Server/Services/RecordingRuleReservedMetricName.test.ts +171 -0
- package/Tests/Server/Services/ResourceAiAccessChangeAuthorization.test.ts +256 -0
- package/Tests/Server/Services/ResourceAiAccessService.test.ts +1373 -0
- package/Tests/Server/Services/ResourceAiAgentJobService.test.ts +375 -0
- package/Tests/Server/Services/ResourceAiAgentServiceHelpers.test.ts +1114 -0
- package/Tests/Server/Services/ResourceAiAgentServiceLifecycle.test.ts +1050 -0
- package/Tests/Server/Services/ResourceAiAgentServiceRegister.test.ts +2251 -0
- package/Tests/Server/Services/ResourceAiSettingsCreate.test.ts +373 -0
- package/Tests/Server/Services/ResourceAiSettingsPermission.test.ts +1042 -0
- package/Tests/Server/Services/ResourceServiceDeleteCleansUpAi.test.ts +319 -0
- package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +105 -0
- package/Tests/Server/Services/RunnerJobEnqueueResourceCommand.test.ts +986 -0
- package/Tests/Server/Services/RunnerJobResourceCommandLane.test.ts +211 -0
- package/Tests/Server/Services/RunnerJobResourceCommandTimeoutAndRedaction.test.ts +352 -0
- package/Tests/Server/Services/TelemetryUsageBillingSloExclusion.test.ts +218 -0
- package/Tests/Server/TestingUtils/Services/FakeRunnerJobCount.ts +145 -0
- package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +453 -0
- package/Tests/Server/Utils/AI/InvestigationInfrastructureReport.test.ts +721 -0
- package/Tests/Server/Utils/AI/RemediationCommandTools.test.ts +94 -1
- package/Tests/Server/Utils/AI/RemediationCommandToolsResource.test.ts +1530 -0
- package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +1249 -0
- package/Tests/Server/Utils/AI/RemediationPlanRunner.test.ts +117 -0
- package/Tests/Server/Utils/AI/RemediationResourceCopyParity.test.ts +463 -0
- package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +722 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAccessContext.test.ts +266 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.test.ts +1220 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.test.ts +569 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +830 -0
- package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorResource.test.ts +717 -0
- package/Tests/Server/Utils/AutoRemediation/RemediationVerifierResourceFollowUp.test.ts +338 -0
- package/Tests/Server/Utils/Monitor/Criteria/SessionReplayBudgetTemplateCriteria.test.ts +422 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.test.ts +1647 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayUsage.test.ts +143 -1
- package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +33 -3
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsAccountNotLinked.test.ts +1093 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.test.ts +1049 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.test.ts +1676 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCards.test.ts +2884 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.test.ts +2490 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmit.test.ts +2293 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmitServerTimezone.test.ts +386 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.test.ts +1477 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.test.ts +1967 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsStripHtmlTags.test.ts +92 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsSubmittedFormRemoval.test.ts +1819 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.test.ts +1033 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezoneServerZone.test.ts +610 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsBotMessageHandling.test.ts +2610 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsCreateCommandsEndToEnd.test.ts +4672 -0
- package/Tests/Server/Utils/Workspace/WorkspaceCreateProjectReferences.test.ts +190 -65
- package/Tests/Types/AutoRemediation/AiRemediationCommandPlan.test.ts +10 -4
- package/Tests/Types/AutoRemediation/AiRemediationCommandPlanResourceCommand.test.ts +305 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +277 -13
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +113 -0
- package/Tests/Types/Monitor/RumAlertTemplates.test.ts +773 -2
- package/Tests/Types/ResourceAiAgent/AiResourceType.test.ts +419 -0
- package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +517 -0
- package/Tests/Types/Runbook/RunbookStepType.test.ts +147 -8
- package/Tests/UI/Rum/RecordingHealthDashboard.test.tsx +769 -1
- package/Tests/Utils/AiRemediation/Resource/CephCommandPolicy.test.ts +1653 -0
- package/Tests/Utils/AiRemediation/Resource/CephOutputRedaction.test.ts +204 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseCommandPolicy.test.ts +1077 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.test.ts +558 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseQueryRedactor.test.ts +834 -0
- package/Tests/Utils/AiRemediation/Resource/DockerCliGrammar.test.ts +747 -0
- package/Tests/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.test.ts +1259 -0
- package/Tests/Utils/AiRemediation/Resource/DockerOutputRedaction.test.ts +386 -0
- package/Tests/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.test.ts +782 -0
- package/Tests/Utils/AiRemediation/Resource/GovcCommandPolicy.test.ts +2259 -0
- package/Tests/Utils/AiRemediation/Resource/HostCommandPolicy.test.ts +2019 -0
- package/Tests/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.test.ts +2497 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicy.test.ts +1305 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.test.ts +585 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactor.test.ts +334 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactorCopyParity.test.ts +98 -0
- package/Tests/Utils/AiRemediation/Resource/ResourcePolicyImportClosure.test.ts +391 -0
- package/Tests/Utils/AiRemediation/ResourceAiAgentPolicyCopyParity.test.ts +497 -0
- package/Tests/Utils/SessionReplay/SessionReplayBudgetMetricType.test.ts +383 -0
- package/Types/AI/ResourceAiAccessApi.ts +140 -0
- package/Types/AI/ResourceAiAccessPermissions.ts +126 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.ts +183 -2
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +55 -22
- package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +35 -3
- package/Types/Monitor/RumAlertTemplates.ts +351 -4
- package/Types/ResourceAiAgent/AiResourceType.ts +310 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.ts +574 -0
- package/Types/Rum/SessionReplayBudgetMetricType.ts +47 -0
- package/Types/Runbook/RunbookStepType.ts +29 -0
- package/Types/Telemetry/TelemetryIngestSurface.ts +14 -2
- package/Utils/AI/InvestigationReport.ts +121 -15
- package/Utils/AiRemediation/Resource/CephCommandPolicy.ts +1936 -0
- package/Utils/AiRemediation/Resource/DatabaseCommandPolicy.ts +166 -0
- package/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.ts +1532 -0
- package/Utils/AiRemediation/Resource/DatabaseQueryRedactor.ts +1394 -0
- package/Utils/AiRemediation/Resource/DockerCliGrammar.ts +1839 -0
- package/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.ts +490 -0
- package/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.ts +687 -0
- package/Utils/AiRemediation/Resource/GovcCommandPolicy.ts +2096 -0
- package/Utils/AiRemediation/Resource/HostCommandPolicy.ts +2982 -0
- package/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.ts +1679 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.ts +851 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.ts +593 -0
- package/Utils/AiRemediation/Resource/ResourceOutputRedactor.ts +2812 -0
- package/Utils/SessionReplay/SessionReplayBudgetMetricType.ts +184 -0
- package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
- package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CephCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseServer.js +219 -0
- package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js +219 -0
- package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Host.js +219 -0
- package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/PodmanHost.js +219 -0
- package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ResourceAiAgent.js +439 -0
- package/build/dist/Models/DatabaseModels/ResourceAiAgent.js.map +1 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js +145 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js +219 -0
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
- package/build/dist/Server/API/AutoRemediationAPI.js +231 -1
- package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
- package/build/dist/Server/API/ResourceAiAccessAPI.js +1119 -0
- package/build/dist/Server/API/ResourceAiAccessAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js +168 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.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/Infrastructure/Semaphore.js +6 -0
- package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +12 -5
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +26 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +601 -3
- package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/CephClusterService.js +104 -0
- package/build/dist/Server/Services/CephClusterService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseServerService.js +99 -0
- package/build/dist/Server/Services/DatabaseServerService.js.map +1 -1
- package/build/dist/Server/Services/DockerHostService.js +104 -0
- package/build/dist/Server/Services/DockerHostService.js.map +1 -1
- package/build/dist/Server/Services/DockerSwarmClusterService.js +104 -0
- package/build/dist/Server/Services/DockerSwarmClusterService.js.map +1 -1
- package/build/dist/Server/Services/HostService.js +114 -2
- package/build/dist/Server/Services/HostService.js.map +1 -1
- package/build/dist/Server/Services/MetricRecordingRuleService.js +46 -0
- package/build/dist/Server/Services/MetricRecordingRuleService.js.map +1 -1
- package/build/dist/Server/Services/PodmanHostService.js +104 -0
- package/build/dist/Server/Services/PodmanHostService.js.map +1 -1
- package/build/dist/Server/Services/ProxmoxClusterService.js +104 -0
- package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -1
- package/build/dist/Server/Services/ResourceAiAccessService.js +1028 -0
- package/build/dist/Server/Services/ResourceAiAccessService.js.map +1 -0
- package/build/dist/Server/Services/ResourceAiAgentJobService.js +173 -0
- package/build/dist/Server/Services/ResourceAiAgentJobService.js.map +1 -0
- package/build/dist/Server/Services/ResourceAiAgentService.js +1687 -0
- package/build/dist/Server/Services/ResourceAiAgentService.js.map +1 -0
- package/build/dist/Server/Services/RunnerJobService.js +344 -5
- package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +26 -0
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/TraceRecordingRuleService.js +37 -0
- package/build/dist/Server/Services/TraceRecordingRuleService.js.map +1 -1
- package/build/dist/Server/Services/VMwareVCenterService.js +104 -0
- package/build/dist/Server/Services/VMwareVCenterService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +1029 -30
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +633 -28
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js +21 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +330 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js +160 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js +33 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js +640 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js +226 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +600 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +50 -4
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +55 -4
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +55 -4
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +290 -13
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
- package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js +29 -1
- package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js.map +1 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +9 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js +627 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js.map +1 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js +60 -5
- package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +17 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +183 -209
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +233 -167
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +263 -110
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js +129 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js +266 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js +258 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js +104 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js +183 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js +123 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js.map +1 -0
- package/build/dist/Types/AI/ResourceAiAccessApi.js +30 -0
- package/build/dist/Types/AI/ResourceAiAccessApi.js.map +1 -0
- package/build/dist/Types/AI/ResourceAiAccessPermissions.js +98 -0
- package/build/dist/Types/AI/ResourceAiAccessPermissions.js.map +1 -0
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +116 -29
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +47 -21
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +5 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -1
- package/build/dist/Types/Monitor/RumAlertTemplates.js +199 -3
- package/build/dist/Types/Monitor/RumAlertTemplates.js.map +1 -1
- package/build/dist/Types/ResourceAiAgent/AiResourceType.js +242 -0
- package/build/dist/Types/ResourceAiAgent/AiResourceType.js.map +1 -0
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +275 -0
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js +45 -0
- package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookStepType.js +27 -0
- package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +13 -2
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
- package/build/dist/Utils/AI/InvestigationReport.js +71 -11
- package/build/dist/Utils/AI/InvestigationReport.js.map +1 -1
- package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js +1462 -0
- package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js +122 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js +1139 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js +1060 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js +1301 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js +370 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js +498 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js +1565 -0
- package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js +2206 -0
- package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js +1129 -0
- package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +565 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js +408 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js +1910 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js.map +1 -0
- package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js +160 -0
- package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The docker-engine command policy: tiers the docker CLI against a Docker
|
|
3
|
+
* or Podman engine (Podman through its Docker-compatible API) for Docker
|
|
4
|
+
* and Podman hosts. The CLI's grammar — how the command is found, how
|
|
5
|
+
* flags are parsed, which values are accepted — lives in DockerCliGrammar,
|
|
6
|
+
* shared with the docker-swarm policy.
|
|
7
|
+
*
|
|
8
|
+
* Read: docker ps (and container ls), inspect with an explicit --type (and
|
|
9
|
+
* container / image / network / volume inspect), bounded logs (--tail N up
|
|
10
|
+
* to 2000, or a --since of at most 24h; never --follow), stats --no-stream,
|
|
11
|
+
* top, bounded events (--since and a relative --until), info, version,
|
|
12
|
+
* system df (-v only as a table), images, network ls, volume ls, port and
|
|
13
|
+
* diff. `--format` is json (or table for lists) — never a Go template.
|
|
14
|
+
*
|
|
15
|
+
* SafeWrite — a reversible change to exactly ONE named container:
|
|
16
|
+
* restart (optionally -t N), start and unpause. The container comes back
|
|
17
|
+
* with the image and configuration it already had.
|
|
18
|
+
*
|
|
19
|
+
* RiskyWrite: stop (-t N), kill (-s TERM|INT|HUP|QUIT|USR1|USR2|KILL, in any
|
|
20
|
+
* case, with or without SIG), pause, update of the memory, CPU, restart
|
|
21
|
+
* policy and pids limits (--memory/-m, --memory-swap, --memory-reservation,
|
|
22
|
+
* --cpus, --cpu-shares/-c, --restart, --pids-limit), and a SafeWrite verb
|
|
23
|
+
* that names more than one container.
|
|
24
|
+
*
|
|
25
|
+
* Denied: everything else — exec, run, create, cp, attach, rm, rmi, every
|
|
26
|
+
* prune, build, push, pull, login, save/load/export/import, commit,
|
|
27
|
+
* plugins, secrets, configs, swarm, service, node and stack (a swarm runs
|
|
28
|
+
* through the docker-swarm policy), contexts, trust, manifests, compose,
|
|
29
|
+
* network and volume changes, any other flag of update (or of any other
|
|
30
|
+
* command), and ANY flag before the command: that is where docker's global
|
|
31
|
+
* flags live (-H/--host, -c/--context, --config, --tls*, -D/--debug,
|
|
32
|
+
* -l/--log-level), and they would point the CLI at another engine.
|
|
33
|
+
*
|
|
34
|
+
* Targets are the container names or ids exactly as written; the
|
|
35
|
+
* dispatcher compares them with the agent's protected targets (its own
|
|
36
|
+
* container) and ONEUPTIME_AI_WRITE_TARGETS.
|
|
37
|
+
*
|
|
38
|
+
* Part of the import-closed resource policy directory that the resource AI
|
|
39
|
+
* agent carries a byte-identical copy of: relative imports of that set only.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
import { ResourceCommandTier } from "../../../Types/ResourceAiAgent/ResourceAiAccess";
|
|
43
|
+
import {
|
|
44
|
+
ResourceCommandPolicyResult,
|
|
45
|
+
ResourceToolPolicy,
|
|
46
|
+
} from "./ResourceCommandPolicyCore";
|
|
47
|
+
import {
|
|
48
|
+
DOCKER_ENGINE_READ_COMMANDS,
|
|
49
|
+
DOCKER_SWARM_GROUPS,
|
|
50
|
+
DockerCommandSpec,
|
|
51
|
+
DockerFlagKind,
|
|
52
|
+
DockerFlagSpec,
|
|
53
|
+
DockerJudgement,
|
|
54
|
+
DockerParsedArgs,
|
|
55
|
+
DockerProfile,
|
|
56
|
+
deniedJudgement,
|
|
57
|
+
dockerFlagValue,
|
|
58
|
+
evaluateDockerArgvSafely,
|
|
59
|
+
findBadDockerName,
|
|
60
|
+
isDockerCpuCount,
|
|
61
|
+
isDockerMemorySize,
|
|
62
|
+
mergeDockerCommands,
|
|
63
|
+
parseDockerCount,
|
|
64
|
+
} from "./DockerCliGrammar";
|
|
65
|
+
|
|
66
|
+
// The longest wait, in seconds, -t may give a container before it is killed.
|
|
67
|
+
export const DOCKER_MAX_STOP_TIMEOUT_SECONDS: number = 600;
|
|
68
|
+
|
|
69
|
+
// The signals `docker kill -s` may send, without the SIG prefix.
|
|
70
|
+
export const DOCKER_KILL_SIGNALS: ReadonlyArray<string> = [
|
|
71
|
+
"TERM",
|
|
72
|
+
"INT",
|
|
73
|
+
"HUP",
|
|
74
|
+
"QUIT",
|
|
75
|
+
"USR1",
|
|
76
|
+
"USR2",
|
|
77
|
+
"KILL",
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// -t/--timeout (and its deprecated spelling --time) for restart and stop.
|
|
81
|
+
const TIMEOUT_FLAG: DockerFlagSpec = {
|
|
82
|
+
name: "timeout",
|
|
83
|
+
shorthand: "t",
|
|
84
|
+
kind: DockerFlagKind.Value,
|
|
85
|
+
aliases: ["time"],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const STOP_SIGNAL_REFUSED_FLAG: DockerFlagSpec = {
|
|
89
|
+
name: "signal",
|
|
90
|
+
shorthand: "s",
|
|
91
|
+
kind: DockerFlagKind.Value,
|
|
92
|
+
refusal:
|
|
93
|
+
"is not allowed here: the container's own stop signal is what a clean stop sends (to send a particular signal, use docker kill -s SIGNAL NAME)",
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Why -t/--timeout is unusable, or null.
|
|
97
|
+
function findBadTimeout(parsed: DockerParsedArgs): string | null {
|
|
98
|
+
const timeout: string | undefined = dockerFlagValue(parsed, "timeout");
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
timeout !== undefined &&
|
|
102
|
+
parseDockerCount(timeout, DOCKER_MAX_STOP_TIMEOUT_SECONDS) === null
|
|
103
|
+
) {
|
|
104
|
+
return `-t/--timeout takes a number of seconds from 0 to ${DOCKER_MAX_STOP_TIMEOUT_SECONDS}, not "${timeout}"`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
* A write to the containers a command names. `oneTier` is its tier for
|
|
112
|
+
* exactly one container; more than one is always RiskyWrite.
|
|
113
|
+
*/
|
|
114
|
+
function judgeContainerWrite(data: {
|
|
115
|
+
parsed: DockerParsedArgs;
|
|
116
|
+
flagProblem: string | null;
|
|
117
|
+
oneTier: ResourceCommandTier;
|
|
118
|
+
oneReason: string;
|
|
119
|
+
manyReason: string;
|
|
120
|
+
}): DockerJudgement {
|
|
121
|
+
const names: Array<string> = data.parsed.positionals;
|
|
122
|
+
|
|
123
|
+
if (data.flagProblem) {
|
|
124
|
+
return deniedJudgement(data.flagProblem);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (names.length === 0) {
|
|
128
|
+
return deniedJudgement("it needs the container to change (a name or id)");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const problem: string | null = findBadDockerName(names, "container");
|
|
132
|
+
|
|
133
|
+
if (problem) {
|
|
134
|
+
return deniedJudgement(problem);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (names.length === 1) {
|
|
138
|
+
return { tier: data.oneTier, reason: data.oneReason, targets: names };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
tier: ResourceCommandTier.RiskyWrite,
|
|
143
|
+
reason: data.manyReason,
|
|
144
|
+
targets: names,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const restartSpec: (verb: string) => DockerCommandSpec = (
|
|
149
|
+
verb: string,
|
|
150
|
+
): DockerCommandSpec => {
|
|
151
|
+
return {
|
|
152
|
+
verb,
|
|
153
|
+
flags: [TIMEOUT_FLAG, STOP_SIGNAL_REFUSED_FLAG],
|
|
154
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
155
|
+
return judgeContainerWrite({
|
|
156
|
+
parsed,
|
|
157
|
+
flagProblem: findBadTimeout(parsed),
|
|
158
|
+
oneTier: ResourceCommandTier.SafeWrite,
|
|
159
|
+
oneReason:
|
|
160
|
+
"restarts one container, which comes back with the image and configuration it already had",
|
|
161
|
+
manyReason:
|
|
162
|
+
"restarts several containers at once (a restart is a safe change for exactly one container)",
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const startSpec: (verb: string) => DockerCommandSpec = (
|
|
169
|
+
verb: string,
|
|
170
|
+
): DockerCommandSpec => {
|
|
171
|
+
const interactive: string =
|
|
172
|
+
"is not allowed: OneUptime AI never attaches to a container's output or input";
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
verb,
|
|
176
|
+
flags: [
|
|
177
|
+
{
|
|
178
|
+
name: "attach",
|
|
179
|
+
shorthand: "a",
|
|
180
|
+
kind: DockerFlagKind.Bool,
|
|
181
|
+
refusal: interactive,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "interactive",
|
|
185
|
+
shorthand: "i",
|
|
186
|
+
kind: DockerFlagKind.Bool,
|
|
187
|
+
refusal: interactive,
|
|
188
|
+
},
|
|
189
|
+
{ name: "detach-keys", kind: DockerFlagKind.Value, refusal: interactive },
|
|
190
|
+
{
|
|
191
|
+
name: "checkpoint",
|
|
192
|
+
kind: DockerFlagKind.Value,
|
|
193
|
+
refusal: "is not allowed: it restores a container from a checkpoint",
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "checkpoint-dir",
|
|
197
|
+
kind: DockerFlagKind.Value,
|
|
198
|
+
refusal: "is not allowed: it restores a container from a checkpoint",
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
202
|
+
return judgeContainerWrite({
|
|
203
|
+
parsed,
|
|
204
|
+
flagProblem: null,
|
|
205
|
+
oneTier: ResourceCommandTier.SafeWrite,
|
|
206
|
+
oneReason:
|
|
207
|
+
"starts one stopped container with the image and configuration it already had",
|
|
208
|
+
manyReason:
|
|
209
|
+
"starts several containers at once (a start is a safe change for exactly one container)",
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const unpauseSpec: (verb: string) => DockerCommandSpec = (
|
|
216
|
+
verb: string,
|
|
217
|
+
): DockerCommandSpec => {
|
|
218
|
+
return {
|
|
219
|
+
verb,
|
|
220
|
+
flags: [],
|
|
221
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
222
|
+
return judgeContainerWrite({
|
|
223
|
+
parsed,
|
|
224
|
+
flagProblem: null,
|
|
225
|
+
oneTier: ResourceCommandTier.SafeWrite,
|
|
226
|
+
oneReason: "resumes one paused container",
|
|
227
|
+
manyReason:
|
|
228
|
+
"resumes several containers at once (an unpause is a safe change for exactly one container)",
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const stopSpec: (verb: string) => DockerCommandSpec = (
|
|
235
|
+
verb: string,
|
|
236
|
+
): DockerCommandSpec => {
|
|
237
|
+
return {
|
|
238
|
+
verb,
|
|
239
|
+
flags: [TIMEOUT_FLAG, STOP_SIGNAL_REFUSED_FLAG],
|
|
240
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
241
|
+
return judgeContainerWrite({
|
|
242
|
+
parsed,
|
|
243
|
+
flagProblem: findBadTimeout(parsed),
|
|
244
|
+
oneTier: ResourceCommandTier.RiskyWrite,
|
|
245
|
+
oneReason:
|
|
246
|
+
"stops a container: whatever it serves is down until something starts it again",
|
|
247
|
+
manyReason:
|
|
248
|
+
"stops several containers: whatever they serve is down until something starts them again",
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// The signal `docker kill -s` names, without SIG, or null when it is not allowed.
|
|
255
|
+
export function normalizeDockerKillSignal(value: string): string | null {
|
|
256
|
+
if (typeof value !== "string") {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// As the engine reads it: case-insensitive, one optional SIG prefix.
|
|
261
|
+
const upper: string = value.toUpperCase();
|
|
262
|
+
const bare: string = upper.startsWith("SIG") ? upper.slice(3) : upper;
|
|
263
|
+
|
|
264
|
+
return DOCKER_KILL_SIGNALS.includes(bare) ? bare : null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const killSpec: (verb: string) => DockerCommandSpec = (
|
|
268
|
+
verb: string,
|
|
269
|
+
): DockerCommandSpec => {
|
|
270
|
+
return {
|
|
271
|
+
verb,
|
|
272
|
+
flags: [{ name: "signal", shorthand: "s", kind: DockerFlagKind.Value }],
|
|
273
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
274
|
+
const written: string | undefined = dockerFlagValue(parsed, "signal");
|
|
275
|
+
const signal: string | null =
|
|
276
|
+
written === undefined ? "KILL" : normalizeDockerKillSignal(written);
|
|
277
|
+
|
|
278
|
+
return judgeContainerWrite({
|
|
279
|
+
parsed,
|
|
280
|
+
flagProblem:
|
|
281
|
+
signal === null
|
|
282
|
+
? `-s/--signal must be one of ${DOCKER_KILL_SIGNALS.join(", ")} (with or without SIG), not "${written}"`
|
|
283
|
+
: null,
|
|
284
|
+
oneTier: ResourceCommandTier.RiskyWrite,
|
|
285
|
+
oneReason: `sends SIG${signal} to a container${
|
|
286
|
+
signal === "KILL" ? ", which stops it without a clean shutdown" : ""
|
|
287
|
+
}`,
|
|
288
|
+
manyReason: `sends SIG${signal} to several containers`,
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const pauseSpec: (verb: string) => DockerCommandSpec = (
|
|
295
|
+
verb: string,
|
|
296
|
+
): DockerCommandSpec => {
|
|
297
|
+
return {
|
|
298
|
+
verb,
|
|
299
|
+
flags: [],
|
|
300
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
301
|
+
return judgeContainerWrite({
|
|
302
|
+
parsed,
|
|
303
|
+
flagProblem: null,
|
|
304
|
+
oneTier: ResourceCommandTier.RiskyWrite,
|
|
305
|
+
oneReason:
|
|
306
|
+
"freezes every process in a container until it is unpaused: it stops serving meanwhile",
|
|
307
|
+
manyReason:
|
|
308
|
+
"freezes every process in several containers until they are unpaused",
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// The --restart policies `docker update` may set.
|
|
315
|
+
const RESTART_POLICY_REGEX: RegExp =
|
|
316
|
+
/^(?:no|always|unless-stopped|on-failure(?::[0-9]{1,4})?)$/;
|
|
317
|
+
|
|
318
|
+
// A count, or -1 for "unlimited" (--memory-swap, --pids-limit).
|
|
319
|
+
function isCountOrUnlimited(value: string, max: number): boolean {
|
|
320
|
+
return value === "-1" || parseDockerCount(value, max) !== null;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/*
|
|
324
|
+
* The flags `docker update` may use, each with the check its value must
|
|
325
|
+
* pass. Every other update flag (CPU periods and quotas, cpusets, block IO
|
|
326
|
+
* weights, ...) is refused as a flag this policy does not know.
|
|
327
|
+
*/
|
|
328
|
+
const UPDATE_FLAG_CHECKS: ReadonlyArray<{
|
|
329
|
+
flag: DockerFlagSpec;
|
|
330
|
+
isValid: (value: string) => boolean;
|
|
331
|
+
expected: string;
|
|
332
|
+
}> = [
|
|
333
|
+
{
|
|
334
|
+
flag: { name: "memory", shorthand: "m", kind: DockerFlagKind.Value },
|
|
335
|
+
isValid: isDockerMemorySize,
|
|
336
|
+
expected: "a memory size such as 512m or 1g",
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
flag: { name: "memory-swap", kind: DockerFlagKind.Value },
|
|
340
|
+
isValid: (value: string): boolean => {
|
|
341
|
+
return value === "-1" || isDockerMemorySize(value);
|
|
342
|
+
},
|
|
343
|
+
expected: "a memory size such as 1g, or -1 for unlimited swap",
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
flag: { name: "memory-reservation", kind: DockerFlagKind.Value },
|
|
347
|
+
isValid: isDockerMemorySize,
|
|
348
|
+
expected: "a memory size such as 256m",
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
flag: { name: "cpus", kind: DockerFlagKind.Value },
|
|
352
|
+
isValid: isDockerCpuCount,
|
|
353
|
+
expected: "a number of CPUs such as 0.5 or 2",
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
flag: { name: "cpu-shares", shorthand: "c", kind: DockerFlagKind.Value },
|
|
357
|
+
isValid: (value: string): boolean => {
|
|
358
|
+
return parseDockerCount(value, 262144) !== null;
|
|
359
|
+
},
|
|
360
|
+
expected: "a relative CPU weight such as 512 or 1024",
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
flag: { name: "restart", kind: DockerFlagKind.Value },
|
|
364
|
+
isValid: (value: string): boolean => {
|
|
365
|
+
return RESTART_POLICY_REGEX.test(value);
|
|
366
|
+
},
|
|
367
|
+
expected: "no, on-failure[:N], always or unless-stopped",
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
flag: { name: "pids-limit", kind: DockerFlagKind.Value },
|
|
371
|
+
isValid: (value: string): boolean => {
|
|
372
|
+
return isCountOrUnlimited(value, 4194304);
|
|
373
|
+
},
|
|
374
|
+
expected: "a number of processes, or -1 for unlimited",
|
|
375
|
+
},
|
|
376
|
+
];
|
|
377
|
+
|
|
378
|
+
const updateSpec: (verb: string) => DockerCommandSpec = (
|
|
379
|
+
verb: string,
|
|
380
|
+
): DockerCommandSpec => {
|
|
381
|
+
return {
|
|
382
|
+
verb,
|
|
383
|
+
flags: UPDATE_FLAG_CHECKS.map(
|
|
384
|
+
(check: { flag: DockerFlagSpec }): DockerFlagSpec => {
|
|
385
|
+
return check.flag;
|
|
386
|
+
},
|
|
387
|
+
),
|
|
388
|
+
judge(parsed: DockerParsedArgs): DockerJudgement {
|
|
389
|
+
const changed: Array<string> = [];
|
|
390
|
+
let flagProblem: string | null = null;
|
|
391
|
+
|
|
392
|
+
for (const check of UPDATE_FLAG_CHECKS) {
|
|
393
|
+
const value: string | undefined = dockerFlagValue(
|
|
394
|
+
parsed,
|
|
395
|
+
check.flag.name,
|
|
396
|
+
);
|
|
397
|
+
|
|
398
|
+
if (value === undefined) {
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
changed.push(`--${check.flag.name}`);
|
|
403
|
+
|
|
404
|
+
if (!check.isValid(value) && flagProblem === null) {
|
|
405
|
+
flagProblem = `--${check.flag.name} takes ${check.expected}, not "${value}"`;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (changed.length === 0) {
|
|
410
|
+
return deniedJudgement(
|
|
411
|
+
"it needs at least one of --memory/-m, --memory-swap, --memory-reservation, --cpus, --cpu-shares/-c, --restart or --pids-limit",
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return judgeContainerWrite({
|
|
416
|
+
parsed,
|
|
417
|
+
flagProblem,
|
|
418
|
+
oneTier: ResourceCommandTier.RiskyWrite,
|
|
419
|
+
oneReason: `changes a running container's ${changed.join(", ")} (applied live)`,
|
|
420
|
+
manyReason: `changes the ${changed.join(", ")} of several running containers (applied live)`,
|
|
421
|
+
});
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
// The engine's write commands, by canonical path (see DOCKER_ENGINE_WRITE_PATHS).
|
|
427
|
+
export const DOCKER_ENGINE_WRITE_COMMANDS: ReadonlyMap<
|
|
428
|
+
string,
|
|
429
|
+
DockerCommandSpec
|
|
430
|
+
> = new Map<string, DockerCommandSpec>([
|
|
431
|
+
["restart", restartSpec("restart")],
|
|
432
|
+
["container restart", restartSpec("container restart")],
|
|
433
|
+
["start", startSpec("start")],
|
|
434
|
+
["container start", startSpec("container start")],
|
|
435
|
+
["unpause", unpauseSpec("unpause")],
|
|
436
|
+
["container unpause", unpauseSpec("container unpause")],
|
|
437
|
+
["stop", stopSpec("stop")],
|
|
438
|
+
["container stop", stopSpec("container stop")],
|
|
439
|
+
["kill", killSpec("kill")],
|
|
440
|
+
["container kill", killSpec("container kill")],
|
|
441
|
+
["pause", pauseSpec("pause")],
|
|
442
|
+
["container pause", pauseSpec("container pause")],
|
|
443
|
+
["update", updateSpec("update")],
|
|
444
|
+
["container update", updateSpec("container update")],
|
|
445
|
+
]);
|
|
446
|
+
|
|
447
|
+
const SWARM_ONLY_REFUSAL: string =
|
|
448
|
+
"is a swarm command, which only the Docker Swarm AI agent runs (for a Docker Swarm cluster resource)";
|
|
449
|
+
|
|
450
|
+
export const DOCKER_ENGINE_PROFILE: DockerProfile = {
|
|
451
|
+
name: "docker-engine",
|
|
452
|
+
resourceDescription: "a Docker or Podman host",
|
|
453
|
+
commands: mergeDockerCommands(
|
|
454
|
+
DOCKER_ENGINE_READ_COMMANDS,
|
|
455
|
+
DOCKER_ENGINE_WRITE_COMMANDS,
|
|
456
|
+
),
|
|
457
|
+
refusals: new Map<string, string>(
|
|
458
|
+
DOCKER_SWARM_GROUPS.map((group: string): [string, string] => {
|
|
459
|
+
return [group, SWARM_ONLY_REFUSAL];
|
|
460
|
+
}),
|
|
461
|
+
),
|
|
462
|
+
allowedSummary:
|
|
463
|
+
"Allowed for a Docker or Podman host — reads: docker ps, docker container inspect NAME, docker logs --tail 200 NAME, docker stats --no-stream, docker top NAME, docker events --since 30m --until 0s, docker info, docker version, docker system df, docker images, docker network ls, docker network inspect NAME, docker volume ls, docker volume inspect NAME, docker port NAME, docker diff NAME; changes: docker restart|start|unpause NAME, docker stop|pause NAME, docker kill -s SIGNAL NAME, docker update --memory|--memory-swap|--memory-reservation|--cpus|--cpu-shares|--restart|--pids-limit VALUE NAME",
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const DockerEngineCommandPolicy: ResourceToolPolicy = {
|
|
467
|
+
name: "docker-engine",
|
|
468
|
+
programs: ["docker"],
|
|
469
|
+
readCommandGuide: [
|
|
470
|
+
"- `docker ps -a` — list containers (`-q`, `-n N`, `-l`, `-s`, `--no-trunc`, `--filter KEY=VALUE`, `--format json`)",
|
|
471
|
+
"- `docker container inspect NAME` (or `docker inspect --type container|image|network|volume NAME`) — configuration and state; environment values come back redacted; `--format json` only, never a Go template",
|
|
472
|
+
"- `docker logs --tail 200 NAME` — `--tail N` (N up to 2000) or `--since 30m` is required (without `--tail`, `--since` must be a duration of at most 24h); `--until`, `-t`, `--details` are fine; never `-f`/`--follow`",
|
|
473
|
+
"- `docker stats --no-stream [NAME...]` — `--no-stream` is required; `-a`, `--no-trunc`, `--format json`",
|
|
474
|
+
"- `docker top NAME`, `docker port NAME`, `docker diff NAME` — processes, published ports and changed files of one container",
|
|
475
|
+
"- `docker events --since 30m --until 0s` — both bounds are required, `--until` as a duration (`0s` is now); `--filter KEY=VALUE`",
|
|
476
|
+
"- `docker info`, `docker version`, `docker system df [-v]` (`--format json` without `-v`)",
|
|
477
|
+
"- `docker images`, `docker image inspect IMAGE`, `docker network ls`, `docker network inspect NAME`, `docker volume ls`, `docker volume inspect NAME`",
|
|
478
|
+
"- One command per call: no pipes, no global flags (`-H`, `--context`, ...), no `exec`",
|
|
479
|
+
].join("\n"),
|
|
480
|
+
writeCommandGuide: [
|
|
481
|
+
"- Safe (one container; runs unattended in Automatic mode): `docker restart NAME` (`-t N` ok), `docker start NAME`, `docker unpause NAME`",
|
|
482
|
+
"- Risky (needs approval unless allowlisted or approvals are bypassed): `docker stop NAME` (`-t N`), `docker kill -s TERM|INT|HUP|QUIT|USR1|USR2|KILL NAME`, `docker pause NAME`, `docker update --memory 1g|--memory-swap|--memory-reservation|--cpus 1.5|--cpu-shares N|--restart no|on-failure[:N]|always|unless-stopped|--pids-limit N NAME`, and restart/start/unpause of several containers",
|
|
483
|
+
"- Never: exec, run, create, cp, rm, rmi, any prune, build, pull, push, login, save/load/export/import, commit, network or volume changes, compose, swarm commands, other update flags",
|
|
484
|
+
].join("\n"),
|
|
485
|
+
evaluateArgv(argv: Array<string>): ResourceCommandPolicyResult {
|
|
486
|
+
return evaluateDockerArgvSafely(DOCKER_ENGINE_PROFILE, argv);
|
|
487
|
+
},
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export default DockerEngineCommandPolicy;
|