@oneuptime/common 14.0.0 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1270) hide show
  1. package/Models/DatabaseModels/AlertEpisodeMember.ts +8 -1
  2. package/Models/DatabaseModels/AutoRemediationSuggestion.ts +63 -0
  3. package/Models/DatabaseModels/IncidentEpisodeMember.ts +8 -1
  4. package/Models/DatabaseModels/IncidentEpisodePublicNote.ts +9 -2
  5. package/Models/DatabaseModels/IncidentPublicNote.ts +9 -2
  6. package/Models/DatabaseModels/Index.ts +4 -0
  7. package/Models/DatabaseModels/KubernetesCluster.ts +429 -0
  8. package/Models/DatabaseModels/Monitor.ts +48 -0
  9. package/Models/DatabaseModels/Runner.ts +5 -4
  10. package/Models/DatabaseModels/RunnerJob.ts +66 -0
  11. package/Models/DatabaseModels/ScheduledMaintenancePublicNote.ts +10 -2
  12. package/Models/DatabaseModels/ServiceLevelObjectiveFeed.ts +2 -0
  13. package/Models/DatabaseModels/ServiceLevelObjectiveLabelRule.ts +522 -0
  14. package/Models/DatabaseModels/ServiceLevelObjectiveMonitorRule.ts +38 -4
  15. package/Models/DatabaseModels/ServiceLevelObjectiveOwnerRule.ts +603 -0
  16. package/Models/DatabaseModels/WorkflowVariable.ts +479 -2
  17. package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +79 -25
  18. package/Server/API/AIInvestigationAPI.ts +341 -0
  19. package/Server/API/AutoRemediationAPI.ts +184 -2
  20. package/Server/API/CommonAPI.ts +70 -0
  21. package/Server/API/KubernetesClusterAiAccessAPI.ts +793 -0
  22. package/Server/API/MicrosoftTeamsAPI.ts +770 -315
  23. package/Server/API/MonitorAPI.ts +140 -0
  24. package/Server/API/OnCallScheduleTimelineAPI.ts +5 -21
  25. package/Server/API/SlackAPI.ts +447 -99
  26. package/Server/API/StatusPageAPI.ts +146 -26
  27. package/Server/API/TelemetryAPI.ts +216 -5
  28. package/Server/API/UserTwoFactorBackupCodeAPI.ts +1 -0
  29. package/Server/API/WorkflowVariableAPI.ts +156 -0
  30. package/Server/Infrastructure/GlobalCache.ts +35 -0
  31. package/Server/Infrastructure/Postgres/SchemaMigrations/1794100000000-AddSloLabelAndOwnerRules.ts +248 -0
  32. package/Server/Infrastructure/Postgres/SchemaMigrations/1794200000000-AddSloMonitorRuleMonitorType.ts +19 -0
  33. package/Server/Infrastructure/Postgres/SchemaMigrations/1794300000000-AddOAuth2WorkflowVariables.ts +97 -0
  34. package/Server/Infrastructure/Postgres/SchemaMigrations/1794400000000-AddKubernetesClusterAiAccess.ts +129 -0
  35. package/Server/Infrastructure/Postgres/SchemaMigrations/1794500000000-AddIncomingEmailCustomAddressToMonitor.ts +25 -0
  36. package/Server/Infrastructure/Postgres/SchemaMigrations/1794600000000-AddAuthTokenExpiresAtToWorkspaceProjectAuthToken.ts +20 -0
  37. package/Server/Infrastructure/Postgres/SchemaMigrations/1794700000000-RemoveAppAccessTokenFromWorkspaceProjectAuthTokenMiscData.ts +38 -0
  38. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +14 -0
  39. package/Server/Middleware/MasterAdminAuthorization.ts +28 -0
  40. package/Server/Middleware/TelemetryIngest.ts +47 -2
  41. package/Server/Middleware/UserAuthorization.ts +56 -2
  42. package/Server/Services/AIAgentService.ts +1 -0
  43. package/Server/Services/AccessTokenService.ts +121 -48
  44. package/Server/Services/AlertEpisodeMemberService.ts +9 -0
  45. package/Server/Services/AlertEpisodeService.ts +14 -1
  46. package/Server/Services/AlertService.ts +134 -22
  47. package/Server/Services/AutoRemediationRuleEngineService.ts +968 -39
  48. package/Server/Services/AutoRemediationRuleService.ts +118 -0
  49. package/Server/Services/BillingService.ts +1 -0
  50. package/Server/Services/DatabaseService.ts +10 -0
  51. package/Server/Services/InboundEmail/Providers/SendGridInboundProvider.ts +16 -22
  52. package/Server/Services/IncidentEpisodeMemberService.ts +9 -0
  53. package/Server/Services/IncidentEpisodePublicNoteService.ts +66 -0
  54. package/Server/Services/IncidentEpisodeRoleMemberService.ts +27 -0
  55. package/Server/Services/IncidentEpisodeService.ts +14 -1
  56. package/Server/Services/IncidentGroupingEngineService.ts +11 -0
  57. package/Server/Services/IncidentMemberService.ts +21 -0
  58. package/Server/Services/IncidentPublicNoteService.ts +63 -0
  59. package/Server/Services/IncidentService.ts +120 -20
  60. package/Server/Services/IncidentStateTimelineService.ts +15 -0
  61. package/Server/Services/IncidentTemplateService.ts +83 -3
  62. package/Server/Services/Index.ts +4 -0
  63. package/Server/Services/KubernetesClusterAiAccessService.ts +1943 -0
  64. package/Server/Services/KubernetesClusterService.ts +1570 -1
  65. package/Server/Services/LogAggregationService.ts +14 -6
  66. package/Server/Services/MonitorService.ts +654 -54
  67. package/Server/Services/MonitorStatusTimelineService.ts +639 -2
  68. package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +2 -0
  69. package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +2 -0
  70. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +2 -0
  71. package/Server/Services/OnCallDutyPolicyScheduleService.ts +3 -0
  72. package/Server/Services/OnCallNotificationAlertingService.ts +36 -12
  73. package/Server/Services/OnCallSetupReminderService.ts +1 -0
  74. package/Server/Services/ProbeService.ts +7 -1
  75. package/Server/Services/ProjectService.ts +11 -1
  76. package/Server/Services/RunbookCredentialService.ts +26 -1
  77. package/Server/Services/RunbookSecretService.ts +36 -0
  78. package/Server/Services/RunnerJobService.ts +941 -23
  79. package/Server/Services/RunnerService.ts +439 -6
  80. package/Server/Services/ScheduledMaintenancePublicNoteService.ts +66 -0
  81. package/Server/Services/ScheduledMaintenanceService.ts +124 -19
  82. package/Server/Services/ScheduledMaintenanceTemplateService.ts +82 -3
  83. package/Server/Services/ServiceLevelObjectiveLabelRuleEngineService.ts +385 -0
  84. package/Server/Services/ServiceLevelObjectiveLabelRuleService.ts +51 -0
  85. package/Server/Services/ServiceLevelObjectiveMonitorRuleEngineService.ts +92 -16
  86. package/Server/Services/ServiceLevelObjectiveMonitorRuleService.ts +36 -1
  87. package/Server/Services/ServiceLevelObjectiveOwnerRuleEngineService.ts +521 -0
  88. package/Server/Services/ServiceLevelObjectiveOwnerRuleService.ts +51 -0
  89. package/Server/Services/ServiceLevelObjectiveService.ts +42 -1
  90. package/Server/Services/StatusPagePrivateUserService.ts +1 -0
  91. package/Server/Services/StatusPageService.ts +301 -74
  92. package/Server/Services/StatusPageSubscriberService.ts +4 -0
  93. package/Server/Services/TeamMemberService.ts +309 -7
  94. package/Server/Services/TraceAggregationService.ts +10 -6
  95. package/Server/Services/UserEmailService.ts +1 -0
  96. package/Server/Services/UserNotificationMethodAdminService.ts +1 -0
  97. package/Server/Services/UserNotificationRuleAdminService.ts +1 -0
  98. package/Server/Services/UserNotificationRuleService.ts +4 -0
  99. package/Server/Services/UserService.ts +122 -1
  100. package/Server/Services/WorkflowVariableService.ts +593 -8
  101. package/Server/Services/WorkspaceNotificationRuleService.ts +588 -8
  102. package/Server/Services/WorkspaceProjectAuthTokenService.ts +170 -1
  103. package/Server/Types/Database/QueryHelper.ts +22 -0
  104. package/Server/Types/Markdown.ts +502 -27
  105. package/Server/Types/Workflow/Components/Telegram/SendMessageToChat.ts +27 -1
  106. package/Server/Utils/AI/ClusterAccess/ClusterAccessContext.ts +182 -0
  107. package/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.ts +525 -0
  108. package/Server/Utils/AI/ClusterAccess/KubectlJobRunner.ts +854 -0
  109. package/Server/Utils/AI/CodeFix/CodeFixAgentAuth.ts +22 -2
  110. package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +1916 -307
  111. package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +1601 -74
  112. package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +139 -7
  113. package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +58 -1
  114. package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +54 -1
  115. package/Server/Utils/AI/Toolbox/AIActionTools.ts +14 -6
  116. package/Server/Utils/AI/Toolbox/ResourceTools.ts +4 -2
  117. package/Server/Utils/AI/Toolbox/SloTools.ts +1 -0
  118. package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +1341 -150
  119. package/Server/Utils/AutoRemediation/RemediationVerifier.ts +375 -4
  120. package/Server/Utils/Database/AffectedResourceRelations.ts +127 -0
  121. package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +240 -1
  122. package/Server/Utils/EmailRollup/EmailRollupFlushRunner.ts +1 -0
  123. package/Server/Utils/Monitor/AffectedResourceList.ts +31 -73
  124. package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +1 -1
  125. package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +1 -1
  126. package/Server/Utils/Monitor/MonitorAlert.ts +83 -9
  127. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +181 -136
  128. package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +5 -1
  129. package/Server/Utils/Monitor/MonitorIncident.ts +104 -9
  130. package/Server/Utils/Monitor/MonitorPayloadRedaction.ts +124 -7
  131. package/Server/Utils/Monitor/ProbeMonitorsNotification.ts +407 -0
  132. package/Server/Utils/Monitor/RootCauseList.ts +139 -0
  133. package/Server/Utils/OnCall/OnCallShiftReminderRunner.ts +1 -0
  134. package/Server/Utils/PushNotificationUtil.ts +45 -0
  135. package/Server/Utils/Rules/OwnerRuleAssignment.ts +40 -3
  136. package/Server/Utils/Rules/RuleRun/RuleRunRegistry.ts +28 -0
  137. package/Server/Utils/Runbook/RunbookExecutePermission.ts +56 -6
  138. package/Server/Utils/SessionReplay/SessionReplayReadService.ts +223 -33
  139. package/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.ts +559 -0
  140. package/Server/Utils/Slo/SloRulePatternValidator.ts +42 -0
  141. package/Server/Utils/StartServer.ts +4 -3
  142. package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +528 -0
  143. package/Server/Utils/TwoFactorBackupCodeNotification.ts +1 -0
  144. package/Server/Utils/UserPermission/UserPermission.ts +16 -0
  145. package/Server/Utils/Workflow/OAuth2TokenClient.ts +704 -0
  146. package/Server/Utils/Workflow/WorkflowVariableOAuthToken.ts +318 -0
  147. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +47 -7
  148. package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +57 -16
  149. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +193 -214
  150. package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +57 -13
  151. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +54 -17
  152. package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +179 -161
  153. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +281 -167
  154. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsServiceUrl.ts +114 -0
  155. package/Server/Utils/Workspace/MicrosoftTeams/ReactionNoteSync.ts +895 -0
  156. package/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +7 -9
  157. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +96 -227
  158. package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +93 -214
  159. package/Server/Utils/Workspace/Slack/Actions/Auth.ts +30 -3
  160. package/Server/Utils/Workspace/Slack/Actions/Authorization.ts +99 -0
  161. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +117 -283
  162. package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +101 -196
  163. package/Server/Utils/Workspace/Slack/Actions/ReactionNote.ts +329 -0
  164. package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +111 -287
  165. package/Server/Utils/Workspace/Slack/Slack.ts +86 -17
  166. package/Server/Utils/Workspace/Slack/app-manifest.json +2 -0
  167. package/Server/Utils/Workspace/Workspace.ts +171 -54
  168. package/Server/Utils/Workspace/WorkspaceActionAuthorization.ts +252 -0
  169. package/Server/Utils/Workspace/WorkspaceBase.ts +39 -0
  170. package/Server/Utils/Workspace/WorkspaceOAuthState.ts +280 -0
  171. package/Server/Utils/Workspace/WorkspaceProjectReferenceValidator.ts +96 -0
  172. package/Server/Utils/Workspace/WorkspaceReactionNote.ts +620 -0
  173. package/Tests/App/Dashboard/AttributesJSONDashboardSurfaces.test.tsx +496 -0
  174. package/Tests/App/Dashboard/AutoRemediationRulesTableCommandRunners.test.tsx +152 -0
  175. package/Tests/App/Dashboard/BreadcrumbCoverage.test.tsx +32 -0
  176. package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +794 -0
  177. package/Tests/App/Dashboard/CreateOAuthWorkflowVariableModal.test.tsx +840 -0
  178. package/Tests/App/Dashboard/CreateWorkflowModal.test.tsx +653 -0
  179. package/Tests/App/Dashboard/DatabaseMonitorStepForm.test.tsx +197 -0
  180. package/Tests/App/Dashboard/DatabaseMonitorView.test.tsx +376 -0
  181. package/Tests/App/Dashboard/DisabledWarningRobustness.test.tsx +262 -0
  182. package/Tests/App/Dashboard/EventNotes.test.tsx +2080 -0
  183. package/Tests/App/Dashboard/EventNotesPages.test.tsx +486 -0
  184. package/Tests/App/Dashboard/EventNotesUtil.test.ts +933 -0
  185. package/Tests/App/Dashboard/ExceptionMonitorEnvironmentFilter.test.tsx +218 -0
  186. package/Tests/App/Dashboard/FeedFilterSortIntegration.test.tsx +1632 -0
  187. package/Tests/App/Dashboard/FeedOptionsLocales.test.ts +250 -0
  188. package/Tests/App/Dashboard/FeedOrdering.test.ts +279 -9
  189. package/Tests/App/Dashboard/IncidentChangeStateNotifyDefault.test.tsx +665 -0
  190. package/Tests/App/Dashboard/IncidentEpisodeFeedPublicNoteNotifyDefault.test.tsx +494 -0
  191. package/Tests/App/Dashboard/IncidentEpisodeOverviewNotifyDefault.test.tsx +706 -0
  192. package/Tests/App/Dashboard/IncidentFeedPublicNoteNotifyDefault.test.tsx +472 -0
  193. package/Tests/App/Dashboard/IncidentOverviewNotifyDefault.test.tsx +858 -0
  194. package/Tests/App/Dashboard/IncomingEmailAddressSettings.test.tsx +567 -0
  195. package/Tests/App/Dashboard/InvestigationClusterToolFormat.test.ts +241 -0
  196. package/Tests/App/Dashboard/InvestigationEvidenceKubectl.test.tsx +322 -0
  197. package/Tests/App/Dashboard/InvestigationFeedRefresh.test.tsx +60 -1
  198. package/Tests/App/Dashboard/InvestigationPanel.test.tsx +606 -3
  199. package/Tests/App/Dashboard/InvestigationPanelClusterAccess.test.tsx +476 -0
  200. package/Tests/App/Dashboard/InvestigationRunDetailsKubectl.test.tsx +383 -0
  201. package/Tests/App/Dashboard/KubectlActivitySummary.test.tsx +366 -0
  202. package/Tests/App/Dashboard/KubernetesClusterAiAccessSettings.test.ts +2886 -0
  203. package/Tests/App/Dashboard/KubernetesClusterAiPage.test.tsx +2688 -0
  204. package/Tests/App/Dashboard/KubernetesClusterAiPageServerParity.test.ts +915 -0
  205. package/Tests/App/Dashboard/LayerDateTimeFieldTimezoneName.test.tsx +66 -0
  206. package/Tests/App/Dashboard/LogMonitorPreview.test.tsx +174 -0
  207. package/Tests/App/Dashboard/MonitorFeedRefresh.test.tsx +279 -0
  208. package/Tests/App/Dashboard/MonitorMetricQueryConfig.test.ts +244 -0
  209. package/Tests/App/Dashboard/MonitorOpenWorkCard.test.tsx +381 -0
  210. package/Tests/App/Dashboard/MonitorOpenWorkHook.test.tsx +784 -0
  211. package/Tests/App/Dashboard/MonitorOverviewData.test.tsx +2199 -0
  212. package/Tests/App/Dashboard/MonitorOverviewHero.test.tsx +1169 -0
  213. package/Tests/App/Dashboard/MonitorOverviewInput.test.ts +1127 -0
  214. package/Tests/App/Dashboard/MonitorOverviewPage.test.tsx +2136 -0
  215. package/Tests/App/Dashboard/MonitorOverviewSelectReadable.test.ts +368 -0
  216. package/Tests/App/Dashboard/MonitorOverviewStatBar.test.tsx +526 -0
  217. package/Tests/App/Dashboard/MonitorOverviewSupportingCards.test.tsx +542 -0
  218. package/Tests/App/Dashboard/MonitorOwnersCombine.test.ts +299 -0
  219. package/Tests/App/Dashboard/MonitorProbesCard.test.tsx +602 -0
  220. package/Tests/App/Dashboard/MonitorResponseTimeCard.test.tsx +386 -0
  221. package/Tests/App/Dashboard/MonitorSetupAndConnectionCards.test.tsx +612 -0
  222. package/Tests/App/Dashboard/MonitorStatusChangesCard.test.tsx +257 -0
  223. package/Tests/App/Dashboard/MonitorSummaryTestMonitorButton.test.tsx +360 -1
  224. package/Tests/App/Dashboard/MonitorUptimeHistoryCard.test.tsx +835 -0
  225. package/Tests/App/Dashboard/MonitorUptimeSummaryHook.test.tsx +971 -0
  226. package/Tests/App/Dashboard/MonitorViewLayout.test.tsx +580 -0
  227. package/Tests/App/Dashboard/OnCallLayerRestrictionTimesPreserved.test.tsx +441 -0
  228. package/Tests/App/Dashboard/OnCallNavbar.test.tsx +214 -0
  229. package/Tests/App/Dashboard/OnCallSchedulePreviewCalendarDisplay.test.tsx +1389 -0
  230. package/Tests/App/Dashboard/OnCallSchedulePreviewOverrides.test.tsx +205 -1
  231. package/Tests/App/Dashboard/OnCallScheduleTimeInputsSettingsZone.test.tsx +198 -0
  232. package/Tests/App/Dashboard/ProductOrientation.test.tsx +646 -0
  233. package/Tests/App/Dashboard/PublicNotePagesNotifyDefault.test.tsx +524 -0
  234. package/Tests/App/Dashboard/RemediationSuggestionCardApproval.test.tsx +702 -0
  235. package/Tests/App/Dashboard/RemoveUserFromProject.test.tsx +427 -0
  236. package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +4 -0
  237. package/Tests/App/Dashboard/ResourceFeed.test.tsx +612 -2
  238. package/Tests/App/Dashboard/ResourceFeedPageWiring.test.ts +30 -0
  239. package/Tests/App/Dashboard/ResourceFeedPagesFilterSort.test.tsx +1202 -0
  240. package/Tests/App/Dashboard/RumSessionReplaySideMenu.test.tsx +3 -1
  241. package/Tests/App/Dashboard/RunbookStepTypeMaps.test.ts +166 -0
  242. package/Tests/App/Dashboard/RunnerKubernetesAgentForm.test.tsx +622 -0
  243. package/Tests/App/Dashboard/ScheduledMaintenanceChangeStateNotifyDefault.test.tsx +1491 -0
  244. package/Tests/App/Dashboard/ScheduledMaintenanceFeedPublicNoteNotifyDefault.test.tsx +489 -0
  245. package/Tests/App/Dashboard/ScheduledMaintenanceFeedRefresh.test.tsx +52 -1
  246. package/Tests/App/Dashboard/ScheduledMaintenanceOverviewNotifyDefault.test.tsx +909 -0
  247. package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +14 -0
  248. package/Tests/App/Dashboard/ScheduledMaintenanceWindowStatsTranslation.test.tsx +307 -0
  249. package/Tests/App/Dashboard/SecurityEventAttributeColumnPicker.test.tsx +542 -0
  250. package/Tests/App/Dashboard/SecurityEventConnectionFormModal.test.tsx +174 -0
  251. package/Tests/App/Dashboard/SecurityEventConnectionsEmptyState.test.tsx +973 -212
  252. package/Tests/App/Dashboard/SecurityEventConnectionsTable.test.tsx +491 -52
  253. package/Tests/App/Dashboard/SecurityEventDetailPanel.test.tsx +301 -0
  254. package/Tests/App/Dashboard/SecurityEventListRow.test.tsx +158 -1
  255. package/Tests/App/Dashboard/SecurityEventProviderTile.test.tsx +869 -0
  256. package/Tests/App/Dashboard/SecurityEventsEmptyState.test.tsx +959 -94
  257. package/Tests/App/Dashboard/SecurityEventsNoResults.test.tsx +2 -0
  258. package/Tests/App/Dashboard/SecurityEventsViewer.test.tsx +274 -1
  259. package/Tests/App/Dashboard/SloFeed.test.tsx +106 -1
  260. package/Tests/App/Dashboard/SloMonitorRuleCriteria.test.tsx +566 -0
  261. package/Tests/App/Dashboard/SloNavigationWiring.test.tsx +6 -4
  262. package/Tests/App/Dashboard/SloNoticeBanner.test.tsx +186 -0
  263. package/Tests/App/Dashboard/SloOverviewKpiStrip.test.tsx +388 -44
  264. package/Tests/App/Dashboard/SloOverviewLayout.test.tsx +613 -0
  265. package/Tests/App/Dashboard/TeamMembershipRemoval.test.ts +900 -0
  266. package/Tests/App/Dashboard/TeamMembershipRemovalPages.test.tsx +460 -0
  267. package/Tests/App/Dashboard/TimezoneElements.test.tsx +321 -0
  268. package/Tests/App/Dashboard/TimezoneSelectButton.test.tsx +634 -0
  269. package/Tests/App/Dashboard/TraceExplorer.test.tsx +260 -0
  270. package/Tests/App/Dashboard/TraceMonitorPreview.test.tsx +182 -0
  271. package/Tests/App/Dashboard/UserTimezoneInit.test.tsx +544 -0
  272. package/Tests/App/Dashboard/WorkflowVariableModals.test.tsx +1630 -0
  273. package/Tests/App/Dashboard/WorkflowVariableRoutes.test.tsx +603 -0
  274. package/Tests/App/Dashboard/WorkflowVariableTokenStatus.test.tsx +589 -0
  275. package/Tests/App/Dashboard/WorkflowVariableUtil.test.ts +1543 -0
  276. package/Tests/App/Dashboard/WorkflowVariableView.test.tsx +3227 -0
  277. package/Tests/App/Dashboard/WorkflowVariablesTable.test.tsx +1277 -395
  278. package/Tests/App/StatusPage/StatusPageOverviewMonitorGroupUptime.test.tsx +714 -0
  279. package/Tests/App/StatusPage/StatusPageOverviewUptimeBars.NewYork.test.tsx +1009 -0
  280. package/Tests/App/StatusPage/StatusPageOverviewUptimeBars.test.tsx +1092 -0
  281. package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +5 -0
  282. package/Tests/Models/DatabaseModels/KubernetesClusterAiAccessColumns.test.ts +520 -0
  283. package/Tests/Models/DatabaseModels/MonitorSecretKeyColumnAccessControl.test.ts +66 -2
  284. package/Tests/Models/DatabaseModels/ResourceFeedModels.test.ts +0 -8
  285. package/Tests/Models/DatabaseModels/SloLabelAndOwnerRuleModels.test.ts +404 -0
  286. package/Tests/Models/DatabaseModels/SloOverhaulModels.test.ts +17 -1
  287. package/Tests/Models/DatabaseModels/StaticRuleCriteriaInheritance.test.ts +4 -2
  288. package/Tests/Models/DatabaseModels/WorkspaceProjectAuthTokenAccessControl.test.ts +236 -0
  289. package/Tests/Models/IncidentEpisodePublicNoteNotifyColumnContract.test.ts +103 -0
  290. package/Tests/Models/IncidentPublicNoteNotifyColumnContract.test.ts +96 -0
  291. package/Tests/Models/ScheduledMaintenancePublicNoteNotifyColumnContract.test.ts +111 -0
  292. package/Tests/Server/API/AIInvestigationAPI.test.ts +976 -0
  293. package/Tests/Server/API/AutoRemediationApproveKubectlRecheck.test.ts +836 -0
  294. package/Tests/Server/API/CommonAPIAssertCanCreateTable.test.ts +565 -0
  295. package/Tests/Server/API/CommonAPIAssertCanReadTable.test.ts +282 -0
  296. package/Tests/Server/API/KubernetesClusterAiAccessAPI.test.ts +1744 -0
  297. package/Tests/Server/API/LogHistogramAPI.test.ts +371 -0
  298. package/Tests/Server/API/MicrosoftTeamsLegacyWebhookRemoval.test.ts +125 -30
  299. package/Tests/Server/API/MicrosoftTeamsOAuthState.test.ts +1121 -0
  300. package/Tests/Server/API/MonitorUptimeSummaryAPI.test.ts +685 -0
  301. package/Tests/Server/API/SessionReplayAPI.test.ts +602 -1
  302. package/Tests/Server/API/SlackChannelCacheAPI.test.ts +358 -0
  303. package/Tests/Server/API/SlackOAuthState.test.ts +688 -0
  304. package/Tests/Server/API/StatusPageOverviewMonitorGroupUptime.test.ts +527 -0
  305. package/Tests/Server/API/StatusPageTestEmailReportAuth.test.ts +2 -0
  306. package/Tests/Server/API/StatusPageUptimeAPI.test.ts +427 -0
  307. package/Tests/Server/API/UserProjectsAPI.test.ts +4 -0
  308. package/Tests/Server/API/WorkflowVariableAPI.test.ts +404 -0
  309. package/Tests/Server/API/WorkspaceOAuthTestHelpers.ts +289 -0
  310. package/Tests/Server/API/WorkspaceSendTestNotificationRoutes.test.ts +2064 -0
  311. package/Tests/Server/Infrastructure/GlobalCache.test.ts +86 -0
  312. package/Tests/Server/Infrastructure/Postgres/AddConfigurableRuleCriteriaMigration.test.ts +3 -0
  313. package/Tests/Server/Infrastructure/Postgres/AddKubernetesClusterAiAccessMigration.test.ts +589 -0
  314. package/Tests/Server/Infrastructure/Postgres/AddOAuth2WorkflowVariablesMigration.test.ts +254 -0
  315. package/Tests/Server/Infrastructure/Postgres/AddSloLabelAndOwnerRulesMigration.test.ts +407 -0
  316. package/Tests/Server/Infrastructure/Postgres/AddSloMonitorRuleMonitorTypeMigration.test.ts +171 -0
  317. package/Tests/Server/Infrastructure/Postgres/SloProductOverhaulMigration.test.ts +88 -4
  318. package/Tests/Server/Middleware/BlockedUserMiddleware.test.ts +403 -0
  319. package/Tests/Server/Middleware/MasterAdminAuthorization.test.ts +13 -0
  320. package/Tests/Server/Middleware/PublicRouteUserMiddleware.test.ts +2 -0
  321. package/Tests/Server/Middleware/RemovedProjectMemberAuthorization.test.ts +469 -0
  322. package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +77 -1
  323. package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +211 -0
  324. package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +358 -0
  325. package/Tests/Server/Middleware/UserAuthorization.test.ts +97 -0
  326. package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +2 -0
  327. package/Tests/Server/Services/AccessTokenProjectUserGrant.test.ts +14 -2
  328. package/Tests/Server/Services/AccessTokenRemovedMemberAccess.test.ts +1044 -0
  329. package/Tests/Server/Services/AddOwnersIdempotency.test.ts +5 -0
  330. package/Tests/Server/Services/AlertEpisodeMemberCreatePermission.test.ts +139 -0
  331. package/Tests/Server/Services/AutoRemediationClusterRuleEngine.test.ts +1361 -0
  332. package/Tests/Server/Services/AutoRemediationRuleCommandRunners.test.ts +375 -0
  333. package/Tests/Server/Services/CrossProjectRelationWriteGuard.test.ts +2384 -0
  334. package/Tests/Server/Services/DatabaseServiceRuleCriteriaValidation.test.ts +104 -0
  335. package/Tests/Server/Services/FindOwnersProjectMembership.test.ts +267 -0
  336. package/Tests/Server/Services/InboundEmail/SendGridInboundProviderAddress.test.ts +90 -0
  337. package/Tests/Server/Services/IncidentEpisodeMemberCreatePermission.test.ts +143 -0
  338. package/Tests/Server/Services/IncidentEpisodePublicNoteNotifyDefault.test.ts +805 -0
  339. package/Tests/Server/Services/IncidentPublicNoteNotifyDefault.test.ts +724 -0
  340. package/Tests/Server/Services/IncidentRoleProjectMembership.test.ts +233 -0
  341. package/Tests/Server/Services/KubernetesClusterAiAccessAgentRunnerAssignments.test.ts +372 -0
  342. package/Tests/Server/Services/KubernetesClusterAiAccessBindingGuard.test.ts +1876 -0
  343. package/Tests/Server/Services/KubernetesClusterAiAccessDeletedRunnerRemedy.test.ts +620 -0
  344. package/Tests/Server/Services/KubernetesClusterAiAccessGapNextSteps.test.ts +421 -0
  345. package/Tests/Server/Services/KubernetesClusterAiAccessService.test.ts +3662 -0
  346. package/Tests/Server/Services/KubernetesClusterAiAccessSubjectClusters.test.ts +405 -0
  347. package/Tests/Server/Services/KubernetesClusterAiSettingsPermission.test.ts +975 -0
  348. package/Tests/Server/Services/KubernetesClusterServiceAiAccessFeed.test.ts +497 -0
  349. package/Tests/Server/Services/KubernetesClusterServiceDeleteSettlesRemediation.test.ts +328 -0
  350. package/Tests/Server/Services/LogAggregationService.test.ts +99 -0
  351. package/Tests/Server/Services/MonitorServiceIncomingEmailCustomAddress.test.ts +447 -0
  352. package/Tests/Server/Services/MonitorServiceProbeFlagSync.test.ts +1334 -0
  353. package/Tests/Server/Services/MonitorServiceProbeStatusGrouping.test.ts +1640 -0
  354. package/Tests/Server/Services/MonitorServiceRefreshCurrentStatus.test.ts +225 -0
  355. package/Tests/Server/Services/MonitorStatusBridgeProbePath.test.ts +8 -8
  356. package/Tests/Server/Services/MonitorStatusTimelineDailyAggregates.test.ts +264 -1
  357. package/Tests/Server/Services/MonitorStatusTimelineMergedDowntime.test.ts +284 -0
  358. package/Tests/Server/Services/MonitorUptimeSummaryService.test.ts +1043 -0
  359. package/Tests/Server/Services/NetworkDeviceRuleEngines.test.ts +5 -0
  360. package/Tests/Server/Services/OnCallUndeliverablePageOwnerMembership.test.ts +359 -0
  361. package/Tests/Server/Services/ProbeServiceDashboardLink.test.ts +191 -0
  362. package/Tests/Server/Services/ProjectOwnersProjectMembership.test.ts +221 -0
  363. package/Tests/Server/Services/RuleRun/IncidentAlertMaintenanceRuleEnginesRun.test.ts +5 -0
  364. package/Tests/Server/Services/RuleRun/LabelRuleEnginesGroupBRun.test.ts +48 -1
  365. package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupARun.test.ts +28 -0
  366. package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupBRun.test.ts +39 -1
  367. package/Tests/Server/Services/RunnerJobEnqueueAiCommandAgentRunner.test.ts +230 -0
  368. package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +978 -0
  369. package/Tests/Server/Services/RunnerJobKubectlWriteScope.test.ts +866 -0
  370. package/Tests/Server/Services/RunnerJobSubmitResultRedaction.test.ts +322 -0
  371. package/Tests/Server/Services/RunnerJobSubmitResultUnstorableText.test.ts +357 -0
  372. package/Tests/Server/Services/RunnerJobTimeoutReason.test.ts +227 -0
  373. package/Tests/Server/Services/RunnerServiceAgentName.test.ts +581 -0
  374. package/Tests/Server/Services/ScheduledMaintenancePublicNoteNotifyDefault.test.ts +802 -0
  375. package/Tests/Server/Services/ScheduledMaintenanceSubscriberTemplateFormats.test.ts +53 -0
  376. package/Tests/Server/Services/ServiceLevelObjectiveLabelAndOwnerRuleEngines.test.ts +1175 -0
  377. package/Tests/Server/Services/ServiceLevelObjectiveLabelAndOwnerRuleServices.test.ts +172 -0
  378. package/Tests/Server/Services/ServiceLevelObjectiveMonitorRuleEngineService.test.ts +323 -0
  379. package/Tests/Server/Services/ServiceLevelObjectiveMonitorRuleService.test.ts +115 -0
  380. package/Tests/Server/Services/ServiceLevelObjectiveMonitorRuleTriggers.test.ts +21 -2
  381. package/Tests/Server/Services/ServiceLevelObjectiveMonitorTypePostgres.test.ts +480 -0
  382. package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +174 -0
  383. package/Tests/Server/Services/StaticRuleCriteriaRuntimeCoverage.test.ts +45 -6
  384. package/Tests/Server/Services/StatusPageSubscriberReport.test.ts +1176 -1
  385. package/Tests/Server/Services/TeamMemberBillingSeatSync.test.ts +9 -0
  386. package/Tests/Server/Services/TeamMemberOnCallCleanup.test.ts +18 -0
  387. package/Tests/Server/Services/TeamMemberProjectMembership.test.ts +255 -0
  388. package/Tests/Server/Services/TeamMemberRemovalRevokesProjectAccess.test.ts +600 -0
  389. package/Tests/Server/Services/TeamMemberResourceCleanup.test.ts +731 -0
  390. package/Tests/Server/Services/TeamMemberWorkspaceAccountCleanup.test.ts +164 -0
  391. package/Tests/Server/Services/TraceAggregationService.test.ts +64 -0
  392. package/Tests/Server/Services/UserServiceBlockedUser.test.ts +293 -0
  393. package/Tests/Server/Services/WorkflowVariableOAuthHooks.test.ts +1016 -0
  394. package/Tests/Server/Services/WorkflowVariableOAuthPostgres.test.ts +543 -0
  395. package/Tests/Server/Services/WorkflowVariableRenameUniqueness.test.ts +16 -5
  396. package/Tests/Server/Services/WorkspaceNotificationRuleNoteDelivery.test.ts +473 -0
  397. package/Tests/Server/Services/WorkspaceNotificationRuleSendTestNotification.test.ts +3690 -0
  398. package/Tests/Server/Services/WorkspaceProjectAuthTokenMiscDataSecrets.test.ts +374 -0
  399. package/Tests/Server/Services/WorkspaceProjectAuthTokenSlackChannelCache.test.ts +143 -0
  400. package/Tests/Server/Types/Database/FeedEventTypeFilterQuery.test.ts +745 -0
  401. package/Tests/Server/Types/Database/Permissions/WorkflowVariableOAuthColumnPermission.test.ts +250 -0
  402. package/Tests/Server/Types/Database/QueryHelperJsonContains.test.ts +96 -0
  403. package/Tests/Server/Types/Markdown.test.ts +1035 -1
  404. package/Tests/Server/Types/Workflow/Components/ApiComponentSsrf.test.ts +49 -0
  405. package/Tests/Server/Types/Workflow/Components/TelegramSendMessageToChat.test.ts +331 -0
  406. package/Tests/Server/Utils/AI/ClusterAccessContext.test.ts +285 -0
  407. package/Tests/Server/Utils/AI/CodeFix/CodeFixAgentAuth.test.ts +159 -1
  408. package/Tests/Server/Utils/AI/InvestigationClusterAccessWiring.test.ts +752 -0
  409. package/Tests/Server/Utils/AI/KubectlInvestigationToolkit.test.ts +1840 -0
  410. package/Tests/Server/Utils/AI/KubectlJobRunner.test.ts +1067 -0
  411. package/Tests/Server/Utils/AI/KubectlJobRunnerFinishedJob.test.ts +355 -0
  412. package/Tests/Server/Utils/AI/PostIncidentStatusUpdateTool.test.ts +496 -0
  413. package/Tests/Server/Utils/AI/RemediationCommandTools.test.ts +305 -0
  414. package/Tests/Server/Utils/AI/RemediationCommandToolsKubectl.test.ts +1365 -0
  415. package/Tests/Server/Utils/AI/RemediationCommandToolsKubectlOutcome.test.ts +639 -0
  416. package/Tests/Server/Utils/AI/RemediationCommandToolsLiveCluster.test.ts +1585 -0
  417. package/Tests/Server/Utils/AI/RemediationCommandToolsRunnerScope.test.ts +1065 -0
  418. package/Tests/Server/Utils/AI/RemediationExecutionRunner.test.ts +2138 -1
  419. package/Tests/Server/Utils/AI/RemediationExecutionRunnerClusterMode.test.ts +1035 -0
  420. package/Tests/Server/Utils/AI/RemediationKubectlCopyParity.test.ts +517 -0
  421. package/Tests/Server/Utils/AI/ResourceTools.test.ts +27 -1
  422. package/Tests/Server/Utils/AI/SloTools.test.ts +10 -0
  423. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutor.test.ts +1371 -24
  424. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorRollbackRace.test.ts +962 -0
  425. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorUnknownRun.test.ts +518 -0
  426. package/Tests/Server/Utils/AutoRemediation/CommandPlanVerification.test.ts +939 -2
  427. package/Tests/Server/Utils/Database/ProjectScopedRelationReferences.test.ts +371 -0
  428. package/Tests/Server/Utils/Monitor/AffectedResourceList.test.ts +64 -0
  429. package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaAnomalyUnits.test.ts +1 -1
  430. package/Tests/Server/Utils/Monitor/DatabaseMetricObservationRemediation.test.ts +102 -0
  431. package/Tests/Server/Utils/Monitor/MonitorAlertCriteriaReferences.test.ts +362 -0
  432. package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +405 -0
  433. package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorBreachingSamples.test.ts +1156 -0
  434. package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorMetricUnits.test.ts +106 -80
  435. package/Tests/Server/Utils/Monitor/MonitorEmailAddressRedaction.test.ts +255 -0
  436. package/Tests/Server/Utils/Monitor/MonitorIncidentCriteriaReferences.test.ts +347 -0
  437. package/Tests/Server/Utils/Monitor/MonitorIncidentMemberRoleMembership.test.ts +203 -0
  438. package/Tests/Server/Utils/Monitor/ProbeMonitorsNotification.test.ts +1147 -0
  439. package/Tests/Server/Utils/Monitor/RootCauseList.test.ts +252 -0
  440. package/Tests/Server/Utils/PushNotificationUtilCreators.test.ts +79 -0
  441. package/Tests/Server/Utils/ResourceFeed/ResourceFeedUtil.test.ts +21 -1
  442. package/Tests/Server/Utils/Rules/OwnerRuleAssignment.test.ts +155 -1
  443. package/Tests/Server/Utils/Rules/RuleRun/RuleRunPermission.test.ts +154 -0
  444. package/Tests/Server/Utils/SSRFProtection.test.ts +111 -0
  445. package/Tests/Server/Utils/SessionReplay/SessionReplayReadServiceQueries.test.ts +288 -0
  446. package/Tests/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.test.ts +304 -0
  447. package/Tests/Server/Utils/Slo/SloRulePatternValidator.test.ts +67 -0
  448. package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +40 -3
  449. package/Tests/Server/Utils/VM/VMRunnerSsrf.test.ts +213 -0
  450. package/Tests/Server/Utils/Workflow/OAuth2TokenClient.test.ts +702 -0
  451. package/Tests/Server/Utils/Workflow/OAuth2TokenClientHttpIntegration.test.ts +507 -0
  452. package/Tests/Server/Utils/Workflow/WorkflowVariableOAuthToken.test.ts +831 -0
  453. package/Tests/Server/Utils/Workspace/MicrosoftTeamsActionAuthorization.test.ts +63 -1
  454. package/Tests/Server/Utils/Workspace/MicrosoftTeamsAppAccessToken.test.ts +256 -0
  455. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelSend.test.ts +60 -0
  456. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChatActionAuthorization.test.ts +442 -0
  457. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChats.test.ts +44 -2
  458. package/Tests/Server/Utils/Workspace/MicrosoftTeamsDirectMessage.test.ts +55 -0
  459. package/Tests/Server/Utils/Workspace/MicrosoftTeamsReactionNoteSync.test.ts +1522 -0
  460. package/Tests/Server/Utils/Workspace/MicrosoftTeamsServiceUrl.test.ts +130 -0
  461. package/Tests/Server/Utils/Workspace/MicrosoftTeamsTeamInstalls.test.ts +4 -4
  462. package/Tests/Server/Utils/Workspace/Slack/SlackActionAuthorization.test.ts +691 -0
  463. package/Tests/Server/Utils/Workspace/Slack/SlackMessageByTimestamp.test.ts +253 -0
  464. package/Tests/Server/Utils/Workspace/Slack/SlackReactionNote.test.ts +574 -0
  465. package/Tests/Server/Utils/Workspace/WorkspaceActionAuthorization.test.ts +488 -0
  466. package/Tests/Server/Utils/Workspace/WorkspaceCreateProjectReferences.test.ts +861 -0
  467. package/Tests/Server/Utils/Workspace/WorkspaceMessageAuthor.test.ts +635 -0
  468. package/Tests/Server/Utils/Workspace/WorkspaceOAuthState.test.ts +548 -0
  469. package/Tests/Server/Utils/Workspace/WorkspaceReactionNote.test.ts +839 -0
  470. package/Tests/Server/Utils/Workspace/WorkspaceSendErrorMessage.test.ts +725 -0
  471. package/Tests/Types/API/Route.test.ts +56 -0
  472. package/Tests/Types/API/URLSchemeLikePath.test.ts +304 -0
  473. package/Tests/Types/AutoRemediation/AiRemediationCommandPlan.test.ts +283 -9
  474. package/Tests/Types/DateBrowserLocalWallClock.test.ts +280 -0
  475. package/Tests/Types/DateLocalShortMonthNameFallback.test.ts +389 -0
  476. package/Tests/Types/DateUserTimezone.test.ts +177 -4
  477. package/Tests/Types/Kubernetes/KubernetesAgentChartAiAccess.test.ts +306 -0
  478. package/Tests/Types/Kubernetes/KubernetesClusterAiAccess.test.ts +283 -0
  479. package/Tests/Types/Kubernetes/KubernetesRunnerPostureWriteScope.test.ts +68 -0
  480. package/Tests/Types/Monitor/DatabaseMonitor/SqlServerPlatform.test.ts +144 -0
  481. package/Tests/Types/Monitor/MonitorStepExceptionMonitor.test.ts +160 -0
  482. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +53 -0
  483. package/Tests/Types/Runbook/RunbookStepType.test.ts +91 -16
  484. package/Tests/Types/Runner/RunnerLiveStatus.test.ts +14 -3
  485. package/Tests/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.test.ts +15 -0
  486. package/Tests/Types/StatusPage/PublicNoteSubscriberNotificationDefault.test.ts +1868 -0
  487. package/Tests/Types/Timezone.test.ts +5 -0
  488. package/Tests/Types/TimezoneAlias.test.ts +1034 -0
  489. package/Tests/Types/Workflow/JiraTemplateFixtures.ts +833 -0
  490. package/Tests/Types/Workflow/JiraTemplateScripts.test.ts +5414 -0
  491. package/Tests/Types/Workflow/JiraTemplateSimulation.test.ts +4803 -0
  492. package/Tests/Types/Workflow/JiraTemplates.test.ts +5429 -0
  493. package/Tests/Types/Workflow/Templates.test.ts +79 -4
  494. package/Tests/Types/Workflow/WorkflowVariableOAuth.test.ts +520 -0
  495. package/Tests/Types/Workspace/WorkspaceNoteReaction.test.ts +177 -0
  496. package/Tests/UI/Components/AttributesJSON/AttributesJSONView.test.tsx +390 -0
  497. package/Tests/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.test.tsx +566 -0
  498. package/Tests/UI/Components/AttributesJSON/JSONHighlight.test.ts +131 -0
  499. package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +276 -1
  500. package/Tests/UI/Components/Calendar/Calendar.test.tsx +1611 -0
  501. package/Tests/UI/Components/Calendar/CalendarDayLayout.test.ts +1486 -0
  502. package/Tests/UI/Components/Calendar/CalendarDayLayoutDst.test.ts +632 -0
  503. package/Tests/UI/Components/Calendar/CalendarDst.test.tsx +388 -0
  504. package/Tests/UI/Components/Charts/ChartGroupPlotFloor.test.tsx +170 -0
  505. package/Tests/UI/Components/Charts/HistogramSelection.test.ts +282 -0
  506. package/Tests/UI/Components/CustomTimeRangeModal.test.tsx +6 -0
  507. package/Tests/UI/Components/CustomTimeRangeModalTimezoneTranslation.test.tsx +285 -0
  508. package/Tests/UI/Components/Dropdown.test.tsx +999 -2
  509. package/Tests/UI/Components/FeedOptions.test.ts +1404 -0
  510. package/Tests/UI/Components/FeedOptionsButton.test.tsx +2603 -0
  511. package/Tests/UI/Components/Forms/FormFieldCheckboxTranslation.test.tsx +216 -0
  512. package/Tests/UI/Components/Forms/FormFieldTimezoneDescriptionTranslation.test.tsx +461 -0
  513. package/Tests/UI/Components/Forms/IncidentEpisodePublicNoteNotifyPayload.test.tsx +641 -0
  514. package/Tests/UI/Components/Forms/IncidentPublicNoteNotifyPayload.test.tsx +346 -0
  515. package/Tests/UI/Components/Forms/ScheduledMaintenancePublicNoteNotifyPayload.test.tsx +493 -0
  516. package/Tests/UI/Components/Graphs/DayUptimeGraph.test.tsx +911 -2
  517. package/Tests/UI/Components/Graphs/DayUptimeGraphTimezone.NewYork.test.tsx +730 -0
  518. package/Tests/UI/Components/Graphs/DayUptimeGraphTimezone.Tokyo.test.tsx +506 -0
  519. package/Tests/UI/Components/HistogramClickToZoom.test.tsx +619 -0
  520. package/Tests/UI/Components/Icon.test.tsx +26 -0
  521. package/Tests/UI/Components/LogDetailsPanelAttributesJSON.test.tsx +248 -0
  522. package/Tests/UI/Components/LogsViewerHistogramZoom.test.tsx +47 -1
  523. package/Tests/UI/Components/LogsViewerSmallScreens.test.tsx +620 -0
  524. package/Tests/UI/Components/ModelPageModelChange.test.tsx +242 -3
  525. package/Tests/UI/Components/ModelTable/BaseModelTableDeleteConfirmation.test.tsx +521 -0
  526. package/Tests/UI/Components/MonitorGraphs/Uptime.test.tsx +406 -2
  527. package/Tests/UI/Components/MonitorGraphs/UptimeBarDayModal.test.tsx +169 -2
  528. package/Tests/UI/Components/RuleCriteria/RuleCriteriaModelTable.test.tsx +3 -3
  529. package/Tests/UI/Components/TelemetryViewer/TelemetryViewerHistogramClickZoom.test.tsx +266 -0
  530. package/Tests/UI/Components/TelemetryViewer/TelemetryViewerSmallScreens.test.tsx +439 -0
  531. package/Tests/UI/Components/TimezoneDropdownLegacyValues.test.tsx +704 -0
  532. package/Tests/UI/Components/UseHistogramZoom.test.tsx +89 -1
  533. package/Tests/UI/Components/UseLogsHistogram.test.tsx +175 -0
  534. package/Tests/UI/Components/useFeedItemsViewKey.test.tsx +1017 -0
  535. package/Tests/UI/Components/useFeedOptions.test.tsx +1107 -0
  536. package/Tests/UI/Monitor/MonitorSummarySnapshotRender.test.tsx +5 -5
  537. package/Tests/UI/Telemetry/TelemetryDetailPanel.test.tsx +28 -0
  538. package/Tests/UI/Utils/ProjectUsersModelAPI.test.ts +51 -0
  539. package/Tests/UI/Utils/Timezone.test.ts +747 -33
  540. package/Tests/UI/Workspace/SendTestNotificationButton.test.tsx +1854 -0
  541. package/Tests/UI/Workspace/WorkspaceCardsSendTestNotification.test.tsx +1864 -0
  542. package/Tests/Utils/AI/InvestigationReport.test.ts +435 -7
  543. package/Tests/Utils/AiRemediation/KubectlAllowlistValidatorParity.test.ts +1084 -0
  544. package/Tests/Utils/AiRemediation/KubectlOutputRedactor.test.ts +2531 -0
  545. package/Tests/Utils/AiRemediation/KubectlPolicy.test.ts +1895 -0
  546. package/Tests/Utils/AiRemediation/KubectlPolicyAllowlist.test.ts +428 -0
  547. package/Tests/Utils/AiRemediation/KubectlPolicyChartRbacParity.test.ts +828 -0
  548. package/Tests/Utils/AiRemediation/KubectlPolicyCustomResourceScope.test.ts +573 -0
  549. package/Tests/Utils/AiRemediation/KubectlPolicyDenials.test.ts +1525 -0
  550. package/Tests/Utils/AiRemediation/KubectlPolicyExposeOverrides.test.ts +275 -0
  551. package/Tests/Utils/AiRemediation/KubectlPolicyNodePatch.test.ts +428 -0
  552. package/Tests/Utils/AiRemediation/KubectlPolicyObjectWords.test.ts +195 -0
  553. package/Tests/Utils/AiRemediation/KubectlPolicyPatchParents.test.ts +637 -0
  554. package/Tests/Utils/AiRemediation/KubectlPolicyPodSecurityBaseline.test.ts +322 -0
  555. package/Tests/Utils/AiRemediation/KubectlPolicySafeWriteScope.test.ts +1026 -0
  556. package/Tests/Utils/AiRemediation/KubectlWaitBudget.test.ts +267 -0
  557. package/Tests/Utils/AiRemediation/KubectlWriteScope.test.ts +390 -0
  558. package/Tests/Utils/AiRemediation/KubectlWriteScopeCallerParity.test.ts +777 -0
  559. package/Tests/Utils/AiRemediation/KubectlWriteScopeClusterScoped.test.ts +613 -0
  560. package/Tests/Utils/AiRemediation/KubectlWriteScopeEntryPoint.test.ts +576 -0
  561. package/Tests/Utils/AiRemediation/KubectlWriteScopeKubectlSpellings.test.ts +752 -0
  562. package/Tests/Utils/AiRemediation/KubectlWriteScopeObjectWords.test.ts +358 -0
  563. package/Tests/Utils/AiRemediation/KubectlWriteScopeOverrides.test.ts +293 -0
  564. package/Tests/Utils/AiRemediation/KubectlWriteScopeParityCases.ts +598 -0
  565. package/Tests/Utils/AiRemediation/KubectlWriteScopePolicyParity.test.ts +403 -0
  566. package/Tests/Utils/Dashboard/DashboardClockComponent.test.ts +154 -5
  567. package/Tests/Utils/LabelRuleImportExport.test.ts +102 -0
  568. package/Tests/Utils/Monitor/IncomingEmailMonitorAddress.test.ts +478 -0
  569. package/Tests/Utils/Monitor/MonitorCheckScheduleUtil.test.ts +646 -0
  570. package/Tests/Utils/Monitor/MonitorOverviewCriteriaUtil.test.ts +292 -0
  571. package/Tests/Utils/Monitor/MonitorOverviewFamily.test.ts +274 -0
  572. package/Tests/Utils/Monitor/MonitorOverviewPresentationUtil.test.ts +3100 -0
  573. package/Tests/Utils/Monitor/MonitorOverviewProbeUtil.test.ts +1412 -0
  574. package/Tests/Utils/Monitor/MonitorOverviewTargetUtil.test.ts +374 -0
  575. package/Tests/Utils/Monitor/MonitorStatusHistoryUtil.test.ts +332 -0
  576. package/Tests/Utils/Monitor/MonitorUptimeSummaryUtil.test.ts +946 -0
  577. package/Tests/Utils/Rum/SessionIdentity.test.ts +94 -0
  578. package/Tests/Utils/Rum/SessionReplayWafCompatibility.test.ts +840 -0
  579. package/Tests/Utils/Rum/SessionReplayWireEncoding.test.ts +208 -0
  580. package/Tests/Utils/Rum/UserFlow.test.ts +1010 -0
  581. package/Tests/Utils/Slo/SloDuration.test.ts +115 -24
  582. package/Tests/Utils/Slo/SloHealth.test.ts +93 -10
  583. package/Tests/Utils/Slo/SloMonitorRuleCriteria.test.ts +109 -0
  584. package/Tests/Utils/Slo/SloOverviewText.test.ts +64 -0
  585. package/Tests/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.test.ts +217 -0
  586. package/Tests/Utils/StatusPage/ResourceUptime.test.ts +1272 -1
  587. package/Tests/Utils/StatusPage/UptimeDailyAggregateTotals.test.ts +298 -0
  588. package/Tests/Utils/StatusPage/UptimeDailyAggregateUtil.test.ts +649 -1
  589. package/Tests/Utils/StatusPage/UptimeDailyAggregateWindow.test.ts +314 -0
  590. package/Tests/Utils/Telemetry/AttributesJSON.test.ts +454 -0
  591. package/Tests/Utils/Uptime/DayUptimeGraphUtil.test.ts +418 -2
  592. package/Tests/Utils/Uptime/DayUptimeGraphUtilMidnightDst.test.ts +160 -0
  593. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.Auckland.test.ts +45 -0
  594. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.Kolkata.test.ts +40 -0
  595. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.London.test.ts +147 -0
  596. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.NewYork.test.ts +48 -0
  597. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.Tokyo.test.ts +39 -0
  598. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezoneCases.ts +1015 -0
  599. package/Tests/Utils/Uptime/UptimeUtil.test.ts +75 -0
  600. package/Tests/Utils/Uptime/UptimeUtilChronologicalOrder.test.ts +1279 -0
  601. package/Types/API/Route.ts +19 -2
  602. package/Types/API/URL.ts +26 -2
  603. package/Types/AutoRemediation/AiRemediationCommandPlan.ts +203 -5
  604. package/Types/Date.ts +121 -7
  605. package/Types/Email/EmailMessage.ts +8 -0
  606. package/Types/Email/EmailTemplateType.ts +1 -0
  607. package/Types/Exception/ExceptionMessages.ts +1 -0
  608. package/Types/Kubernetes/KubernetesClusterAiAccess.ts +488 -0
  609. package/Types/Kubernetes/KubernetesClusterAiAccessPermissions.ts +54 -0
  610. package/Types/Kubernetes/KubernetesClusterAiAccessToolNames.ts +17 -0
  611. package/Types/Monitor/DatabaseMonitor/DatabaseMonitorResponse.ts +9 -0
  612. package/Types/Monitor/DatabaseMonitor/SqlServerPlatform.ts +117 -0
  613. package/Types/Monitor/KubernetesAlertTemplates.ts +6 -5
  614. package/Types/Monitor/MetricMonitor/MetricCriteriaContext.ts +6 -5
  615. package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +9 -0
  616. package/Types/Monitor/MonitorStepExceptionMonitor.ts +56 -0
  617. package/Types/Monitor/MonitorUptimeSummary.ts +113 -0
  618. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +11 -0
  619. package/Types/Permission.ts +90 -0
  620. package/Types/Rules/RuleCriteriaFieldRegistry.ts +11 -0
  621. package/Types/Rules/RuleRun.ts +4 -0
  622. package/Types/Rum/SessionReplay.ts +55 -2
  623. package/Types/Rum/SessionReplayApi.ts +44 -1
  624. package/Types/Rum/UserFlow.ts +187 -0
  625. package/Types/Runbook/RunbookStepType.ts +10 -0
  626. package/Types/Runbook/RunnerJobOrigin.ts +15 -0
  627. package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.ts +6 -2
  628. package/Types/StatusPage/MergedDowntimeTotals.ts +17 -0
  629. package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.ts +148 -0
  630. package/Types/StatusPage/UptimeDailyAggregate.ts +15 -0
  631. package/Types/Telemetry/TelemetryIngestSurface.ts +9 -0
  632. package/Types/Timezone.ts +5 -0
  633. package/Types/TimezoneAlias.ts +385 -0
  634. package/Types/Workflow/Templates.ts +3041 -2
  635. package/Types/Workflow/WorkflowVariableOAuth.ts +476 -0
  636. package/Types/Workspace/WorkspaceNoteReaction.ts +132 -0
  637. package/Typings/Index.d.ts +24 -0
  638. package/UI/Components/AttributesJSON/AttributesJSONPreferences.ts +175 -0
  639. package/UI/Components/AttributesJSON/AttributesJSONView.tsx +138 -0
  640. package/UI/Components/AttributesJSON/AttributesViewToggle.tsx +79 -0
  641. package/UI/Components/AttributesJSON/BracesGlyph.tsx +30 -0
  642. package/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.tsx +491 -0
  643. package/UI/Components/AttributesJSON/JSONHighlight.ts +77 -0
  644. package/UI/Components/Calendar/Calendar.css +83 -0
  645. package/UI/Components/Calendar/Calendar.tsx +136 -7
  646. package/UI/Components/Calendar/CalendarDayLayout.ts +236 -0
  647. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +23 -1
  648. package/UI/Components/Charts/Utils/HistogramSelection.ts +117 -0
  649. package/UI/Components/Charts/Utils/useHistogramRangeSelection.ts +269 -0
  650. package/UI/Components/Charts/Utils/useHistogramZoom.ts +26 -2
  651. package/UI/Components/Date/CustomTimeRangeModal.tsx +26 -3
  652. package/UI/Components/Dropdown/Dropdown.tsx +58 -9
  653. package/UI/Components/Feed/FeedOptions.ts +427 -0
  654. package/UI/Components/Feed/FeedOptionsButton.tsx +692 -0
  655. package/UI/Components/Feed/useFeedItems.ts +28 -9
  656. package/UI/Components/Feed/useFeedOptions.ts +225 -0
  657. package/UI/Components/Forms/Fields/FormField.tsx +49 -14
  658. package/UI/Components/Graphs/DayUptimeGraph.tsx +166 -25
  659. package/UI/Components/Graphs/UptimeBarTooltip.tsx +10 -2
  660. package/UI/Components/Graphs/UptimeDaySummary.tsx +8 -0
  661. package/UI/Components/Icon/Icon.tsx +1 -1
  662. package/UI/Components/LogsViewer/LogsViewer.tsx +52 -5
  663. package/UI/Components/LogsViewer/components/ColumnSelector.tsx +13 -2
  664. package/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.tsx +13 -1
  665. package/UI/Components/LogsViewer/components/LogDetailsPanel.tsx +91 -76
  666. package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +15 -1
  667. package/UI/Components/LogsViewer/components/LogsHistogram.tsx +28 -106
  668. package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +54 -6
  669. package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +8 -2
  670. package/UI/Components/LogsViewer/useLogsHistogram.ts +39 -6
  671. package/UI/Components/ModelTable/BaseModelTable.tsx +66 -14
  672. package/UI/Components/MonitorGraphs/Uptime.tsx +12 -0
  673. package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +10 -2
  674. package/UI/Components/Page/ModelPage.tsx +59 -3
  675. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +69 -5
  676. package/UI/Components/TelemetryViewer/components/TelemetryDetailPanel.tsx +12 -1
  677. package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +15 -1
  678. package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +36 -104
  679. package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +9 -1
  680. package/UI/Utils/ModelAPI/ProjectUsersModelAPI.ts +19 -1
  681. package/UI/Utils/Timezone.ts +69 -28
  682. package/Utils/AI/InvestigationReport.ts +195 -25
  683. package/Utils/AiRemediation/KubectlOutputRedactor.ts +1724 -0
  684. package/Utils/AiRemediation/KubectlPolicy.ts +4136 -0
  685. package/Utils/AiRemediation/KubectlWaitBudget.ts +156 -0
  686. package/Utils/AiRemediation/KubectlWriteScope.ts +1964 -0
  687. package/Utils/Dashboard/Components/DashboardClockComponent.ts +7 -6
  688. package/Utils/LabelRuleImportExport.ts +27 -9
  689. package/Utils/Monitor/IncomingEmailMonitorAddress.ts +292 -0
  690. package/Utils/Monitor/MetricValueFormatter.ts +2 -2
  691. package/Utils/Monitor/MonitorCheckScheduleUtil.ts +654 -0
  692. package/Utils/Monitor/MonitorOverviewCriteriaUtil.ts +188 -0
  693. package/Utils/Monitor/MonitorOverviewFamily.ts +263 -0
  694. package/Utils/Monitor/MonitorOverviewPresentationUtil.ts +1958 -0
  695. package/Utils/Monitor/MonitorOverviewProbeUtil.ts +979 -0
  696. package/Utils/Monitor/MonitorOverviewTargetUtil.ts +299 -0
  697. package/Utils/Monitor/MonitorStatusHistoryUtil.ts +201 -0
  698. package/Utils/Monitor/MonitorUptimeSummaryUtil.ts +638 -0
  699. package/Utils/Rules/MonitorTypeRuleCriteria.ts +31 -0
  700. package/Utils/Rum/SessionIdentity.ts +44 -0
  701. package/Utils/Rum/SessionReplayWireEncoding.ts +137 -0
  702. package/Utils/Rum/UserFlow.ts +1527 -0
  703. package/Utils/Slo/SloDuration.ts +22 -6
  704. package/Utils/Slo/SloHealth.ts +8 -7
  705. package/Utils/Slo/SloMonitorRuleCriteria.ts +33 -1
  706. package/Utils/Slo/SloOverviewText.ts +33 -0
  707. package/Utils/Slo/SloProjection.ts +4 -3
  708. package/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.ts +107 -0
  709. package/Utils/StatusPage/ResourceUptime.ts +99 -0
  710. package/Utils/StatusPage/UptimeDailyAggregateUtil.ts +197 -0
  711. package/Utils/Telemetry/AttributesJSON.ts +367 -0
  712. package/Utils/Uptime/DayUptimeGraphUtil.ts +165 -0
  713. package/Utils/Uptime/UptimeUtil.ts +122 -38
  714. package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js +8 -1
  715. package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js.map +1 -1
  716. package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
  717. package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js.map +1 -1
  718. package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js +8 -1
  719. package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js.map +1 -1
  720. package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js +10 -3
  721. package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js.map +1 -1
  722. package/build/dist/Models/DatabaseModels/IncidentPublicNote.js +10 -3
  723. package/build/dist/Models/DatabaseModels/IncidentPublicNote.js.map +1 -1
  724. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  725. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  726. package/build/dist/Models/DatabaseModels/KubernetesCluster.js +434 -0
  727. package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
  728. package/build/dist/Models/DatabaseModels/Monitor.js +49 -0
  729. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  730. package/build/dist/Models/DatabaseModels/Runner.js +4 -4
  731. package/build/dist/Models/DatabaseModels/Runner.js.map +1 -1
  732. package/build/dist/Models/DatabaseModels/RunnerJob.js +66 -0
  733. package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
  734. package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +11 -3
  735. package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js.map +1 -1
  736. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveFeed.js +2 -0
  737. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveFeed.js.map +1 -1
  738. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveLabelRule.js +530 -0
  739. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveLabelRule.js.map +1 -0
  740. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveMonitorRule.js +39 -4
  741. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveMonitorRule.js.map +1 -1
  742. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerRule.js +612 -0
  743. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerRule.js.map +1 -0
  744. package/build/dist/Models/DatabaseModels/WorkflowVariable.js +487 -3
  745. package/build/dist/Models/DatabaseModels/WorkflowVariable.js.map +1 -1
  746. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js +64 -16
  747. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
  748. package/build/dist/Server/API/AIInvestigationAPI.js +205 -0
  749. package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
  750. package/build/dist/Server/API/AutoRemediationAPI.js +115 -2
  751. package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
  752. package/build/dist/Server/API/CommonAPI.js +49 -0
  753. package/build/dist/Server/API/CommonAPI.js.map +1 -1
  754. package/build/dist/Server/API/KubernetesClusterAiAccessAPI.js +564 -0
  755. package/build/dist/Server/API/KubernetesClusterAiAccessAPI.js.map +1 -0
  756. package/build/dist/Server/API/MicrosoftTeamsAPI.js +465 -176
  757. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  758. package/build/dist/Server/API/MonitorAPI.js +107 -1
  759. package/build/dist/Server/API/MonitorAPI.js.map +1 -1
  760. package/build/dist/Server/API/OnCallScheduleTimelineAPI.js +5 -16
  761. package/build/dist/Server/API/OnCallScheduleTimelineAPI.js.map +1 -1
  762. package/build/dist/Server/API/SlackAPI.js +322 -78
  763. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  764. package/build/dist/Server/API/StatusPageAPI.js +123 -17
  765. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  766. package/build/dist/Server/API/TelemetryAPI.js +144 -5
  767. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  768. package/build/dist/Server/API/UserTwoFactorBackupCodeAPI.js +1 -0
  769. package/build/dist/Server/API/UserTwoFactorBackupCodeAPI.js.map +1 -1
  770. package/build/dist/Server/API/WorkflowVariableAPI.js +109 -0
  771. package/build/dist/Server/API/WorkflowVariableAPI.js.map +1 -0
  772. package/build/dist/Server/Infrastructure/GlobalCache.js +29 -0
  773. package/build/dist/Server/Infrastructure/GlobalCache.js.map +1 -1
  774. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794100000000-AddSloLabelAndOwnerRules.js +93 -0
  775. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794100000000-AddSloLabelAndOwnerRules.js.map +1 -0
  776. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794200000000-AddSloMonitorRuleMonitorType.js +12 -0
  777. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794200000000-AddSloMonitorRuleMonitorType.js.map +1 -0
  778. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794300000000-AddOAuth2WorkflowVariables.js +38 -0
  779. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794300000000-AddOAuth2WorkflowVariables.js.map +1 -0
  780. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794400000000-AddKubernetesClusterAiAccess.js +54 -0
  781. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794400000000-AddKubernetesClusterAiAccess.js.map +1 -0
  782. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794500000000-AddIncomingEmailCustomAddressToMonitor.js +14 -0
  783. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794500000000-AddIncomingEmailCustomAddressToMonitor.js.map +1 -0
  784. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794600000000-AddAuthTokenExpiresAtToWorkspaceProjectAuthToken.js +12 -0
  785. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794600000000-AddAuthTokenExpiresAtToWorkspaceProjectAuthToken.js.map +1 -0
  786. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794700000000-RemoveAppAccessTokenFromWorkspaceProjectAuthTokenMiscData.js +32 -0
  787. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794700000000-RemoveAppAccessTokenFromWorkspaceProjectAuthTokenMiscData.js.map +1 -0
  788. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +14 -0
  789. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  790. package/build/dist/Server/Middleware/MasterAdminAuthorization.js +21 -0
  791. package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
  792. package/build/dist/Server/Middleware/TelemetryIngest.js +32 -2
  793. package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
  794. package/build/dist/Server/Middleware/UserAuthorization.js +39 -6
  795. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  796. package/build/dist/Server/Services/AIAgentService.js +1 -0
  797. package/build/dist/Server/Services/AIAgentService.js.map +1 -1
  798. package/build/dist/Server/Services/AccessTokenService.js +87 -42
  799. package/build/dist/Server/Services/AccessTokenService.js.map +1 -1
  800. package/build/dist/Server/Services/AlertEpisodeMemberService.js +4 -0
  801. package/build/dist/Server/Services/AlertEpisodeMemberService.js.map +1 -1
  802. package/build/dist/Server/Services/AlertEpisodeService.js +12 -1
  803. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  804. package/build/dist/Server/Services/AlertService.js +110 -23
  805. package/build/dist/Server/Services/AlertService.js.map +1 -1
  806. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +716 -30
  807. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
  808. package/build/dist/Server/Services/AutoRemediationRuleService.js +100 -0
  809. package/build/dist/Server/Services/AutoRemediationRuleService.js.map +1 -1
  810. package/build/dist/Server/Services/BillingService.js +1 -0
  811. package/build/dist/Server/Services/BillingService.js.map +1 -1
  812. package/build/dist/Server/Services/DatabaseService.js +7 -0
  813. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  814. package/build/dist/Server/Services/InboundEmail/Providers/SendGridInboundProvider.js +11 -16
  815. package/build/dist/Server/Services/InboundEmail/Providers/SendGridInboundProvider.js.map +1 -1
  816. package/build/dist/Server/Services/IncidentEpisodeMemberService.js +4 -0
  817. package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -1
  818. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js +48 -0
  819. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js.map +1 -1
  820. package/build/dist/Server/Services/IncidentEpisodeRoleMemberService.js +21 -0
  821. package/build/dist/Server/Services/IncidentEpisodeRoleMemberService.js.map +1 -1
  822. package/build/dist/Server/Services/IncidentEpisodeService.js +12 -1
  823. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  824. package/build/dist/Server/Services/IncidentGroupingEngineService.js +8 -0
  825. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  826. package/build/dist/Server/Services/IncidentMemberService.js +14 -0
  827. package/build/dist/Server/Services/IncidentMemberService.js.map +1 -1
  828. package/build/dist/Server/Services/IncidentPublicNoteService.js +48 -0
  829. package/build/dist/Server/Services/IncidentPublicNoteService.js.map +1 -1
  830. package/build/dist/Server/Services/IncidentService.js +99 -21
  831. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  832. package/build/dist/Server/Services/IncidentStateTimelineService.js +12 -0
  833. package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
  834. package/build/dist/Server/Services/IncidentTemplateService.js +68 -4
  835. package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
  836. package/build/dist/Server/Services/Index.js +4 -0
  837. package/build/dist/Server/Services/Index.js.map +1 -1
  838. package/build/dist/Server/Services/KubernetesClusterAiAccessService.js +1470 -0
  839. package/build/dist/Server/Services/KubernetesClusterAiAccessService.js.map +1 -0
  840. package/build/dist/Server/Services/KubernetesClusterService.js +1097 -0
  841. package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
  842. package/build/dist/Server/Services/LogAggregationService.js +14 -6
  843. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  844. package/build/dist/Server/Services/MonitorService.js +490 -50
  845. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  846. package/build/dist/Server/Services/MonitorStatusTimelineService.js +540 -3
  847. package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
  848. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +2 -0
  849. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
  850. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +2 -0
  851. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
  852. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +2 -0
  853. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  854. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +3 -0
  855. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  856. package/build/dist/Server/Services/OnCallNotificationAlertingService.js +29 -7
  857. package/build/dist/Server/Services/OnCallNotificationAlertingService.js.map +1 -1
  858. package/build/dist/Server/Services/OnCallSetupReminderService.js +1 -0
  859. package/build/dist/Server/Services/OnCallSetupReminderService.js.map +1 -1
  860. package/build/dist/Server/Services/ProbeService.js +7 -1
  861. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  862. package/build/dist/Server/Services/ProjectService.js +11 -1
  863. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  864. package/build/dist/Server/Services/RunbookCredentialService.js +24 -0
  865. package/build/dist/Server/Services/RunbookCredentialService.js.map +1 -1
  866. package/build/dist/Server/Services/RunbookSecretService.js +44 -0
  867. package/build/dist/Server/Services/RunbookSecretService.js.map +1 -1
  868. package/build/dist/Server/Services/RunnerJobService.js +641 -21
  869. package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
  870. package/build/dist/Server/Services/RunnerService.js +344 -5
  871. package/build/dist/Server/Services/RunnerService.js.map +1 -1
  872. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js +48 -0
  873. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js.map +1 -1
  874. package/build/dist/Server/Services/ScheduledMaintenanceService.js +102 -20
  875. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  876. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +67 -4
  877. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -1
  878. package/build/dist/Server/Services/ServiceLevelObjectiveLabelRuleEngineService.js +295 -0
  879. package/build/dist/Server/Services/ServiceLevelObjectiveLabelRuleEngineService.js.map +1 -0
  880. package/build/dist/Server/Services/ServiceLevelObjectiveLabelRuleService.js +56 -0
  881. package/build/dist/Server/Services/ServiceLevelObjectiveLabelRuleService.js.map +1 -0
  882. package/build/dist/Server/Services/ServiceLevelObjectiveMonitorRuleEngineService.js +59 -14
  883. package/build/dist/Server/Services/ServiceLevelObjectiveMonitorRuleEngineService.js.map +1 -1
  884. package/build/dist/Server/Services/ServiceLevelObjectiveMonitorRuleService.js +22 -1
  885. package/build/dist/Server/Services/ServiceLevelObjectiveMonitorRuleService.js.map +1 -1
  886. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerRuleEngineService.js +400 -0
  887. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerRuleEngineService.js.map +1 -0
  888. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerRuleService.js +56 -0
  889. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerRuleService.js.map +1 -0
  890. package/build/dist/Server/Services/ServiceLevelObjectiveService.js +33 -1
  891. package/build/dist/Server/Services/ServiceLevelObjectiveService.js.map +1 -1
  892. package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -0
  893. package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
  894. package/build/dist/Server/Services/StatusPageService.js +230 -32
  895. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  896. package/build/dist/Server/Services/StatusPageSubscriberService.js +4 -0
  897. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  898. package/build/dist/Server/Services/TeamMemberService.js +270 -11
  899. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  900. package/build/dist/Server/Services/TraceAggregationService.js +10 -6
  901. package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
  902. package/build/dist/Server/Services/UserEmailService.js +1 -0
  903. package/build/dist/Server/Services/UserEmailService.js.map +1 -1
  904. package/build/dist/Server/Services/UserNotificationMethodAdminService.js +1 -0
  905. package/build/dist/Server/Services/UserNotificationMethodAdminService.js.map +1 -1
  906. package/build/dist/Server/Services/UserNotificationRuleAdminService.js +1 -0
  907. package/build/dist/Server/Services/UserNotificationRuleAdminService.js.map +1 -1
  908. package/build/dist/Server/Services/UserNotificationRuleService.js +4 -0
  909. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  910. package/build/dist/Server/Services/UserService.js +107 -1
  911. package/build/dist/Server/Services/UserService.js.map +1 -1
  912. package/build/dist/Server/Services/WorkflowVariableService.js +396 -7
  913. package/build/dist/Server/Services/WorkflowVariableService.js.map +1 -1
  914. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +463 -7
  915. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  916. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +144 -2
  917. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
  918. package/build/dist/Server/Types/Database/QueryHelper.js +20 -0
  919. package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
  920. package/build/dist/Server/Types/Markdown.js +394 -27
  921. package/build/dist/Server/Types/Markdown.js.map +1 -1
  922. package/build/dist/Server/Types/Workflow/Components/Telegram/SendMessageToChat.js +20 -1
  923. package/build/dist/Server/Types/Workflow/Components/Telegram/SendMessageToChat.js.map +1 -1
  924. package/build/dist/Server/Utils/AI/ClusterAccess/ClusterAccessContext.js +123 -0
  925. package/build/dist/Server/Utils/AI/ClusterAccess/ClusterAccessContext.js.map +1 -0
  926. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js +344 -0
  927. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js.map +1 -0
  928. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js +587 -0
  929. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js.map +1 -0
  930. package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentAuth.js +18 -2
  931. package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentAuth.js.map +1 -1
  932. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +1380 -239
  933. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
  934. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +1099 -68
  935. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
  936. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +88 -6
  937. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
  938. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +45 -11
  939. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
  940. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +41 -11
  941. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
  942. package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js +11 -4
  943. package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js.map +1 -1
  944. package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js +4 -2
  945. package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js.map +1 -1
  946. package/build/dist/Server/Utils/AI/Toolbox/SloTools.js +1 -0
  947. package/build/dist/Server/Utils/AI/Toolbox/SloTools.js.map +1 -1
  948. package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +997 -141
  949. package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
  950. package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js +299 -4
  951. package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js.map +1 -1
  952. package/build/dist/Server/Utils/Database/AffectedResourceRelations.js +120 -0
  953. package/build/dist/Server/Utils/Database/AffectedResourceRelations.js.map +1 -0
  954. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +160 -1
  955. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
  956. package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js +1 -0
  957. package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js.map +1 -1
  958. package/build/dist/Server/Utils/Monitor/AffectedResourceList.js +22 -51
  959. package/build/dist/Server/Utils/Monitor/AffectedResourceList.js.map +1 -1
  960. package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +1 -1
  961. package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +1 -1
  962. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +59 -12
  963. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  964. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +139 -109
  965. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  966. package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +5 -1
  967. package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
  968. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +84 -22
  969. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  970. package/build/dist/Server/Utils/Monitor/MonitorPayloadRedaction.js +70 -5
  971. package/build/dist/Server/Utils/Monitor/MonitorPayloadRedaction.js.map +1 -1
  972. package/build/dist/Server/Utils/Monitor/ProbeMonitorsNotification.js +249 -0
  973. package/build/dist/Server/Utils/Monitor/ProbeMonitorsNotification.js.map +1 -0
  974. package/build/dist/Server/Utils/Monitor/RootCauseList.js +101 -0
  975. package/build/dist/Server/Utils/Monitor/RootCauseList.js.map +1 -0
  976. package/build/dist/Server/Utils/OnCall/OnCallShiftReminderRunner.js +1 -0
  977. package/build/dist/Server/Utils/OnCall/OnCallShiftReminderRunner.js.map +1 -1
  978. package/build/dist/Server/Utils/PushNotificationUtil.js +27 -0
  979. package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
  980. package/build/dist/Server/Utils/Rules/OwnerRuleAssignment.js +26 -3
  981. package/build/dist/Server/Utils/Rules/OwnerRuleAssignment.js.map +1 -1
  982. package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js +28 -0
  983. package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js.map +1 -1
  984. package/build/dist/Server/Utils/Runbook/RunbookExecutePermission.js +38 -3
  985. package/build/dist/Server/Utils/Runbook/RunbookExecutePermission.js.map +1 -1
  986. package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js +143 -23
  987. package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js.map +1 -1
  988. package/build/dist/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.js +406 -0
  989. package/build/dist/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.js.map +1 -0
  990. package/build/dist/Server/Utils/Slo/SloRulePatternValidator.js +28 -0
  991. package/build/dist/Server/Utils/Slo/SloRulePatternValidator.js.map +1 -0
  992. package/build/dist/Server/Utils/StartServer.js +4 -3
  993. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  994. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +382 -0
  995. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -0
  996. package/build/dist/Server/Utils/TwoFactorBackupCodeNotification.js +1 -0
  997. package/build/dist/Server/Utils/TwoFactorBackupCodeNotification.js.map +1 -1
  998. package/build/dist/Server/Utils/UserPermission/UserPermission.js +10 -0
  999. package/build/dist/Server/Utils/UserPermission/UserPermission.js.map +1 -1
  1000. package/build/dist/Server/Utils/Workflow/OAuth2TokenClient.js +447 -0
  1001. package/build/dist/Server/Utils/Workflow/OAuth2TokenClient.js.map +1 -0
  1002. package/build/dist/Server/Utils/Workflow/WorkflowVariableOAuthToken.js +202 -0
  1003. package/build/dist/Server/Utils/Workflow/WorkflowVariableOAuthToken.js.map +1 -0
  1004. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +39 -1
  1005. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  1006. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +44 -4
  1007. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
  1008. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +150 -191
  1009. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  1010. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +44 -4
  1011. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
  1012. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +39 -17
  1013. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -1
  1014. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +151 -145
  1015. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
  1016. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +221 -127
  1017. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  1018. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsServiceUrl.js +91 -0
  1019. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsServiceUrl.js.map +1 -0
  1020. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/ReactionNoteSync.js +673 -0
  1021. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/ReactionNoteSync.js.map +1 -0
  1022. package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js +3 -9
  1023. package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js.map +1 -1
  1024. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +65 -166
  1025. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  1026. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +63 -157
  1027. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
  1028. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +23 -3
  1029. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
  1030. package/build/dist/Server/Utils/Workspace/Slack/Actions/Authorization.js +92 -0
  1031. package/build/dist/Server/Utils/Workspace/Slack/Actions/Authorization.js.map +1 -0
  1032. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +81 -210
  1033. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  1034. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +68 -138
  1035. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
  1036. package/build/dist/Server/Utils/Workspace/Slack/Actions/ReactionNote.js +240 -0
  1037. package/build/dist/Server/Utils/Workspace/Slack/Actions/ReactionNote.js.map +1 -0
  1038. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +85 -212
  1039. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
  1040. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +60 -17
  1041. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  1042. package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +2 -0
  1043. package/build/dist/Server/Utils/Workspace/Workspace.js +134 -41
  1044. package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
  1045. package/build/dist/Server/Utils/Workspace/WorkspaceActionAuthorization.js +197 -0
  1046. package/build/dist/Server/Utils/Workspace/WorkspaceActionAuthorization.js.map +1 -0
  1047. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +32 -0
  1048. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
  1049. package/build/dist/Server/Utils/Workspace/WorkspaceOAuthState.js +199 -0
  1050. package/build/dist/Server/Utils/Workspace/WorkspaceOAuthState.js.map +1 -0
  1051. package/build/dist/Server/Utils/Workspace/WorkspaceProjectReferenceValidator.js +91 -0
  1052. package/build/dist/Server/Utils/Workspace/WorkspaceProjectReferenceValidator.js.map +1 -0
  1053. package/build/dist/Server/Utils/Workspace/WorkspaceReactionNote.js +450 -0
  1054. package/build/dist/Server/Utils/Workspace/WorkspaceReactionNote.js.map +1 -0
  1055. package/build/dist/Types/API/Route.js +18 -2
  1056. package/build/dist/Types/API/Route.js.map +1 -1
  1057. package/build/dist/Types/API/URL.js +23 -2
  1058. package/build/dist/Types/API/URL.js.map +1 -1
  1059. package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +103 -5
  1060. package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
  1061. package/build/dist/Types/Date.js +97 -7
  1062. package/build/dist/Types/Date.js.map +1 -1
  1063. package/build/dist/Types/Email/EmailTemplateType.js +1 -0
  1064. package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
  1065. package/build/dist/Types/Exception/ExceptionMessages.js +1 -0
  1066. package/build/dist/Types/Exception/ExceptionMessages.js.map +1 -1
  1067. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js +245 -0
  1068. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js.map +1 -0
  1069. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessPermissions.js +49 -0
  1070. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessPermissions.js.map +1 -0
  1071. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessToolNames.js +16 -0
  1072. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessToolNames.js.map +1 -0
  1073. package/build/dist/Types/Monitor/DatabaseMonitor/SqlServerPlatform.js +104 -0
  1074. package/build/dist/Types/Monitor/DatabaseMonitor/SqlServerPlatform.js.map +1 -0
  1075. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +6 -5
  1076. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  1077. package/build/dist/Types/Monitor/MonitorStepExceptionMonitor.js +32 -0
  1078. package/build/dist/Types/Monitor/MonitorStepExceptionMonitor.js.map +1 -1
  1079. package/build/dist/Types/Monitor/MonitorUptimeSummary.js +52 -0
  1080. package/build/dist/Types/Monitor/MonitorUptimeSummary.js.map +1 -0
  1081. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +9 -1
  1082. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -1
  1083. package/build/dist/Types/Permission.js +84 -0
  1084. package/build/dist/Types/Permission.js.map +1 -1
  1085. package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js +11 -0
  1086. package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js.map +1 -1
  1087. package/build/dist/Types/Rules/RuleRun.js +4 -0
  1088. package/build/dist/Types/Rules/RuleRun.js.map +1 -1
  1089. package/build/dist/Types/Rum/SessionReplay.js +52 -2
  1090. package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
  1091. package/build/dist/Types/Rum/SessionReplayApi.js +11 -0
  1092. package/build/dist/Types/Rum/SessionReplayApi.js.map +1 -1
  1093. package/build/dist/Types/Rum/UserFlow.js +115 -0
  1094. package/build/dist/Types/Rum/UserFlow.js.map +1 -0
  1095. package/build/dist/Types/Runbook/RunbookStepType.js +10 -0
  1096. package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
  1097. package/build/dist/Types/Runbook/RunnerJobOrigin.js +14 -0
  1098. package/build/dist/Types/Runbook/RunnerJobOrigin.js.map +1 -1
  1099. package/build/dist/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +2 -2
  1100. package/build/dist/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js.map +1 -1
  1101. package/build/dist/Types/StatusPage/MergedDowntimeTotals.js +2 -0
  1102. package/build/dist/Types/StatusPage/MergedDowntimeTotals.js.map +1 -0
  1103. package/build/dist/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +65 -0
  1104. package/build/dist/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js.map +1 -0
  1105. package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +8 -0
  1106. package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
  1107. package/build/dist/Types/Timezone.js +5 -0
  1108. package/build/dist/Types/Timezone.js.map +1 -1
  1109. package/build/dist/Types/TimezoneAlias.js +340 -0
  1110. package/build/dist/Types/TimezoneAlias.js.map +1 -0
  1111. package/build/dist/Types/Workflow/Templates.js +2694 -2
  1112. package/build/dist/Types/Workflow/Templates.js.map +1 -1
  1113. package/build/dist/Types/Workflow/WorkflowVariableOAuth.js +314 -0
  1114. package/build/dist/Types/Workflow/WorkflowVariableOAuth.js.map +1 -0
  1115. package/build/dist/Types/Workspace/WorkspaceNoteReaction.js +98 -0
  1116. package/build/dist/Types/Workspace/WorkspaceNoteReaction.js.map +1 -0
  1117. package/build/dist/UI/Components/AttributesJSON/AttributesJSONPreferences.js +95 -0
  1118. package/build/dist/UI/Components/AttributesJSON/AttributesJSONPreferences.js.map +1 -0
  1119. package/build/dist/UI/Components/AttributesJSON/AttributesJSONView.js +44 -0
  1120. package/build/dist/UI/Components/AttributesJSON/AttributesJSONView.js.map +1 -0
  1121. package/build/dist/UI/Components/AttributesJSON/AttributesViewToggle.js +27 -0
  1122. package/build/dist/UI/Components/AttributesJSON/AttributesViewToggle.js.map +1 -0
  1123. package/build/dist/UI/Components/AttributesJSON/BracesGlyph.js +9 -0
  1124. package/build/dist/UI/Components/AttributesJSON/BracesGlyph.js.map +1 -0
  1125. package/build/dist/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.js +260 -0
  1126. package/build/dist/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.js.map +1 -0
  1127. package/build/dist/UI/Components/AttributesJSON/JSONHighlight.js +56 -0
  1128. package/build/dist/UI/Components/AttributesJSON/JSONHighlight.js.map +1 -0
  1129. package/build/dist/UI/Components/Calendar/Calendar.js +94 -7
  1130. package/build/dist/UI/Components/Calendar/Calendar.js.map +1 -1
  1131. package/build/dist/UI/Components/Calendar/CalendarDayLayout.js +136 -0
  1132. package/build/dist/UI/Components/Calendar/CalendarDayLayout.js.map +1 -0
  1133. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +1 -1
  1134. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  1135. package/build/dist/UI/Components/Charts/Utils/HistogramSelection.js +72 -0
  1136. package/build/dist/UI/Components/Charts/Utils/HistogramSelection.js.map +1 -0
  1137. package/build/dist/UI/Components/Charts/Utils/useHistogramRangeSelection.js +178 -0
  1138. package/build/dist/UI/Components/Charts/Utils/useHistogramRangeSelection.js.map +1 -0
  1139. package/build/dist/UI/Components/Charts/Utils/useHistogramZoom.js +13 -1
  1140. package/build/dist/UI/Components/Charts/Utils/useHistogramZoom.js.map +1 -1
  1141. package/build/dist/UI/Components/Date/CustomTimeRangeModal.js +20 -4
  1142. package/build/dist/UI/Components/Date/CustomTimeRangeModal.js.map +1 -1
  1143. package/build/dist/UI/Components/Dropdown/Dropdown.js +33 -9
  1144. package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
  1145. package/build/dist/UI/Components/Feed/FeedOptions.js +235 -0
  1146. package/build/dist/UI/Components/Feed/FeedOptions.js.map +1 -0
  1147. package/build/dist/UI/Components/Feed/FeedOptionsButton.js +346 -0
  1148. package/build/dist/UI/Components/Feed/FeedOptionsButton.js.map +1 -0
  1149. package/build/dist/UI/Components/Feed/useFeedItems.js +17 -7
  1150. package/build/dist/UI/Components/Feed/useFeedItems.js.map +1 -1
  1151. package/build/dist/UI/Components/Feed/useFeedOptions.js +130 -0
  1152. package/build/dist/UI/Components/Feed/useFeedOptions.js.map +1 -0
  1153. package/build/dist/UI/Components/Forms/Fields/FormField.js +36 -13
  1154. package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
  1155. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +117 -11
  1156. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
  1157. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +5 -1
  1158. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
  1159. package/build/dist/UI/Components/Graphs/UptimeDaySummary.js.map +1 -1
  1160. package/build/dist/UI/Components/Icon/Icon.js +1 -1
  1161. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  1162. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +36 -8
  1163. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  1164. package/build/dist/UI/Components/LogsViewer/components/ColumnSelector.js +10 -2
  1165. package/build/dist/UI/Components/LogsViewer/components/ColumnSelector.js.map +1 -1
  1166. package/build/dist/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.js +9 -1
  1167. package/build/dist/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.js.map +1 -1
  1168. package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js +16 -15
  1169. package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js.map +1 -1
  1170. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +1 -1
  1171. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
  1172. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +14 -74
  1173. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
  1174. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +22 -5
  1175. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
  1176. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +9 -2
  1177. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
  1178. package/build/dist/UI/Components/LogsViewer/useLogsHistogram.js +16 -5
  1179. package/build/dist/UI/Components/LogsViewer/useLogsHistogram.js.map +1 -1
  1180. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +23 -8
  1181. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  1182. package/build/dist/UI/Components/MonitorGraphs/Uptime.js +7 -1
  1183. package/build/dist/UI/Components/MonitorGraphs/Uptime.js.map +1 -1
  1184. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +5 -1
  1185. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
  1186. package/build/dist/UI/Components/Page/ModelPage.js +37 -3
  1187. package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
  1188. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +27 -6
  1189. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  1190. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryDetailPanel.js +7 -1
  1191. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryDetailPanel.js.map +1 -1
  1192. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +1 -1
  1193. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
  1194. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +17 -77
  1195. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
  1196. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +10 -1
  1197. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
  1198. package/build/dist/UI/Utils/ModelAPI/ProjectUsersModelAPI.js +15 -1
  1199. package/build/dist/UI/Utils/ModelAPI/ProjectUsersModelAPI.js.map +1 -1
  1200. package/build/dist/UI/Utils/Timezone.js +52 -17
  1201. package/build/dist/UI/Utils/Timezone.js.map +1 -1
  1202. package/build/dist/Utils/AI/InvestigationReport.js +116 -21
  1203. package/build/dist/Utils/AI/InvestigationReport.js.map +1 -1
  1204. package/build/dist/Utils/AiRemediation/KubectlOutputRedactor.js +1209 -0
  1205. package/build/dist/Utils/AiRemediation/KubectlOutputRedactor.js.map +1 -0
  1206. package/build/dist/Utils/AiRemediation/KubectlPolicy.js +2973 -0
  1207. package/build/dist/Utils/AiRemediation/KubectlPolicy.js.map +1 -0
  1208. package/build/dist/Utils/AiRemediation/KubectlWaitBudget.js +99 -0
  1209. package/build/dist/Utils/AiRemediation/KubectlWaitBudget.js.map +1 -0
  1210. package/build/dist/Utils/AiRemediation/KubectlWriteScope.js +1429 -0
  1211. package/build/dist/Utils/AiRemediation/KubectlWriteScope.js.map +1 -0
  1212. package/build/dist/Utils/Dashboard/Components/DashboardClockComponent.js +7 -6
  1213. package/build/dist/Utils/Dashboard/Components/DashboardClockComponent.js.map +1 -1
  1214. package/build/dist/Utils/LabelRuleImportExport.js +22 -6
  1215. package/build/dist/Utils/LabelRuleImportExport.js.map +1 -1
  1216. package/build/dist/Utils/Monitor/IncomingEmailMonitorAddress.js +214 -0
  1217. package/build/dist/Utils/Monitor/IncomingEmailMonitorAddress.js.map +1 -0
  1218. package/build/dist/Utils/Monitor/MetricValueFormatter.js +2 -2
  1219. package/build/dist/Utils/Monitor/MonitorCheckScheduleUtil.js +471 -0
  1220. package/build/dist/Utils/Monitor/MonitorCheckScheduleUtil.js.map +1 -0
  1221. package/build/dist/Utils/Monitor/MonitorOverviewCriteriaUtil.js +107 -0
  1222. package/build/dist/Utils/Monitor/MonitorOverviewCriteriaUtil.js.map +1 -0
  1223. package/build/dist/Utils/Monitor/MonitorOverviewFamily.js +191 -0
  1224. package/build/dist/Utils/Monitor/MonitorOverviewFamily.js.map +1 -0
  1225. package/build/dist/Utils/Monitor/MonitorOverviewPresentationUtil.js +1259 -0
  1226. package/build/dist/Utils/Monitor/MonitorOverviewPresentationUtil.js.map +1 -0
  1227. package/build/dist/Utils/Monitor/MonitorOverviewProbeUtil.js +593 -0
  1228. package/build/dist/Utils/Monitor/MonitorOverviewProbeUtil.js.map +1 -0
  1229. package/build/dist/Utils/Monitor/MonitorOverviewTargetUtil.js +195 -0
  1230. package/build/dist/Utils/Monitor/MonitorOverviewTargetUtil.js.map +1 -0
  1231. package/build/dist/Utils/Monitor/MonitorStatusHistoryUtil.js +127 -0
  1232. package/build/dist/Utils/Monitor/MonitorStatusHistoryUtil.js.map +1 -0
  1233. package/build/dist/Utils/Monitor/MonitorUptimeSummaryUtil.js +464 -0
  1234. package/build/dist/Utils/Monitor/MonitorUptimeSummaryUtil.js.map +1 -0
  1235. package/build/dist/Utils/Rules/MonitorTypeRuleCriteria.js +18 -0
  1236. package/build/dist/Utils/Rules/MonitorTypeRuleCriteria.js.map +1 -0
  1237. package/build/dist/Utils/Rum/SessionIdentity.js +31 -1
  1238. package/build/dist/Utils/Rum/SessionIdentity.js.map +1 -1
  1239. package/build/dist/Utils/Rum/SessionReplayWireEncoding.js +128 -0
  1240. package/build/dist/Utils/Rum/SessionReplayWireEncoding.js.map +1 -0
  1241. package/build/dist/Utils/Rum/UserFlow.js +941 -0
  1242. package/build/dist/Utils/Rum/UserFlow.js.map +1 -0
  1243. package/build/dist/Utils/Slo/SloDuration.js +13 -5
  1244. package/build/dist/Utils/Slo/SloDuration.js.map +1 -1
  1245. package/build/dist/Utils/Slo/SloHealth.js +8 -7
  1246. package/build/dist/Utils/Slo/SloHealth.js.map +1 -1
  1247. package/build/dist/Utils/Slo/SloMonitorRuleCriteria.js +16 -1
  1248. package/build/dist/Utils/Slo/SloMonitorRuleCriteria.js.map +1 -1
  1249. package/build/dist/Utils/Slo/SloOverviewText.js +16 -0
  1250. package/build/dist/Utils/Slo/SloOverviewText.js.map +1 -1
  1251. package/build/dist/Utils/Slo/SloProjection.js.map +1 -1
  1252. package/build/dist/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.js +82 -0
  1253. package/build/dist/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.js.map +1 -0
  1254. package/build/dist/Utils/StatusPage/ResourceUptime.js +46 -0
  1255. package/build/dist/Utils/StatusPage/ResourceUptime.js.map +1 -1
  1256. package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js +148 -0
  1257. package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js.map +1 -1
  1258. package/build/dist/Utils/Telemetry/AttributesJSON.js +245 -0
  1259. package/build/dist/Utils/Telemetry/AttributesJSON.js.map +1 -0
  1260. package/build/dist/Utils/Uptime/DayUptimeGraphUtil.js +103 -0
  1261. package/build/dist/Utils/Uptime/DayUptimeGraphUtil.js.map +1 -1
  1262. package/build/dist/Utils/Uptime/UptimeUtil.js +91 -27
  1263. package/build/dist/Utils/Uptime/UptimeUtil.js.map +1 -1
  1264. package/jest.config.json +2 -1
  1265. package/package.json +2 -1
  1266. package/tsconfig.tests.json +36 -0
  1267. package/Tests/UI/Components/EmptyState/EmptyStateGuideLinks.test.tsx +0 -337
  1268. package/UI/Components/EmptyState/EmptyStateGuideLinks.tsx +0 -124
  1269. package/build/dist/UI/Components/EmptyState/EmptyStateGuideLinks.js +0 -47
  1270. package/build/dist/UI/Components/EmptyState/EmptyStateGuideLinks.js.map +0 -1
@@ -0,0 +1,2531 @@
1
+ import KubectlOutputRedactor, {
2
+ KUBECTL_REDACTED_MARKER,
3
+ KubectlOutputRedaction,
4
+ } from "../../../Utils/AiRemediation/KubectlOutputRedactor";
5
+ import { describe, expect, it } from "@jest/globals";
6
+
7
+ /*
8
+ * Contract under test — KubectlOutputRedactor is the pure, deterministic
9
+ * pass every kubectl output goes through before a model sees it or it is
10
+ * stored next to an AI run:
11
+ * 1. Secret data/stringData blocks (YAML, JSON, Lists) lose every value
12
+ * and keep every key; an object whose kind cannot be seen is treated as
13
+ * a Secret (fail closed); a ConfigMap keeps its non-credential values.
14
+ * 2. Env entries whose name looks credential-like lose their value in
15
+ * YAML, JSON and describe output; valueFrom references are kept.
16
+ * 3. Credential-like keys are masked wherever they appear, block scalars
17
+ * included; the last-applied-configuration annotation is dropped.
18
+ * 4. Inline material (URL passwords, Bearer/Basic, JWTs, PEM keys, base64,
19
+ * one-line JSON) is masked regardless of structure.
20
+ * 5. Ordinary kubectl output — tables, events, taints, flags, names,
21
+ * trace ids — passes through untouched, and the pass is idempotent.
22
+ * 6. Credential names are recognised in their common spellings (DB_PASS,
23
+ * RABBITMQ_DEFAULT_PASS, requirepass) without catching "bypass" or
24
+ * "passthrough".
25
+ * 7. A credential flag whose value is the next argv element — a YAML or
26
+ * JSON list item, a line of describe's Args block, the next word of a
27
+ * command line — loses that value; a tool's short password flag
28
+ * (`mysql -pX`, `redis-cli -a X`) only where the tool is named, so
29
+ * `mkdir -p` and `ssh -p 22` stay.
30
+ * 8. One-line JSON (`{.data}` jsonpath, structured logs) loses the values
31
+ * of credential-like keys and still parses.
32
+ * 9. `kubectl describe configmap`'s "KEY:" / "----" / value layout loses a
33
+ * credential-like key's whole value, however many lines it has.
34
+ * 10. Every rule runs in linear time: ~200 KB shaped to make a regex
35
+ * backtrack (long dotted runs, flag runs, quote runs, deep indentation)
36
+ * is redacted in well under a second.
37
+ */
38
+
39
+ const PASSWORD_B64: string = "cGFzc3dvcmQ=";
40
+ const ADMIN_B64: string = "YWRtaW4=";
41
+ const JWT: string = `eyJhbGciOiJSUzI1NiIsImtpZCI6IjEyMyJ9.${"a".repeat(24)}.${"b".repeat(16)}`;
42
+
43
+ const MARKER: string = KUBECTL_REDACTED_MARKER;
44
+
45
+ function redact(text: string): KubectlOutputRedaction {
46
+ return KubectlOutputRedactor.redact(text);
47
+ }
48
+
49
+ function lines(...parts: Array<string>): string {
50
+ return parts.join("\n");
51
+ }
52
+
53
+ /*
54
+ * The fixture with the given whole lines replaced, in order. Used as the
55
+ * expected output of a realistic fixture, it pins both what is masked and
56
+ * that every other line passes through byte for byte.
57
+ */
58
+ function replaceLines(
59
+ text: string,
60
+ replacements: Array<[string, string]>,
61
+ ): string {
62
+ const all: Array<string> = text.split("\n");
63
+ let searchFrom: number = 0;
64
+ for (const [from, to] of replacements) {
65
+ const index: number = all.indexOf(from, searchFrom);
66
+ if (index === -1) {
67
+ throw new Error(`The fixture has no line ${JSON.stringify(from)}`);
68
+ }
69
+ all[index] = to;
70
+ searchFrom = index + 1;
71
+ }
72
+ return all.join("\n");
73
+ }
74
+
75
+ // Masking twice changes nothing and finds nothing more to mask.
76
+ function expectIdempotent(text: string): void {
77
+ const once: KubectlOutputRedaction = redact(text);
78
+ const twice: KubectlOutputRedaction = redact(once.text);
79
+ expect(twice.text).toBe(once.text);
80
+ expect(twice.redactionCount).toBe(0);
81
+ }
82
+
83
+ /*
84
+ * `kubectl get deployment api -o yaml` — keys sorted as kubectl prints
85
+ * them — with credentials in split-flag args, `*_PASS` env names and an
86
+ * exec probe's `mysqladmin -p…`, next to ordinary configuration that must
87
+ * stay readable.
88
+ */
89
+ const DEPLOYMENT_YAML: string = lines(
90
+ "apiVersion: apps/v1",
91
+ "kind: Deployment",
92
+ "metadata:",
93
+ " annotations:",
94
+ ' deployment.kubernetes.io/revision: "3"',
95
+ ' creationTimestamp: "2026-09-20T08:15:30Z"',
96
+ " generation: 3",
97
+ " labels:",
98
+ " app: api",
99
+ " name: api",
100
+ " namespace: prod",
101
+ ' resourceVersion: "48213377"',
102
+ " uid: 5b1c7f0e-3a2d-4c8e-9f61-2d7a9b0c4e11",
103
+ "spec:",
104
+ " progressDeadlineSeconds: 600",
105
+ " replicas: 2",
106
+ " revisionHistoryLimit: 10",
107
+ " selector:",
108
+ " matchLabels:",
109
+ " app: api",
110
+ " strategy:",
111
+ " rollingUpdate:",
112
+ " maxSurge: 25%",
113
+ " maxUnavailable: 25%",
114
+ " type: RollingUpdate",
115
+ " template:",
116
+ " metadata:",
117
+ " creationTimestamp: null",
118
+ " labels:",
119
+ " app: api",
120
+ " spec:",
121
+ " containers:",
122
+ " - args:",
123
+ " - --port",
124
+ ' - "8080"',
125
+ " - --log-level",
126
+ " - info",
127
+ " - --db-password",
128
+ " - Sup3rS3cretPw",
129
+ " - --api-token",
130
+ " - tok_live_9f8e7d6c5b",
131
+ " - --tail",
132
+ ' - "100"',
133
+ " - --feature-gates",
134
+ " - Foo=true",
135
+ " - --verbose",
136
+ " command:",
137
+ " - /app/server",
138
+ " env:",
139
+ " - name: DB_HOST",
140
+ " value: postgres.prod.svc",
141
+ " - name: DB_PASS",
142
+ " value: Hunter2DbPass",
143
+ " - name: SMTP_PASS",
144
+ " value: SmtpPw-771",
145
+ " - name: RABBITMQ_DEFAULT_PASS",
146
+ " value: rabbitPw12",
147
+ " - name: BYPASS_CACHE",
148
+ ' value: "true"',
149
+ " - name: DB_PASSWORD",
150
+ " valueFrom:",
151
+ " secretKeyRef:",
152
+ " key: password",
153
+ " name: db-creds",
154
+ " image: ghcr.io/acme/api:2.14.1",
155
+ " imagePullPolicy: IfNotPresent",
156
+ " livenessProbe:",
157
+ " exec:",
158
+ " command:",
159
+ " - mysqladmin",
160
+ " - ping",
161
+ " - -uroot",
162
+ " - -pRootPw99",
163
+ " failureThreshold: 3",
164
+ " initialDelaySeconds: 10",
165
+ " periodSeconds: 10",
166
+ " successThreshold: 1",
167
+ " timeoutSeconds: 5",
168
+ " name: api",
169
+ " ports:",
170
+ " - containerPort: 8080",
171
+ " protocol: TCP",
172
+ " resources: {}",
173
+ " terminationMessagePath: /dev/termination-log",
174
+ " terminationMessagePolicy: File",
175
+ " - args:",
176
+ " - --requirepass",
177
+ " - R3disPw",
178
+ " - --appendonly",
179
+ ' - "yes"',
180
+ " command:",
181
+ " - redis-server",
182
+ " image: redis:7.2.4",
183
+ " imagePullPolicy: IfNotPresent",
184
+ " name: cache",
185
+ " resources: {}",
186
+ " dnsPolicy: ClusterFirst",
187
+ " restartPolicy: Always",
188
+ " schedulerName: default-scheduler",
189
+ " securityContext: {}",
190
+ " terminationGracePeriodSeconds: 30",
191
+ "status:",
192
+ " availableReplicas: 2",
193
+ " conditions:",
194
+ ' - lastTransitionTime: "2026-09-20T08:16:02Z"',
195
+ ' lastUpdateTime: "2026-09-20T08:16:02Z"',
196
+ " message: Deployment has minimum availability.",
197
+ " reason: MinimumReplicasAvailable",
198
+ ' status: "True"',
199
+ " type: Available",
200
+ " observedGeneration: 3",
201
+ " readyReplicas: 2",
202
+ " replicas: 2",
203
+ " updatedReplicas: 2",
204
+ );
205
+
206
+ // `kubectl describe pod` for the same workload.
207
+ const DESCRIBE_POD: string = lines(
208
+ "Name: api-7d9f4c8b5d-x2k9q",
209
+ "Namespace: prod",
210
+ "Priority: 0",
211
+ "Service Account: default",
212
+ "Node: ip-10-0-1-23.ec2.internal/10.0.1.23",
213
+ "Start Time: Tue, 22 Sep 2026 10:00:00 +0000",
214
+ "Labels: app=api",
215
+ " pod-template-hash=7d9f4c8b5d",
216
+ "Annotations: <none>",
217
+ "Status: Running",
218
+ "IP: 10.0.1.57",
219
+ "IPs:",
220
+ " IP: 10.0.1.57",
221
+ "Controlled By: ReplicaSet/api-7d9f4c8b5d",
222
+ "Containers:",
223
+ " api:",
224
+ " Container ID: containerd://3f5a9c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a",
225
+ " Image: ghcr.io/acme/api:2.14.1",
226
+ " Image ID: ghcr.io/acme/api@sha256:9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d",
227
+ " Port: 8080/TCP",
228
+ " Host Port: 0/TCP",
229
+ " Command:",
230
+ " /app/server",
231
+ " Args:",
232
+ " --port",
233
+ " 8080",
234
+ " --log-level",
235
+ " info",
236
+ " --db-password",
237
+ " Sup3rS3cretPw",
238
+ " --api-token",
239
+ " tok_live_9f8e7d6c5b",
240
+ " --verbose",
241
+ " State: Running",
242
+ " Started: Tue, 22 Sep 2026 10:00:05 +0000",
243
+ " Ready: True",
244
+ " Restart Count: 0",
245
+ " Liveness: exec [mysqladmin ping -uroot -pRootPw99] delay=10s timeout=5s period=10s #success=1 #failure=3",
246
+ " Environment:",
247
+ " DB_HOST: postgres.prod.svc",
248
+ " DB_PASS: Hunter2DbPass",
249
+ " SMTP_PASS: SmtpPw-771",
250
+ " RABBITMQ_DEFAULT_PASS: rabbitPw12",
251
+ " BYPASS_CACHE: true",
252
+ " DB_PASSWORD: <set to the key 'password' in secret 'db-creds'> Optional: false",
253
+ " Mounts:",
254
+ " /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-x7k2q (ro)",
255
+ " cache:",
256
+ " Container ID: containerd://8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e",
257
+ " Image: redis:7.2.4",
258
+ " Image ID: docker.io/library/redis@sha256:1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b",
259
+ " Port: <none>",
260
+ " Host Port: <none>",
261
+ " Command:",
262
+ " redis-server",
263
+ " Args:",
264
+ " --requirepass",
265
+ " R3disPw",
266
+ " --appendonly",
267
+ " yes",
268
+ " State: Running",
269
+ " Started: Tue, 22 Sep 2026 10:00:04 +0000",
270
+ " Ready: True",
271
+ " Restart Count: 0",
272
+ " Environment: <none>",
273
+ " Mounts:",
274
+ " /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-x7k2q (ro)",
275
+ "Conditions:",
276
+ " Type Status",
277
+ " PodReadyToStartContainers True",
278
+ " Initialized True",
279
+ " Ready True",
280
+ " ContainersReady True",
281
+ " PodScheduled True",
282
+ "Volumes:",
283
+ " kube-api-access-x7k2q:",
284
+ " Type: Projected (a volume that contains injected data from multiple sources)",
285
+ " TokenExpirationSeconds: 3607",
286
+ " ConfigMapName: kube-root-ca.crt",
287
+ " ConfigMapOptional: <nil>",
288
+ " DownwardAPI: true",
289
+ "QoS Class: BestEffort",
290
+ "Node-Selectors: <none>",
291
+ "Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s",
292
+ " node.kubernetes.io/unreachable:NoExecute op=Exists for 300s",
293
+ "Events:",
294
+ " Type Reason Age From Message",
295
+ " ---- ------ ---- ---- -------",
296
+ " Normal Scheduled 2m default-scheduler Successfully assigned prod/api-7d9f4c8b5d-x2k9q to ip-10-0-1-23.ec2.internal",
297
+ ' Normal Pulled 2m kubelet Container image "ghcr.io/acme/api:2.14.1" already present on machine',
298
+ " Normal Created 2m kubelet Created container: api",
299
+ " Normal Started 2m kubelet Started container api",
300
+ );
301
+
302
+ // The literals no fixture may leak.
303
+ const POD_SECRETS: Array<string> = [
304
+ "Sup3rS3cretPw",
305
+ "tok_live_9f8e7d6c5b",
306
+ "Hunter2DbPass",
307
+ "SmtpPw-771",
308
+ "rabbitPw12",
309
+ "RootPw99",
310
+ "R3disPw",
311
+ ];
312
+
313
+ /*
314
+ * The values a Pod object carries in its credential-bearing fields, so the
315
+ * same builder yields both the fixture and the expected redaction.
316
+ */
317
+ interface PodCredentials {
318
+ lastApplied: string;
319
+ dbPasswordArg: string;
320
+ apiTokenArg: string;
321
+ dbPass: string;
322
+ smtpPass: string;
323
+ mysqlPasswordFlag: string;
324
+ redisPassArg: string;
325
+ }
326
+
327
+ const REAL_POD_CREDENTIALS: PodCredentials = {
328
+ lastApplied: `${JSON.stringify({
329
+ apiVersion: "v1",
330
+ kind: "Pod",
331
+ spec: {
332
+ containers: [
333
+ {
334
+ args: ["--db-password", "Sup3rS3cretPw"],
335
+ env: [{ name: "DB_PASS", value: "Hunter2DbPass" }],
336
+ name: "api",
337
+ },
338
+ ],
339
+ },
340
+ })}\n`,
341
+ dbPasswordArg: "Sup3rS3cretPw",
342
+ apiTokenArg: "tok_live_9f8e7d6c5b",
343
+ dbPass: "Hunter2DbPass",
344
+ smtpPass: "SmtpPw-771",
345
+ mysqlPasswordFlag: "-pRootPw99",
346
+ redisPassArg: "R3disPw",
347
+ };
348
+
349
+ const MASKED_POD_CREDENTIALS: PodCredentials = {
350
+ lastApplied: MARKER,
351
+ dbPasswordArg: MARKER,
352
+ apiTokenArg: MARKER,
353
+ dbPass: MARKER,
354
+ smtpPass: MARKER,
355
+ mysqlPasswordFlag: `-p${MARKER}`,
356
+ redisPassArg: MARKER,
357
+ };
358
+
359
+ // `kubectl get pod -o json` for the same workload.
360
+ function buildPod(credentials: PodCredentials): Record<string, unknown> {
361
+ return {
362
+ apiVersion: "v1",
363
+ kind: "Pod",
364
+ metadata: {
365
+ annotations: {
366
+ "kubectl.kubernetes.io/last-applied-configuration":
367
+ credentials.lastApplied,
368
+ "prometheus.io/scrape": "true",
369
+ },
370
+ creationTimestamp: "2026-09-22T10:00:00Z",
371
+ generateName: "api-7d9f4c8b5d-",
372
+ labels: { app: "api", "pod-template-hash": "7d9f4c8b5d" },
373
+ name: "api-7d9f4c8b5d-x2k9q",
374
+ namespace: "prod",
375
+ ownerReferences: [
376
+ {
377
+ apiVersion: "apps/v1",
378
+ blockOwnerDeletion: true,
379
+ controller: true,
380
+ kind: "ReplicaSet",
381
+ name: "api-7d9f4c8b5d",
382
+ uid: "0d6e8f1a-2b3c-4d5e-8f90-a1b2c3d4e5f6",
383
+ },
384
+ ],
385
+ resourceVersion: "48213377",
386
+ uid: "5b1c7f0e-3a2d-4c8e-9f61-2d7a9b0c4e11",
387
+ },
388
+ spec: {
389
+ automountServiceAccountToken: true,
390
+ containers: [
391
+ {
392
+ args: [
393
+ "--port",
394
+ "8080",
395
+ "--log-level",
396
+ "info",
397
+ "--db-password",
398
+ credentials.dbPasswordArg,
399
+ "--api-token",
400
+ credentials.apiTokenArg,
401
+ "--verbose",
402
+ ],
403
+ command: ["/app/server"],
404
+ env: [
405
+ { name: "DB_HOST", value: "postgres.prod.svc" },
406
+ { name: "DB_PASS", value: credentials.dbPass },
407
+ { name: "SMTP_PASS", value: credentials.smtpPass },
408
+ { name: "BYPASS_CACHE", value: "true" },
409
+ {
410
+ name: "DB_PASSWORD",
411
+ valueFrom: {
412
+ secretKeyRef: { key: "password", name: "db-creds" },
413
+ },
414
+ },
415
+ ],
416
+ image: "ghcr.io/acme/api:2.14.1",
417
+ livenessProbe: {
418
+ exec: {
419
+ command: [
420
+ "mysqladmin",
421
+ "ping",
422
+ "-uroot",
423
+ credentials.mysqlPasswordFlag,
424
+ ],
425
+ },
426
+ initialDelaySeconds: 10,
427
+ periodSeconds: 10,
428
+ },
429
+ name: "api",
430
+ ports: [{ containerPort: 8080, protocol: "TCP" }],
431
+ volumeMounts: [
432
+ {
433
+ mountPath: "/var/run/secrets/kubernetes.io/serviceaccount",
434
+ name: "kube-api-access-x7k2q",
435
+ readOnly: true,
436
+ },
437
+ ],
438
+ },
439
+ {
440
+ args: [
441
+ "--requirepass",
442
+ credentials.redisPassArg,
443
+ "--appendonly",
444
+ "yes",
445
+ ],
446
+ command: ["redis-server"],
447
+ image: "redis:7.2.4",
448
+ name: "cache",
449
+ },
450
+ ],
451
+ serviceAccountName: "default",
452
+ tolerations: [
453
+ {
454
+ effect: "NoExecute",
455
+ key: "node.kubernetes.io/not-ready",
456
+ operator: "Exists",
457
+ tolerationSeconds: 300,
458
+ },
459
+ ],
460
+ volumes: [
461
+ {
462
+ name: "kube-api-access-x7k2q",
463
+ projected: {
464
+ defaultMode: 420,
465
+ sources: [
466
+ {
467
+ serviceAccountToken: { expirationSeconds: 3607, path: "token" },
468
+ },
469
+ {
470
+ configMap: {
471
+ items: [{ key: "ca.crt", path: "ca.crt" }],
472
+ name: "kube-root-ca.crt",
473
+ },
474
+ },
475
+ ],
476
+ },
477
+ },
478
+ {
479
+ name: "db-creds",
480
+ secret: { defaultMode: 420, secretName: "db-creds" },
481
+ },
482
+ ],
483
+ },
484
+ status: {
485
+ containerStatuses: [
486
+ {
487
+ containerID:
488
+ "containerd://3f5a9c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a",
489
+ image: "ghcr.io/acme/api:2.14.1",
490
+ imageID:
491
+ "ghcr.io/acme/api@sha256:9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d4f6a8c0e1a3b5d7f9b2d",
492
+ lastState: {},
493
+ name: "api",
494
+ ready: true,
495
+ restartCount: 0,
496
+ started: true,
497
+ state: { running: { startedAt: "2026-09-22T10:00:05Z" } },
498
+ },
499
+ ],
500
+ hostIP: "10.0.1.23",
501
+ phase: "Running",
502
+ podIP: "10.0.1.57",
503
+ podIPs: [{ ip: "10.0.1.57" }],
504
+ qosClass: "BestEffort",
505
+ startTime: "2026-09-22T10:00:00Z",
506
+ },
507
+ };
508
+ }
509
+
510
+ /*
511
+ * `kubectl describe configmap app-config`, in the layout kubectl's
512
+ * describeConfigMap writes: "KEY:", "----", the value verbatim, a blank
513
+ * line; then "BinaryData" / "====".
514
+ */
515
+ const DESCRIBE_CONFIGMAP: string = lines(
516
+ "Name: app-config",
517
+ "Namespace: prod",
518
+ "Labels: app=api",
519
+ "Annotations: <none>",
520
+ "",
521
+ "Data",
522
+ "====",
523
+ "DB_PASSWORD:",
524
+ "----",
525
+ "hunter2",
526
+ "",
527
+ "LOG_LEVEL:",
528
+ "----",
529
+ "debug",
530
+ "",
531
+ "api_token:",
532
+ "----",
533
+ "tok-abc-123",
534
+ "",
535
+ "app.properties:",
536
+ "----",
537
+ "server.port=8080",
538
+ "db.user=app",
539
+ "db.password=propPw77",
540
+ "",
541
+ "tls.key:",
542
+ "----",
543
+ "-----BEGIN EC PRIVATE KEY-----",
544
+ "MHcCAQEEIA",
545
+ "",
546
+ "MHcCAQEEIB",
547
+ "-----END EC PRIVATE KEY-----",
548
+ "",
549
+ "SMTP_PASS:",
550
+ "----",
551
+ "smtpPw-771",
552
+ "",
553
+ "",
554
+ "BinaryData",
555
+ "====",
556
+ "",
557
+ "Events: <none>",
558
+ );
559
+
560
+ // `kubectl logs` of an app that writes structured JSON next to plain lines.
561
+ const JSON_LOGS: string = lines(
562
+ "2026-09-22T10:00:00.000Z INFO server listening on :8080",
563
+ '{"level":"info","ts":"2026-09-22T10:00:00.120Z","msg":"starting","version":"2.14.1","pod":"api-7d9f4c8b5d-x2k9q"}',
564
+ '{"level":"debug","ts":"2026-09-22T10:00:00.130Z","msg":"db config","host":"postgres.prod.svc","user":"app","password":"hunter2-jsonlog","token":"tok-jsonlog-123","timeout":"30s"}',
565
+ '{"level": "debug", "msg": "smtp config", "SMTP_PASS": "smtp-spaced-1", "port": 587}',
566
+ '{"level":"info","msg":"request","method":"GET","path":"/healthz","status":200,"duration_ms":3,"trace_id":"4bf92f3577b34da6a3ce929d0e0e4736"}',
567
+ '{"level":"warn","msg":"retrying with body={\\"password\\":\\"hunter2-esc\\",\\"user\\":\\"bob\\"}"}',
568
+ '{"level":"info","msg":"loaded config\\npassword: hunter2-nl\\nuser: bob"}',
569
+ '{"level":"error","msg":"auth failed","error":"invalid credentials","attempt":3}',
570
+ '{"level":"info","msg":"session","api_key":12345678,"mfa":true}',
571
+ );
572
+
573
+ describe("KubectlOutputRedactor", () => {
574
+ describe("Secret data blocks", () => {
575
+ const secretYaml: string = lines(
576
+ "apiVersion: v1",
577
+ "data:",
578
+ ` DB_PASSWORD: ${PASSWORD_B64}`,
579
+ ` username: ${ADMIN_B64}`,
580
+ " tls.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQo=",
581
+ "kind: Secret",
582
+ "metadata:",
583
+ " annotations:",
584
+ " kubectl.kubernetes.io/last-applied-configuration: |",
585
+ ` {"apiVersion":"v1","data":{"DB_PASSWORD":"${PASSWORD_B64}"},"kind":"Secret","metadata":{"name":"db"}}`,
586
+ " name: db",
587
+ " namespace: prod",
588
+ "type: Opaque",
589
+ );
590
+
591
+ it("masks every value of a Secret's data block and keeps the keys", () => {
592
+ const result: KubectlOutputRedaction = redact(secretYaml);
593
+
594
+ expect(result.text).not.toContain(PASSWORD_B64);
595
+ expect(result.text).not.toContain(ADMIN_B64);
596
+ expect(result.text).not.toContain("LS0tLS1CRUdJTi");
597
+ expect(result.text).toContain(
598
+ ` DB_PASSWORD: ${KUBECTL_REDACTED_MARKER}`,
599
+ );
600
+ expect(result.text).toContain(` username: ${KUBECTL_REDACTED_MARKER}`);
601
+ expect(result.text).toContain(` tls.key: ${KUBECTL_REDACTED_MARKER}`);
602
+ // Structure the model needs stays readable.
603
+ expect(result.text).toContain("kind: Secret");
604
+ expect(result.text).toContain(" name: db");
605
+ expect(result.text).toContain(" namespace: prod");
606
+ expect(result.text).toContain("type: Opaque");
607
+ expect(result.redactionCount).toBeGreaterThanOrEqual(4);
608
+ });
609
+
610
+ it("drops the last-applied-configuration annotation, which repeats the whole object", () => {
611
+ const result: KubectlOutputRedaction = redact(secretYaml);
612
+
613
+ expect(result.text).toContain(
614
+ ` kubectl.kubernetes.io/last-applied-configuration: ${KUBECTL_REDACTED_MARKER}`,
615
+ );
616
+ expect(result.text).not.toContain('"apiVersion":"v1"');
617
+ });
618
+
619
+ it("masks stringData too", () => {
620
+ const result: KubectlOutputRedaction = redact(
621
+ lines(
622
+ "apiVersion: v1",
623
+ "kind: Secret",
624
+ "metadata:",
625
+ " name: app",
626
+ "stringData:",
627
+ " api-key: sk-live-1234567890abcdef",
628
+ " config.json: |",
629
+ ' {"endpoint":"https://api.example.com","key":"hunter2"}',
630
+ "type: Opaque",
631
+ ),
632
+ );
633
+
634
+ expect(result.text).not.toContain("sk-live-1234567890abcdef");
635
+ expect(result.text).not.toContain("hunter2");
636
+ expect(result.text).not.toContain("api.example.com");
637
+ expect(result.text).toContain(` api-key: ${KUBECTL_REDACTED_MARKER}`);
638
+ expect(result.text).toContain(
639
+ ` config.json: ${KUBECTL_REDACTED_MARKER}`,
640
+ );
641
+ expect(result.text).toContain("type: Opaque");
642
+ });
643
+
644
+ it("masks every Secret in a kind: List and leaves a ConfigMap item's plain values readable", () => {
645
+ const result: KubectlOutputRedaction = redact(
646
+ lines(
647
+ "apiVersion: v1",
648
+ "items:",
649
+ "- apiVersion: v1",
650
+ " data:",
651
+ ` password: ${PASSWORD_B64}`,
652
+ " kind: Secret",
653
+ " metadata:",
654
+ " name: first",
655
+ "- apiVersion: v1",
656
+ " data:",
657
+ " LOG_LEVEL: debug",
658
+ " DB_PASSWORD: hunter2",
659
+ " kind: ConfigMap",
660
+ " metadata:",
661
+ " name: settings",
662
+ "- apiVersion: v1",
663
+ " data:",
664
+ ` token: ${ADMIN_B64}`,
665
+ " kind: Secret",
666
+ " metadata:",
667
+ " name: second",
668
+ "kind: List",
669
+ ),
670
+ );
671
+
672
+ expect(result.text).not.toContain(PASSWORD_B64);
673
+ expect(result.text).not.toContain(ADMIN_B64);
674
+ expect(result.text).not.toContain("hunter2");
675
+ expect(result.text).toContain(` password: ${KUBECTL_REDACTED_MARKER}`);
676
+ expect(result.text).toContain(` token: ${KUBECTL_REDACTED_MARKER}`);
677
+ expect(result.text).toContain(" LOG_LEVEL: debug");
678
+ expect(result.text).toContain(" name: first");
679
+ expect(result.text).toContain(" name: settings");
680
+ expect(result.text).toContain("kind: List");
681
+ });
682
+
683
+ it("masks a pretty-printed JSON Secret and keeps the document parseable", () => {
684
+ const result: KubectlOutputRedaction = redact(
685
+ lines(
686
+ "{",
687
+ ' "apiVersion": "v1",',
688
+ ' "data": {',
689
+ ` "password": "${PASSWORD_B64}",`,
690
+ ` "username": "${ADMIN_B64}"`,
691
+ " },",
692
+ ' "kind": "Secret",',
693
+ ' "metadata": {',
694
+ ' "name": "db"',
695
+ " },",
696
+ ' "type": "Opaque"',
697
+ "}",
698
+ ),
699
+ );
700
+
701
+ expect(result.text).not.toContain(PASSWORD_B64);
702
+ expect(result.text).not.toContain(ADMIN_B64);
703
+
704
+ const parsed: Record<string, unknown> = JSON.parse(result.text) as Record<
705
+ string,
706
+ unknown
707
+ >;
708
+ expect(parsed["data"]).toEqual({
709
+ password: KUBECTL_REDACTED_MARKER,
710
+ username: KUBECTL_REDACTED_MARKER,
711
+ });
712
+ expect(parsed["kind"]).toBe("Secret");
713
+ expect(parsed["metadata"]).toEqual({ name: "db" });
714
+ expect(parsed["type"]).toBe("Opaque");
715
+ });
716
+
717
+ it("masks a JSON List of Secrets item by item", () => {
718
+ const result: KubectlOutputRedaction = redact(
719
+ lines(
720
+ "{",
721
+ ' "apiVersion": "v1",',
722
+ ' "items": [',
723
+ " {",
724
+ ' "apiVersion": "v1",',
725
+ ' "data": {',
726
+ ` "password": "${PASSWORD_B64}"`,
727
+ " },",
728
+ ' "kind": "Secret",',
729
+ ' "metadata": {',
730
+ ' "name": "first"',
731
+ " }",
732
+ " },",
733
+ " {",
734
+ ' "apiVersion": "v1",',
735
+ ' "data": {',
736
+ ' "LOG_LEVEL": "debug"',
737
+ " },",
738
+ ' "kind": "ConfigMap",',
739
+ ' "metadata": {',
740
+ ' "name": "settings"',
741
+ " }",
742
+ " }",
743
+ " ],",
744
+ ' "kind": "List"',
745
+ "}",
746
+ ),
747
+ );
748
+
749
+ expect(result.text).not.toContain(PASSWORD_B64);
750
+ const parsed: { items: Array<{ data: Record<string, string> }> } =
751
+ JSON.parse(result.text) as {
752
+ items: Array<{ data: Record<string, string> }>;
753
+ };
754
+ expect(parsed.items[0]!.data).toEqual({
755
+ password: KUBECTL_REDACTED_MARKER,
756
+ });
757
+ expect(parsed.items[1]!.data).toEqual({ LOG_LEVEL: "debug" });
758
+ });
759
+
760
+ it("fails closed: a data block whose kind was truncated away is masked like a Secret", () => {
761
+ const result: KubectlOutputRedaction = redact(
762
+ lines(
763
+ "apiVersion: v1",
764
+ "data:",
765
+ " LOG_LEVEL: debug",
766
+ ` something: ${ADMIN_B64}`,
767
+ " plain: hello",
768
+ ),
769
+ );
770
+
771
+ expect(result.text).toContain(` LOG_LEVEL: ${KUBECTL_REDACTED_MARKER}`);
772
+ expect(result.text).toContain(` something: ${KUBECTL_REDACTED_MARKER}`);
773
+ expect(result.text).toContain(` plain: ${KUBECTL_REDACTED_MARKER}`);
774
+ expect(result.text).not.toContain("hello");
775
+ });
776
+
777
+ it("stops at the end of a YAML document so a following object is not mistaken for the kind", () => {
778
+ const result: KubectlOutputRedaction = redact(
779
+ lines(
780
+ "apiVersion: v1",
781
+ "data:",
782
+ " LOG_LEVEL: debug",
783
+ "---",
784
+ "apiVersion: v1",
785
+ "kind: ConfigMap",
786
+ ),
787
+ );
788
+
789
+ // No kind in the first document: fail closed.
790
+ expect(result.text).toContain(` LOG_LEVEL: ${KUBECTL_REDACTED_MARKER}`);
791
+ expect(result.text).toContain("kind: ConfigMap");
792
+ });
793
+
794
+ it("leaves an empty data mapping alone", () => {
795
+ const yaml: string = lines(
796
+ "apiVersion: v1",
797
+ "data: {}",
798
+ "kind: Secret",
799
+ "metadata:",
800
+ " name: empty",
801
+ );
802
+ expect(redact(yaml).text).toBe(yaml);
803
+ expect(redact(yaml).redactionCount).toBe(0);
804
+ });
805
+ });
806
+
807
+ describe("ConfigMap data blocks", () => {
808
+ const configMapYaml: string = lines(
809
+ "apiVersion: v1",
810
+ "data:",
811
+ " LOG_LEVEL: debug",
812
+ " DATABASE_URL: postgres://app:hunter2@db.prod.svc:5432/app",
813
+ " API_TOKEN: abcdef123456",
814
+ " app.yaml: |",
815
+ " server:",
816
+ " port: 8080",
817
+ " database:",
818
+ " host: db",
819
+ " password: hunter2",
820
+ " tls:",
821
+ " key: |",
822
+ " -----BEGIN RSA PRIVATE KEY-----",
823
+ " MIIEowIBAAKCAQEA",
824
+ " -----END RSA PRIVATE KEY-----",
825
+ "kind: ConfigMap",
826
+ "metadata:",
827
+ " name: settings",
828
+ );
829
+
830
+ it("keeps plain configuration readable", () => {
831
+ const result: KubectlOutputRedaction = redact(configMapYaml);
832
+
833
+ expect(result.text).toContain(" LOG_LEVEL: debug");
834
+ expect(result.text).toContain(" server:");
835
+ expect(result.text).toContain(" port: 8080");
836
+ expect(result.text).toContain(" host: db");
837
+ expect(result.text).toContain("kind: ConfigMap");
838
+ });
839
+
840
+ it("masks credential-like keys, URL passwords and private keys nested in a config file", () => {
841
+ const result: KubectlOutputRedaction = redact(configMapYaml);
842
+
843
+ expect(result.text).toContain(` API_TOKEN: ${KUBECTL_REDACTED_MARKER}`);
844
+ expect(result.text).toContain(
845
+ ` DATABASE_URL: postgres://app:${KUBECTL_REDACTED_MARKER}@db.prod.svc:5432/app`,
846
+ );
847
+ expect(result.text).toContain(
848
+ ` password: ${KUBECTL_REDACTED_MARKER}`,
849
+ );
850
+ expect(result.text).not.toContain("hunter2");
851
+ expect(result.text).not.toContain("MIIEowIBAAKCAQEA");
852
+ expect(result.text).not.toContain("BEGIN RSA PRIVATE KEY");
853
+ });
854
+ });
855
+
856
+ describe("container env entries", () => {
857
+ const podYaml: string = lines(
858
+ "apiVersion: v1",
859
+ "kind: Pod",
860
+ "metadata:",
861
+ " name: web-1",
862
+ "spec:",
863
+ " containers:",
864
+ " - name: auth-service",
865
+ " image: registry.example.com/auth:1.2.3",
866
+ " env:",
867
+ " - name: DB_HOST",
868
+ " value: postgres",
869
+ " - name: DB_PASSWORD",
870
+ " value: s3cr3t-value",
871
+ " - name: API_TOKEN",
872
+ " valueFrom:",
873
+ " secretKeyRef:",
874
+ " key: token",
875
+ " name: api-secret",
876
+ " - value: sk-live-abc",
877
+ " name: STRIPE_KEY",
878
+ " - name: AWS_ACCESS_KEY_ID",
879
+ " value: AKIAIOSFODNN7EXAMPLE",
880
+ " - name: KEYCLOAK_URL",
881
+ " value: https://sso.example.com",
882
+ " livenessProbe:",
883
+ " httpGet:",
884
+ " httpHeaders:",
885
+ " - name: Authorization",
886
+ " value: Bearer live-probe-token-12345",
887
+ " path: /healthz",
888
+ " serviceAccountName: default",
889
+ " automountServiceAccountToken: false",
890
+ " tolerations:",
891
+ " - effect: NoSchedule",
892
+ " key: node-role.kubernetes.io/control-plane",
893
+ " volumes:",
894
+ " - name: certs",
895
+ " secret:",
896
+ " secretName: tls-cert",
897
+ );
898
+
899
+ it("masks the value of credential-like env names and keeps the others", () => {
900
+ const result: KubectlOutputRedaction = redact(podYaml);
901
+
902
+ expect(result.text).toContain(" - name: DB_HOST");
903
+ expect(result.text).toContain(" value: postgres");
904
+ expect(result.text).toContain(" - name: DB_PASSWORD");
905
+ expect(result.text).toContain(` value: ${KUBECTL_REDACTED_MARKER}`);
906
+ expect(result.text).not.toContain("s3cr3t-value");
907
+ expect(result.text).not.toContain("AKIAIOSFODNN7EXAMPLE");
908
+ expect(result.text).toContain(" value: https://sso.example.com");
909
+ });
910
+
911
+ it("handles an entry whose value precedes its name", () => {
912
+ const result: KubectlOutputRedaction = redact(podYaml);
913
+
914
+ expect(result.text).toContain(` - value: ${KUBECTL_REDACTED_MARKER}`);
915
+ expect(result.text).toContain(" name: STRIPE_KEY");
916
+ expect(result.text).not.toContain("sk-live-abc");
917
+ });
918
+
919
+ it("keeps valueFrom references, the container name and the secret references a pod needs", () => {
920
+ const result: KubectlOutputRedaction = redact(podYaml);
921
+
922
+ expect(result.text).toContain(" - name: API_TOKEN");
923
+ expect(result.text).toContain(" valueFrom:");
924
+ expect(result.text).toContain(" name: api-secret");
925
+ expect(result.text).toContain(" - name: auth-service");
926
+ expect(result.text).toContain(
927
+ " image: registry.example.com/auth:1.2.3",
928
+ );
929
+ expect(result.text).toContain(" secretName: tls-cert");
930
+ expect(result.text).toContain(" automountServiceAccountToken: false");
931
+ expect(result.text).toContain(
932
+ " key: node-role.kubernetes.io/control-plane",
933
+ );
934
+ });
935
+
936
+ it("masks a credential-like probe header value", () => {
937
+ const result: KubectlOutputRedaction = redact(podYaml);
938
+
939
+ expect(result.text).toContain(" - name: Authorization");
940
+ expect(result.text).not.toContain("live-probe-token-12345");
941
+ expect(result.text).toContain(" path: /healthz");
942
+ });
943
+
944
+ it("masks env values in pretty-printed JSON and keeps the document parseable", () => {
945
+ const result: KubectlOutputRedaction = redact(
946
+ lines(
947
+ "{",
948
+ ' "spec": {',
949
+ ' "containers": [',
950
+ " {",
951
+ ' "env": [',
952
+ " {",
953
+ ' "name": "DB_HOST",',
954
+ ' "value": "postgres"',
955
+ " },",
956
+ " {",
957
+ ' "name": "DB_PASSWORD",',
958
+ ' "value": "s3cr3t"',
959
+ " },",
960
+ " {",
961
+ ' "value": "sk-live",',
962
+ ' "name": "STRIPE_KEY"',
963
+ " }",
964
+ " ],",
965
+ ' "name": "web"',
966
+ " }",
967
+ " ]",
968
+ " }",
969
+ "}",
970
+ ),
971
+ );
972
+
973
+ const parsed: {
974
+ spec: {
975
+ containers: Array<{ env: Array<{ name: string; value: string }> }>;
976
+ };
977
+ } = JSON.parse(result.text) as {
978
+ spec: {
979
+ containers: Array<{ env: Array<{ name: string; value: string }> }>;
980
+ };
981
+ };
982
+ expect(parsed.spec.containers[0]!.env).toEqual([
983
+ { name: "DB_HOST", value: "postgres" },
984
+ { name: "DB_PASSWORD", value: KUBECTL_REDACTED_MARKER },
985
+ { value: KUBECTL_REDACTED_MARKER, name: "STRIPE_KEY" },
986
+ ]);
987
+ });
988
+
989
+ it("does not let one entry's value bleed into the next entry", () => {
990
+ const result: KubectlOutputRedaction = redact(
991
+ lines(
992
+ " env:",
993
+ " - name: DB_PASSWORD",
994
+ " valueFrom:",
995
+ " secretKeyRef:",
996
+ " name: db",
997
+ " key: password",
998
+ " - name: DB_HOST",
999
+ " value: postgres",
1000
+ ),
1001
+ );
1002
+
1003
+ expect(result.text).toContain(" value: postgres");
1004
+ });
1005
+
1006
+ it("masks describe output's Environment section by env name", () => {
1007
+ const result: KubectlOutputRedaction = redact(
1008
+ lines(
1009
+ " Environment:",
1010
+ " DB_PASSWORD: s3cr3t",
1011
+ " DB_HOST: postgres",
1012
+ " API_TOKEN: <set to the key 'token' in secret 'api-secret'> Optional: false",
1013
+ " Mounts:",
1014
+ " /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-x7k2q (ro)",
1015
+ ),
1016
+ );
1017
+
1018
+ expect(result.text).toContain(
1019
+ ` DB_PASSWORD: ${KUBECTL_REDACTED_MARKER}`,
1020
+ );
1021
+ expect(result.text).toContain(" DB_HOST: postgres");
1022
+ expect(result.text).toContain(
1023
+ " API_TOKEN: <set to the key 'token' in secret 'api-secret'> Optional: false",
1024
+ );
1025
+ expect(result.text).toContain(
1026
+ " /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-x7k2q (ro)",
1027
+ );
1028
+ });
1029
+ });
1030
+
1031
+ describe("credential-like keys anywhere", () => {
1032
+ it("masks a ServiceAccount token shown by describe secret", () => {
1033
+ const result: KubectlOutputRedaction = redact(
1034
+ lines(
1035
+ "Name: default-token-x7k2q",
1036
+ "Namespace: default",
1037
+ "Type: kubernetes.io/service-account-token",
1038
+ "",
1039
+ "Data",
1040
+ "====",
1041
+ "ca.crt: 1099 bytes",
1042
+ "namespace: 7 bytes",
1043
+ `token: ${JWT}`,
1044
+ ),
1045
+ );
1046
+
1047
+ expect(result.text).toContain("Name: default-token-x7k2q");
1048
+ expect(result.text).toContain(
1049
+ "Type: kubernetes.io/service-account-token",
1050
+ );
1051
+ expect(result.text).toContain("namespace: 7 bytes");
1052
+ expect(result.text).toContain(`token: ${KUBECTL_REDACTED_MARKER}`);
1053
+ expect(result.text).not.toContain(JWT);
1054
+ });
1055
+
1056
+ it("masks kubeconfig-like material and keeps the cluster address", () => {
1057
+ const result: KubectlOutputRedaction = redact(
1058
+ lines(
1059
+ "clusters:",
1060
+ "- cluster:",
1061
+ " certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM=",
1062
+ " server: https://10.0.0.1:6443",
1063
+ " name: prod",
1064
+ "users:",
1065
+ "- name: admin",
1066
+ " user:",
1067
+ " client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUQ=",
1068
+ " client-key-data: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQo=",
1069
+ " token: bootstrap-abcdef.0123456789abcdef",
1070
+ " password: hunter2",
1071
+ " username: admin",
1072
+ ),
1073
+ );
1074
+
1075
+ expect(result.text).toContain(" server: https://10.0.0.1:6443");
1076
+ expect(result.text).toContain(" name: prod");
1077
+ expect(result.text).toContain("- name: admin");
1078
+ expect(result.text).toContain(" username: admin");
1079
+ expect(result.text).toContain(
1080
+ ` certificate-authority-data: ${KUBECTL_REDACTED_MARKER}`,
1081
+ );
1082
+ expect(result.text).toContain(
1083
+ ` client-certificate-data: ${KUBECTL_REDACTED_MARKER}`,
1084
+ );
1085
+ expect(result.text).toContain(
1086
+ ` client-key-data: ${KUBECTL_REDACTED_MARKER}`,
1087
+ );
1088
+ expect(result.text).toContain(` token: ${KUBECTL_REDACTED_MARKER}`);
1089
+ expect(result.text).toContain(` password: ${KUBECTL_REDACTED_MARKER}`);
1090
+ expect(result.text).not.toContain("LS0tLS1CRUdJTi");
1091
+ expect(result.text).not.toContain("bootstrap-abcdef");
1092
+ expect(result.text).not.toContain("hunter2");
1093
+ });
1094
+
1095
+ it("masks a credential-like block scalar together with its whole body", () => {
1096
+ const result: KubectlOutputRedaction = redact(
1097
+ lines(
1098
+ " tls.key: |",
1099
+ " -----BEGIN EC PRIVATE KEY-----",
1100
+ " MHcCAQEEIA",
1101
+ " -----END EC PRIVATE KEY-----",
1102
+ " next: value",
1103
+ ),
1104
+ );
1105
+
1106
+ expect(result.text).toBe(
1107
+ lines(` tls.key: ${KUBECTL_REDACTED_MARKER}`, " next: value"),
1108
+ );
1109
+ });
1110
+
1111
+ it("masks a credential-like annotation but keeps the pod's other annotations", () => {
1112
+ const result: KubectlOutputRedaction = redact(
1113
+ lines(
1114
+ " annotations:",
1115
+ ' kubectl.kubernetes.io/restartedAt: "2026-09-22T10:00:00Z"',
1116
+ " vault.hashicorp.com/agent-inject-token: abc123",
1117
+ " cert-manager.io/cluster-issuer: letsencrypt",
1118
+ ' prometheus.io/scrape: "true"',
1119
+ ),
1120
+ );
1121
+
1122
+ expect(result.text).toContain(
1123
+ ' kubectl.kubernetes.io/restartedAt: "2026-09-22T10:00:00Z"',
1124
+ );
1125
+ expect(result.text).toContain(
1126
+ ` vault.hashicorp.com/agent-inject-token: ${KUBECTL_REDACTED_MARKER}`,
1127
+ );
1128
+ expect(result.text).toContain(
1129
+ " cert-manager.io/cluster-issuer: letsencrypt",
1130
+ );
1131
+ expect(result.text).toContain(' prometheus.io/scrape: "true"');
1132
+ });
1133
+
1134
+ /*
1135
+ * `host/path:tag` has the shape of an inline pair whose key is
1136
+ * credential-like ("auth", "secret-service"). It is an image reference
1137
+ * and the tag is what the on-call engineer needs most.
1138
+ */
1139
+ it("keeps image references whose path looks credential-like, tag included", () => {
1140
+ const text: string = lines(
1141
+ " Image: registry.example.com/auth:1.2.3",
1142
+ " image: ghcr.io/org/secret-service:2.0",
1143
+ ' "image": "docker.io/vault/token-broker:v3",',
1144
+ " Image ID: registry.example.com/auth@sha256:3f5a9c1e2b4d",
1145
+ 'Normal Pulled Successfully pulled image "ghcr.io/org/secret-service:2.0" in 1.2s',
1146
+ );
1147
+
1148
+ const result: KubectlOutputRedaction = redact(text);
1149
+
1150
+ expect(result.text).toBe(text);
1151
+ expect(result.redactionCount).toBe(0);
1152
+ });
1153
+
1154
+ it("still masks a path-shaped annotation key when describe prints it as a pair", () => {
1155
+ const result: KubectlOutputRedaction = redact(
1156
+ lines(
1157
+ "Annotations: vault.hashicorp.com/agent-inject-token: abc123",
1158
+ " prometheus.io/scrape: true",
1159
+ ),
1160
+ );
1161
+
1162
+ expect(result.text).toContain(
1163
+ `vault.hashicorp.com/agent-inject-token: ${KUBECTL_REDACTED_MARKER}`,
1164
+ );
1165
+ expect(result.text).not.toContain("abc123");
1166
+ expect(result.text).toContain("prometheus.io/scrape: true");
1167
+ });
1168
+
1169
+ it("masks credential-like flags and log pairs in the middle of a line", () => {
1170
+ const result: KubectlOutputRedaction = redact(
1171
+ lines(
1172
+ " Args:",
1173
+ " --token-auth-file=/etc/kubernetes/known_tokens.csv",
1174
+ " --authorization-mode=Node,RBAC",
1175
+ " --feature-gates=RotateKubeletServerCertificate=true",
1176
+ " --kubeconfig=/var/lib/kubelet/kubeconfig",
1177
+ "2026-09-22T10:00:00Z INFO starting with DB_PASSWORD=hunter2 timeout=1s",
1178
+ "2026-09-22T10:00:01Z INFO request x-api-key: abc-123-def op=Exists",
1179
+ ),
1180
+ );
1181
+
1182
+ expect(result.text).toContain(
1183
+ ` --token-auth-file=${KUBECTL_REDACTED_MARKER}`,
1184
+ );
1185
+ expect(result.text).toContain(" --authorization-mode=Node,RBAC");
1186
+ expect(result.text).toContain(
1187
+ " --feature-gates=RotateKubeletServerCertificate=true",
1188
+ );
1189
+ expect(result.text).toContain(
1190
+ " --kubeconfig=/var/lib/kubelet/kubeconfig",
1191
+ );
1192
+ expect(result.text).toContain(
1193
+ `starting with DB_PASSWORD=${KUBECTL_REDACTED_MARKER} timeout=1s`,
1194
+ );
1195
+ expect(result.text).toContain(
1196
+ `request x-api-key: ${KUBECTL_REDACTED_MARKER} op=Exists`,
1197
+ );
1198
+ expect(result.text).not.toContain("hunter2");
1199
+ expect(result.text).not.toContain("abc-123-def");
1200
+ });
1201
+ });
1202
+
1203
+ describe("inline material", () => {
1204
+ it("masks the password in a URL, with or without a user", () => {
1205
+ const result: KubectlOutputRedaction = redact(
1206
+ lines(
1207
+ "postgres://app:hunter2@db:5432/app",
1208
+ "redis://:s3cr3t@cache:6379/0",
1209
+ "https://api.example.com:8443/health",
1210
+ "http://user@host/path",
1211
+ ),
1212
+ );
1213
+
1214
+ expect(result.text).toBe(
1215
+ lines(
1216
+ `postgres://app:${KUBECTL_REDACTED_MARKER}@db:5432/app`,
1217
+ `redis://:${KUBECTL_REDACTED_MARKER}@cache:6379/0`,
1218
+ "https://api.example.com:8443/health",
1219
+ "http://user@host/path",
1220
+ ),
1221
+ );
1222
+ expect(result.redactionCount).toBe(2);
1223
+ });
1224
+
1225
+ it("masks a URL password after any scheme spelling, and leaves a non-scheme alone", () => {
1226
+ const result: KubectlOutputRedaction = redact(
1227
+ lines(
1228
+ "mongodb+srv://app:hunter2@cluster0.example.net/db",
1229
+ "HTTPS://admin:s3cr3t@internal.example.com",
1230
+ "url=(postgres://app:hunter2@db)",
1231
+ "'amqp://guest:guest@rabbit:5672'",
1232
+ "see.postgres://app:hunter2@db and x-redis://:pw@cache",
1233
+ `${"a.".repeat(2000)}postgres://app:hunter2@db`,
1234
+ "1://app:hunter2@db",
1235
+ ),
1236
+ );
1237
+
1238
+ expect(result.text).toBe(
1239
+ lines(
1240
+ `mongodb+srv://app:${MARKER}@cluster0.example.net/db`,
1241
+ `HTTPS://admin:${MARKER}@internal.example.com`,
1242
+ `url=(postgres://app:${MARKER}@db)`,
1243
+ `'amqp://guest:${MARKER}@rabbit:5672'`,
1244
+ `see.postgres://app:${MARKER}@db and x-redis://:${MARKER}@cache`,
1245
+ `${"a.".repeat(2000)}postgres://app:${MARKER}@db`,
1246
+ // A scheme starts with a letter.
1247
+ "1://app:hunter2@db",
1248
+ ),
1249
+ );
1250
+ });
1251
+
1252
+ /*
1253
+ * The URL rule used to start its match at the scheme,
1254
+ * /(\b[a-z][a-z0-9+.-]*:\/\/)…/, which retried from every word boundary
1255
+ * of a long dotted run and backtracked through the whole run each time
1256
+ * (200 KB of "eyJ.eyJ.…" took over 30 seconds). It now starts at "://"
1257
+ * and checks the scheme behind it. This pins that the rewrite masks
1258
+ * exactly what the scheme-first pattern masked, over a seeded corpus of
1259
+ * URL-shaped strings with every awkward neighbour a scheme, a user or a
1260
+ * password can have.
1261
+ */
1262
+ it("masks exactly what the scheme-first URL pattern masked", () => {
1263
+ const schemeFirst: RegExp =
1264
+ /(\b[a-z][a-z0-9+.-]*:\/\/)([^\s/:@"']*):([^\s/@"']+)@/gi;
1265
+ /*
1266
+ * No "=": with it, a password such as "2p1=" is also padded base64,
1267
+ * which another rule masks — this compares the URL rule alone.
1268
+ */
1269
+ const junk: Array<string> = [
1270
+ " ",
1271
+ "x",
1272
+ ".",
1273
+ "-",
1274
+ "+",
1275
+ "_",
1276
+ "1",
1277
+ "(",
1278
+ "'",
1279
+ '"',
1280
+ "/",
1281
+ ":",
1282
+ "@",
1283
+ "A",
1284
+ ];
1285
+ const scheme: Array<string> = [
1286
+ "a",
1287
+ "b",
1288
+ "Z",
1289
+ "1",
1290
+ ".",
1291
+ "-",
1292
+ "+",
1293
+ "_",
1294
+ "p",
1295
+ "g",
1296
+ ];
1297
+ const user: Array<string> = [
1298
+ "u",
1299
+ "1",
1300
+ ".",
1301
+ "-",
1302
+ "_",
1303
+ "%",
1304
+ "@",
1305
+ ":",
1306
+ "/",
1307
+ " ",
1308
+ ];
1309
+ const pass: Array<string> = [
1310
+ "p",
1311
+ "2",
1312
+ ":",
1313
+ "!",
1314
+ "#",
1315
+ "%",
1316
+ ".",
1317
+ "-",
1318
+ "/",
1319
+ "@",
1320
+ " ",
1321
+ "'",
1322
+ ];
1323
+ let state: number = 3953;
1324
+ const random: () => number = (): number => {
1325
+ state = (state * 1103515245 + 12345) & 0x7fffffff;
1326
+ return state / 0x7fffffff;
1327
+ };
1328
+ const word: (alphabet: Array<string>, max: number) => string = (
1329
+ alphabet: Array<string>,
1330
+ max: number,
1331
+ ): string => {
1332
+ let text: string = "";
1333
+ const length: number = Math.floor(random() * (max + 1));
1334
+ for (let i: number = 0; i < length; i++) {
1335
+ text += alphabet[Math.floor(random() * alphabet.length)];
1336
+ }
1337
+ return text;
1338
+ };
1339
+
1340
+ const maskSchemeFirst: (text: string) => string = (
1341
+ text: string,
1342
+ ): string => {
1343
+ return text.replace(
1344
+ schemeFirst,
1345
+ (_match: string, prefix: string, name: string): string => {
1346
+ return `${prefix}${name}:${MARKER}@`;
1347
+ },
1348
+ );
1349
+ };
1350
+
1351
+ let maskedByBoth: number = 0;
1352
+
1353
+ for (let sample: number = 0; sample < 10000; sample++) {
1354
+ const text: string = `${word(junk, 3)}${word(scheme, 5)}://${word(user, 3)}${random() < 0.8 ? ":" : ""}${word(pass, 4)}${random() < 0.8 ? "@" : ""}${word(junk, 3)}`;
1355
+ const expected: string = maskSchemeFirst(text);
1356
+
1357
+ if (expected !== text) {
1358
+ maskedByBoth++;
1359
+ }
1360
+
1361
+ expect({ text, redacted: redact(text).text }).toEqual({
1362
+ text,
1363
+ redacted: expected,
1364
+ });
1365
+ }
1366
+
1367
+ // The corpus is not vacuous: hundreds of samples carry a password.
1368
+ expect(maskedByBoth).toBeGreaterThan(700);
1369
+ });
1370
+
1371
+ it("masks Bearer and Basic authorization tokens but not prose", () => {
1372
+ const result: KubectlOutputRedaction = redact(
1373
+ lines(
1374
+ "curl -H 'Authorization: Bearer abcdefghijklmnop1234567890'",
1375
+ "curl -H 'Authorization: Basic dXNlcjpwYXNz'",
1376
+ "Basic configuration loaded",
1377
+ "Bearer authentication enabled",
1378
+ ),
1379
+ );
1380
+
1381
+ expect(result.text).not.toContain("abcdefghijklmnop1234567890");
1382
+ expect(result.text).not.toContain("dXNlcjpwYXNz");
1383
+ expect(result.text).toContain(
1384
+ `Authorization: ${KUBECTL_REDACTED_MARKER}`,
1385
+ );
1386
+ expect(result.text).toContain("Basic configuration loaded");
1387
+ expect(result.text).toContain("Bearer authentication enabled");
1388
+ });
1389
+
1390
+ it("masks a bearer token that is not at the start of a line", () => {
1391
+ const result: KubectlOutputRedaction = redact(
1392
+ "2026-09-22T10:00:00Z DEBUG outbound header Bearer abcdefghijklmnop1234567890 sent",
1393
+ );
1394
+
1395
+ expect(result.text).toBe(
1396
+ `2026-09-22T10:00:00Z DEBUG outbound header Bearer ${KUBECTL_REDACTED_MARKER} sent`,
1397
+ );
1398
+ });
1399
+
1400
+ it("masks JWTs and PEM private keys, including a key the output truncated", () => {
1401
+ const result: KubectlOutputRedaction = redact(
1402
+ lines(
1403
+ `token=${JWT}`,
1404
+ "-----BEGIN RSA PRIVATE KEY-----",
1405
+ "MIIEowIBAAKCAQEA",
1406
+ "-----END RSA PRIVATE KEY-----",
1407
+ "after the key",
1408
+ "-----BEGIN PRIVATE KEY-----",
1409
+ "MIIEvQIBADANBg",
1410
+ ),
1411
+ );
1412
+
1413
+ expect(result.text).not.toContain(JWT);
1414
+ expect(result.text).not.toContain("MIIEowIBAAKCAQEA");
1415
+ expect(result.text).not.toContain("MIIEvQIBADANBg");
1416
+ expect(result.text).toContain("[redacted-private-key]");
1417
+ expect(result.text).toContain("after the key");
1418
+ });
1419
+
1420
+ it("masks padded base64 and long mixed base64 runs but keeps identifiers", () => {
1421
+ const longBase64: string =
1422
+ "QWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUA";
1423
+ const traceId: string = "4bf92f3577b34da6a3ce929d0e0e4736";
1424
+ const result: KubectlOutputRedaction = redact(
1425
+ lines(
1426
+ `value ${PASSWORD_B64} trailing`,
1427
+ `run ${longBase64} trailing`,
1428
+ `traceId=${traceId} pod=web-7d9f4c8b5d-x2k9q`,
1429
+ "containerID: containerd://3f5a9c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a",
1430
+ "image: nginx:1.25.3-alpine",
1431
+ "revision: NetworkPolicyDefaultDeny",
1432
+ ),
1433
+ );
1434
+
1435
+ expect(result.text).not.toContain(PASSWORD_B64);
1436
+ expect(result.text).not.toContain(longBase64);
1437
+ expect(result.text).toContain("[redacted-base64]");
1438
+ expect(result.text).toContain(
1439
+ `traceId=${traceId} pod=web-7d9f4c8b5d-x2k9q`,
1440
+ );
1441
+ expect(result.text).toContain(
1442
+ "containerID: containerd://3f5a9c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a0c1e2b4d6f8a",
1443
+ );
1444
+ expect(result.text).toContain("image: nginx:1.25.3-alpine");
1445
+ expect(result.text).toContain("revision: NetworkPolicyDefaultDeny");
1446
+ });
1447
+
1448
+ it("masks one-line JSON data objects and env pairs as jsonpath and logs print them", () => {
1449
+ const result: KubectlOutputRedaction = redact(
1450
+ lines(
1451
+ `{"apiVersion":"v1","data":{"password":"${PASSWORD_B64}"},"kind":"Secret"}`,
1452
+ '[{"name":"DB_HOST","value":"postgres"},{"name":"DB_PASSWORD","value":"hunter2"},{"value":"sk-live","name":"STRIPE_KEY"}]',
1453
+ `map[password:${PASSWORD_B64} username:${ADMIN_B64}]`,
1454
+ `{\\"data\\":{\\"password\\":\\"${PASSWORD_B64}\\"},\\"kind\\":\\"Secret\\"}`,
1455
+ ),
1456
+ );
1457
+
1458
+ expect(result.text).not.toContain(PASSWORD_B64);
1459
+ expect(result.text).not.toContain(ADMIN_B64);
1460
+ expect(result.text).not.toContain("hunter2");
1461
+ expect(result.text).not.toContain("sk-live");
1462
+ expect(result.text).toContain('"kind":"Secret"');
1463
+ expect(result.text).toContain('{"name":"DB_HOST","value":"postgres"}');
1464
+ expect(result.text).toContain(
1465
+ `{"name":"DB_PASSWORD","value":"${KUBECTL_REDACTED_MARKER}"}`,
1466
+ );
1467
+ expect(result.text).toContain(
1468
+ `{"value":"${KUBECTL_REDACTED_MARKER}","name":"STRIPE_KEY"}`,
1469
+ );
1470
+ expect(result.text).toContain(`map[password:${KUBECTL_REDACTED_MARKER}`);
1471
+ });
1472
+
1473
+ it("masks a one-line data object the output truncated before its closing brace", () => {
1474
+ const result: KubectlOutputRedaction = redact(
1475
+ `{"apiVersion":"v1","data":{"password":"${PASSWORD_B64}","token":"${ADMIN_B64}`,
1476
+ );
1477
+
1478
+ expect(result.text).not.toContain(PASSWORD_B64);
1479
+ expect(result.text).not.toContain(ADMIN_B64);
1480
+ });
1481
+ });
1482
+
1483
+ describe("credential name spellings", () => {
1484
+ it("masks *_PASS, *_PW and *_CREDS env values in describe's Environment section and keeps the keys", () => {
1485
+ const result: KubectlOutputRedaction = redact(
1486
+ lines(
1487
+ " Environment:",
1488
+ " DB_HOST: postgres",
1489
+ " DB_PASS: Hunter2DbPass",
1490
+ " SMTP_PASS: SmtpPw-771",
1491
+ " REDIS_PASS: R3disPw",
1492
+ " RABBITMQ_DEFAULT_PASS: rabbitPw12",
1493
+ " MYSQL_ROOT_PASS: rootPw-445",
1494
+ " LDAP_BIND_PW: ldapPw-9",
1495
+ " DB_CREDS: app:credsPw1",
1496
+ " API_TOKEN: <set to the key 'token' in secret 'api-secret'> Optional: false",
1497
+ ),
1498
+ );
1499
+
1500
+ expect(result.text).toBe(
1501
+ lines(
1502
+ " Environment:",
1503
+ " DB_HOST: postgres",
1504
+ ` DB_PASS: ${MARKER}`,
1505
+ ` SMTP_PASS: ${MARKER}`,
1506
+ ` REDIS_PASS: ${MARKER}`,
1507
+ ` RABBITMQ_DEFAULT_PASS: ${MARKER}`,
1508
+ ` MYSQL_ROOT_PASS: ${MARKER}`,
1509
+ ` LDAP_BIND_PW: ${MARKER}`,
1510
+ ` DB_CREDS: ${MARKER}`,
1511
+ " API_TOKEN: <set to the key 'token' in secret 'api-secret'> Optional: false",
1512
+ ),
1513
+ );
1514
+ expect(result.redactionCount).toBe(7);
1515
+ });
1516
+
1517
+ it("masks *_PASS env values in YAML, with the value after or before the name", () => {
1518
+ const result: KubectlOutputRedaction = redact(
1519
+ lines(
1520
+ " env:",
1521
+ " - name: DB_PASS",
1522
+ " value: hunter2-yaml-pass",
1523
+ " - value: rabbit1",
1524
+ " name: RABBITMQ_DEFAULT_PASS",
1525
+ " - name: LOG_LEVEL",
1526
+ " value: debug",
1527
+ ),
1528
+ );
1529
+
1530
+ expect(result.text).toBe(
1531
+ lines(
1532
+ " env:",
1533
+ " - name: DB_PASS",
1534
+ ` value: ${MARKER}`,
1535
+ ` - value: ${MARKER}`,
1536
+ " name: RABBITMQ_DEFAULT_PASS",
1537
+ " - name: LOG_LEVEL",
1538
+ " value: debug",
1539
+ ),
1540
+ );
1541
+ });
1542
+
1543
+ it("masks *_PASS names in one-line JSON env pairs, log pairs and ConfigMap data", () => {
1544
+ const result: KubectlOutputRedaction = redact(
1545
+ lines(
1546
+ '[{"name":"SMTP_PASS","value":"x1y2"},{"name":"LOG_LEVEL","value":"debug"}]',
1547
+ "2026-09-22T10:00:00Z INFO connecting DB_PASS=log-leak SMTP_PASS=smtp-leak timeout=1s",
1548
+ "apiVersion: v1",
1549
+ "data:",
1550
+ " DB_PASS: cm-leak",
1551
+ " LOG_LEVEL: info",
1552
+ "kind: ConfigMap",
1553
+ ),
1554
+ );
1555
+
1556
+ expect(result.text).toBe(
1557
+ lines(
1558
+ `[{"name":"SMTP_PASS","value":"${MARKER}"},{"name":"LOG_LEVEL","value":"debug"}]`,
1559
+ `2026-09-22T10:00:00Z INFO connecting DB_PASS=${MARKER} SMTP_PASS=${MARKER} timeout=1s`,
1560
+ "apiVersion: v1",
1561
+ "data:",
1562
+ ` DB_PASS: ${MARKER}`,
1563
+ " LOG_LEVEL: info",
1564
+ "kind: ConfigMap",
1565
+ ),
1566
+ );
1567
+ });
1568
+
1569
+ it("masks Redis's requirepass / masterauth and a bare --pass flag", () => {
1570
+ const result: KubectlOutputRedaction = redact(
1571
+ lines(
1572
+ "requirepass: r3dis-conf",
1573
+ "masterauth: m4ster",
1574
+ " --requirepass=R3disPw",
1575
+ " --pass=plainPw1",
1576
+ "dbpass: glued-prefix-1",
1577
+ ),
1578
+ );
1579
+
1580
+ expect(result.text).toBe(
1581
+ lines(
1582
+ `requirepass: ${MARKER}`,
1583
+ `masterauth: ${MARKER}`,
1584
+ ` --requirepass=${MARKER}`,
1585
+ ` --pass=${MARKER}`,
1586
+ `dbpass: ${MARKER}`,
1587
+ ),
1588
+ );
1589
+ });
1590
+
1591
+ /*
1592
+ * "pass" only counts as a whole segment: these are ordinary settings,
1593
+ * test results and ingress annotations, not credentials.
1594
+ */
1595
+ it.each([
1596
+ "bypass: true",
1597
+ "BYPASS_CACHE: true",
1598
+ "compass: north",
1599
+ "surpass: 1",
1600
+ "passthrough: enabled",
1601
+ 'ssl-passthrough: "true"',
1602
+ ' nginx.ingress.kubernetes.io/ssl-passthrough: "true"',
1603
+ "pass-through-mode: on",
1604
+ 'PASS_THROUGH: "1"',
1605
+ "PASSIVE_MODE: true",
1606
+ "MAX_PASSES: 3",
1607
+ "Passed: 3",
1608
+ "passenger_count=4",
1609
+ ])("keeps %s", (text: string) => {
1610
+ const result: KubectlOutputRedaction = redact(text);
1611
+ expect(result.text).toBe(text);
1612
+ expect(result.redactionCount).toBe(0);
1613
+ });
1614
+ });
1615
+
1616
+ describe("credential flags whose value is the next argv element", () => {
1617
+ it("masks the element after a credential flag in a YAML args list and keeps every other element", () => {
1618
+ const yaml: string = lines(
1619
+ " - args:",
1620
+ " - --port",
1621
+ ' - "8080"',
1622
+ " - --db-password",
1623
+ " - Sup3rS3cretPw",
1624
+ " - --log-level",
1625
+ " - debug",
1626
+ " - --api-token",
1627
+ ' - "tok_live_9f8e7d6c5b"',
1628
+ " - --tail",
1629
+ ' - "100"',
1630
+ " - --verbose",
1631
+ " name: api",
1632
+ );
1633
+
1634
+ const result: KubectlOutputRedaction = redact(yaml);
1635
+
1636
+ expect(result.text).toBe(
1637
+ replaceLines(yaml, [
1638
+ [" - Sup3rS3cretPw", ` - ${MARKER}`],
1639
+ [' - "tok_live_9f8e7d6c5b"', ` - "${MARKER}"`],
1640
+ ]),
1641
+ );
1642
+ expect(result.redactionCount).toBe(2);
1643
+ });
1644
+
1645
+ it("keeps a credential flag's next element when it is itself a flag", () => {
1646
+ const yaml: string = lines(
1647
+ " - --db-password",
1648
+ " - --next-flag",
1649
+ " - --password-stdin",
1650
+ " - --username",
1651
+ " - admin",
1652
+ );
1653
+
1654
+ const result: KubectlOutputRedaction = redact(yaml);
1655
+
1656
+ expect(result.text).toBe(yaml);
1657
+ expect(result.redactionCount).toBe(0);
1658
+ });
1659
+
1660
+ it("does not pair a flag with a line of a different list or shape", () => {
1661
+ const yaml: string = lines(
1662
+ " - --db-password",
1663
+ " command:",
1664
+ " - /app/server",
1665
+ " - --api-token",
1666
+ " name: api",
1667
+ " - name: x",
1668
+ " value: y",
1669
+ );
1670
+
1671
+ const result: KubectlOutputRedaction = redact(yaml);
1672
+
1673
+ expect(result.text).toBe(yaml);
1674
+ });
1675
+
1676
+ it("masks describe's one-token-per-line Args block", () => {
1677
+ const describeOutput: string = lines(
1678
+ " Command:",
1679
+ " /app/server",
1680
+ " Args:",
1681
+ " --port",
1682
+ " 8080",
1683
+ " --db-password",
1684
+ " Sup3rS3cretPw",
1685
+ " --api-token",
1686
+ " tok_live_x",
1687
+ " --verbose",
1688
+ " State: Running",
1689
+ );
1690
+
1691
+ const result: KubectlOutputRedaction = redact(describeOutput);
1692
+
1693
+ expect(result.text).toBe(
1694
+ replaceLines(describeOutput, [
1695
+ [" Sup3rS3cretPw", ` ${MARKER}`],
1696
+ [" tok_live_x", ` ${MARKER}`],
1697
+ ]),
1698
+ );
1699
+ });
1700
+
1701
+ it("masks an argument describe prints with ': ' in it, since it follows a credential flag", () => {
1702
+ const result: KubectlOutputRedaction = redact(
1703
+ lines(" Args:", " --db-password", " s3cr3t: with colon"),
1704
+ );
1705
+
1706
+ expect(result.text).toBe(
1707
+ lines(" Args:", " --db-password", ` ${MARKER}`),
1708
+ );
1709
+ });
1710
+
1711
+ it("masks a pretty-printed JSON args array and keeps it parseable", () => {
1712
+ const json: string = JSON.stringify(
1713
+ {
1714
+ args: [
1715
+ "--db-password",
1716
+ "Sup3rS3cretPw",
1717
+ "--port",
1718
+ "8080",
1719
+ "--requirepass",
1720
+ "R3disPw",
1721
+ ],
1722
+ },
1723
+ null,
1724
+ 4,
1725
+ );
1726
+
1727
+ const result: KubectlOutputRedaction = redact(json);
1728
+
1729
+ expect(JSON.parse(result.text)).toEqual({
1730
+ args: [
1731
+ "--db-password",
1732
+ MARKER,
1733
+ "--port",
1734
+ "8080",
1735
+ "--requirepass",
1736
+ MARKER,
1737
+ ],
1738
+ });
1739
+ });
1740
+
1741
+ it("masks a one-line JSON args array — plain, escaped inside a string, and Python-quoted", () => {
1742
+ const result: KubectlOutputRedaction = redact(
1743
+ lines(
1744
+ '["--db-password","Sup3rS3cretPw","--port","8080"] ["--requirepass", "R3disPw", "--appendonly", "yes"]',
1745
+ '{"msg":"container args [\\"--db-password\\",\\"EscPw1\\"]"}',
1746
+ "argv=['--api-token', 'tok_live_py']",
1747
+ ),
1748
+ );
1749
+
1750
+ expect(result.text).toBe(
1751
+ lines(
1752
+ `["--db-password","${MARKER}","--port","8080"] ["--requirepass", "${MARKER}", "--appendonly", "yes"]`,
1753
+ `{"msg":"container args [\\"--db-password\\",\\"${MARKER}\\"]"}`,
1754
+ `argv=['--api-token', '${MARKER}']`,
1755
+ ),
1756
+ );
1757
+ expect(result.redactionCount).toBe(4);
1758
+ });
1759
+
1760
+ it("masks a credential flag's value inside one command line", () => {
1761
+ const result: KubectlOutputRedaction = redact(
1762
+ lines(
1763
+ "redis-server --requirepass R3disPw --appendonly yes",
1764
+ "mysqld --password Hunter2Mysql --port 3306",
1765
+ "influxd -password Infl8x --http-bind-address :8086",
1766
+ 'app --db-password "pass phrase" --verbose',
1767
+ " - redis-server --requirepass R3disPw2 --masterauth M4ster",
1768
+ " Liveness: exec [redis-cli --pass R3disPw3 ping] delay=0s timeout=1s",
1769
+ '{"cmd":"redis-server --requirepass EscR3dis\\"}',
1770
+ ),
1771
+ );
1772
+
1773
+ expect(result.text).toBe(
1774
+ lines(
1775
+ `redis-server --requirepass ${MARKER} --appendonly yes`,
1776
+ `mysqld --password ${MARKER} --port 3306`,
1777
+ `influxd -password ${MARKER} --http-bind-address :8086`,
1778
+ `app --db-password "${MARKER}" --verbose`,
1779
+ ` - redis-server --requirepass ${MARKER} --masterauth ${MARKER}`,
1780
+ ` Liveness: exec [redis-cli --pass ${MARKER} ping] delay=0s timeout=1s`,
1781
+ `{"cmd":"redis-server --requirepass ${MARKER}\\"}`,
1782
+ ),
1783
+ );
1784
+ });
1785
+
1786
+ it.each([
1787
+ [
1788
+ "mysql -h db -uroot -pS3cretPw -e 'select 1'",
1789
+ `mysql -h db -uroot -p${MARKER} -e 'select 1'`,
1790
+ ],
1791
+ [
1792
+ "mysqldump --single-transaction -u app -pDumpPw1 app > /backup/app.sql",
1793
+ `mysqldump --single-transaction -u app -p${MARKER} app > /backup/app.sql`,
1794
+ ],
1795
+ [
1796
+ "/usr/bin/mysqladmin ping -uroot -pRootPw99",
1797
+ `/usr/bin/mysqladmin ping -uroot -p${MARKER}`,
1798
+ ],
1799
+ [
1800
+ "mongosh --host db -u admin -p M0ngoPw --quiet",
1801
+ `mongosh --host db -u admin -p ${MARKER} --quiet`,
1802
+ ],
1803
+ [
1804
+ "sshpass -p SshPw1 scp backup.tgz host:/backups",
1805
+ `sshpass -p ${MARKER} scp backup.tgz host:/backups`,
1806
+ ],
1807
+ [
1808
+ "redis-cli -h cache -p 6379 -a R3disPw ping",
1809
+ `redis-cli -h cache -p 6379 -a ${MARKER} ping`,
1810
+ ],
1811
+ [
1812
+ "sh -c 'mysqladmin ping -uroot -pRootPw99 && echo ok'",
1813
+ `sh -c 'mysqladmin ping -uroot -p${MARKER} && echo ok'`,
1814
+ ],
1815
+ [
1816
+ " Liveness: exec [mysqladmin ping -uroot -pRootPw99] delay=10s timeout=5s period=10s #success=1 #failure=3",
1817
+ ` Liveness: exec [mysqladmin ping -uroot -p${MARKER}] delay=10s timeout=5s period=10s #success=1 #failure=3`,
1818
+ ],
1819
+ [
1820
+ '["mysqladmin","ping","-uroot","-pRootPw99"] ["sshpass","-p","SshPw1","ssh","host"]',
1821
+ `["mysqladmin","ping","-uroot","-p${MARKER}"] ["sshpass","-p","${MARKER}","ssh","host"]`,
1822
+ ],
1823
+ ])(
1824
+ "masks a tool's short password flag where the tool is named: %s",
1825
+ (input: string, expected: string) => {
1826
+ const result: KubectlOutputRedaction = redact(input);
1827
+ expect(result.text).toBe(expected);
1828
+ // One redaction per marker in the expected text.
1829
+ expect(result.redactionCount).toBe(expected.split(MARKER).length - 1);
1830
+ },
1831
+ );
1832
+
1833
+ it("masks a tool's short password flag in a one-element-per-line list that names the tool", () => {
1834
+ const yaml: string = lines(
1835
+ " exec:",
1836
+ " command:",
1837
+ " - mysqladmin",
1838
+ " - ping",
1839
+ " - -uroot",
1840
+ " - -pRootPw99",
1841
+ " Command:",
1842
+ " sshpass",
1843
+ " -p",
1844
+ " SshPw1",
1845
+ " ssh",
1846
+ " host",
1847
+ );
1848
+
1849
+ const result: KubectlOutputRedaction = redact(yaml);
1850
+
1851
+ expect(result.text).toBe(
1852
+ replaceLines(yaml, [
1853
+ [" - -pRootPw99", ` - -p${MARKER}`],
1854
+ [" SshPw1", ` ${MARKER}`],
1855
+ ]),
1856
+ );
1857
+ });
1858
+
1859
+ /*
1860
+ * `-p` is a port, "make parents", "preserve"… for every other tool:
1861
+ * without a password tool named on the line or in the list, it and
1862
+ * its neighbour stay.
1863
+ */
1864
+ it.each([
1865
+ "mkdir -p /data/cache && chown -R 1000 /data",
1866
+ "docker run -p 8080:80 nginx:1.25",
1867
+ "ssh -p 2222 deploy@bastion",
1868
+ "psql -h db -p 5432 -U app -d orders",
1869
+ "redis-cli -h cache -p 6379 ping",
1870
+ "tar -pxzf backup.tar.gz -C /restore",
1871
+ "cp -p /etc/app/config.yaml /tmp/",
1872
+ "mysql -h db -P 3306 -u app --protocol=tcp orders",
1873
+ "app --port 8080 --tail 100 --log-level debug --feature-gates Foo=true",
1874
+ "Flags: --since 1h --timestamps",
1875
+ lines(" - -p", ' - "8080"'),
1876
+ lines(" - mkdir", " - -p", " - /data"),
1877
+ lines(" Args:", " -p", " 8080"),
1878
+ ])("keeps %s", (text: string) => {
1879
+ const result: KubectlOutputRedaction = redact(text);
1880
+ expect(result.text).toBe(text);
1881
+ expect(result.redactionCount).toBe(0);
1882
+ });
1883
+
1884
+ /*
1885
+ * The exact shapes the review reproduced: a pod YAML's split args, a
1886
+ * describe Args block, a JSON args array and a describe Environment
1887
+ * `*_PASS` entry all leaked through with a count of 0.
1888
+ */
1889
+ it("leaves none of the reproduced literals and counts each one", () => {
1890
+ const result: KubectlOutputRedaction = redact(
1891
+ lines(
1892
+ " args:",
1893
+ " - --db-password",
1894
+ " - Sup3rS3cretPw",
1895
+ " Args:",
1896
+ " --api-token",
1897
+ " tok_live_x",
1898
+ ' "args": ["--password", "JsonArgPw"],',
1899
+ " Environment:",
1900
+ " DB_PASS: Hunter2",
1901
+ ),
1902
+ );
1903
+
1904
+ for (const literal of [
1905
+ "Sup3rS3cretPw",
1906
+ "tok_live_x",
1907
+ "JsonArgPw",
1908
+ "Hunter2",
1909
+ ]) {
1910
+ expect(result.text).not.toContain(literal);
1911
+ }
1912
+ expect(result.redactionCount).toBe(4);
1913
+ });
1914
+ });
1915
+
1916
+ describe("one-line JSON with credential-like keys", () => {
1917
+ it("masks a jsonpath {.data} ConfigMap map and keeps its other values", () => {
1918
+ const input: string =
1919
+ '{"DB_PASSWORD":"hunter2","LOG_LEVEL":"info","api_key":"k3y-value","secretName":"db-creds","SMTP_PASS":"smtp9"}';
1920
+
1921
+ const result: KubectlOutputRedaction = redact(input);
1922
+
1923
+ expect(result.text).toBe(
1924
+ `{"DB_PASSWORD":"${MARKER}","LOG_LEVEL":"info","api_key":"${MARKER}","secretName":"db-creds","SMTP_PASS":"${MARKER}"}`,
1925
+ );
1926
+ expect(JSON.parse(result.text)).toEqual({
1927
+ DB_PASSWORD: MARKER,
1928
+ LOG_LEVEL: "info",
1929
+ api_key: MARKER,
1930
+ secretName: "db-creds",
1931
+ SMTP_PASS: MARKER,
1932
+ });
1933
+ expect(result.redactionCount).toBe(3);
1934
+ });
1935
+
1936
+ it("masks a credential key and keeps the next one", () => {
1937
+ expect(redact('{"password":"x","LOG_LEVEL":"debug"}').text).toBe(
1938
+ `{"password":"${MARKER}","LOG_LEVEL":"debug"}`,
1939
+ );
1940
+ expect(redact('{"password":"x","token":"y"}').text).toBe(
1941
+ `{"password":"${MARKER}","token":"${MARKER}"}`,
1942
+ );
1943
+ });
1944
+
1945
+ it("masks structured log lines, compact, spaced, escaped and with escaped line breaks, and every JSON line still parses", () => {
1946
+ const result: KubectlOutputRedaction = redact(JSON_LOGS);
1947
+
1948
+ expect(result.text).toBe(
1949
+ replaceLines(JSON_LOGS, [
1950
+ [
1951
+ '{"level":"debug","ts":"2026-09-22T10:00:00.130Z","msg":"db config","host":"postgres.prod.svc","user":"app","password":"hunter2-jsonlog","token":"tok-jsonlog-123","timeout":"30s"}',
1952
+ `{"level":"debug","ts":"2026-09-22T10:00:00.130Z","msg":"db config","host":"postgres.prod.svc","user":"app","password":"${MARKER}","token":"${MARKER}","timeout":"30s"}`,
1953
+ ],
1954
+ [
1955
+ '{"level": "debug", "msg": "smtp config", "SMTP_PASS": "smtp-spaced-1", "port": 587}',
1956
+ `{"level": "debug", "msg": "smtp config", "SMTP_PASS": "${MARKER}", "port": 587}`,
1957
+ ],
1958
+ [
1959
+ '{"level":"warn","msg":"retrying with body={\\"password\\":\\"hunter2-esc\\",\\"user\\":\\"bob\\"}"}',
1960
+ `{"level":"warn","msg":"retrying with body={\\"password\\":\\"${MARKER}\\",\\"user\\":\\"bob\\"}"}`,
1961
+ ],
1962
+ [
1963
+ '{"level":"info","msg":"loaded config\\npassword: hunter2-nl\\nuser: bob"}',
1964
+ `{"level":"info","msg":"loaded config\\npassword: ${MARKER}\\nuser: bob"}`,
1965
+ ],
1966
+ [
1967
+ '{"level":"info","msg":"session","api_key":12345678,"mfa":true}',
1968
+ `{"level":"info","msg":"session","api_key":"${MARKER}","mfa":true}`,
1969
+ ],
1970
+ ]),
1971
+ );
1972
+ expect(result.redactionCount).toBe(6);
1973
+
1974
+ for (const line of result.text.split("\n")) {
1975
+ if (line.startsWith("{")) {
1976
+ expect(() => {
1977
+ return JSON.parse(line);
1978
+ }).not.toThrow();
1979
+ }
1980
+ }
1981
+ });
1982
+
1983
+ it("masks a credential string the output truncated before its closing quote", () => {
1984
+ expect(redact('{"level":"info","password":"hunter').text).toBe(
1985
+ `{"level":"info","password":"${MARKER}`,
1986
+ );
1987
+ });
1988
+
1989
+ it("replaces the last-applied-configuration annotation wholesale in jsonpath {.metadata.annotations}", () => {
1990
+ const result: KubectlOutputRedaction = redact(
1991
+ '{"deployment.kubernetes.io/revision":"3","kubectl.kubernetes.io/last-applied-configuration":"{\\"apiVersion\\":\\"v1\\",\\"data\\":{\\"DB_PASSWORD\\":\\"hunter2\\"},\\"kind\\":\\"ConfigMap\\"}\\n","vault.hashicorp.com/agent-inject-token":"hvs-abc123"}',
1992
+ );
1993
+
1994
+ expect(result.text).toBe(
1995
+ `{"deployment.kubernetes.io/revision":"3","kubectl.kubernetes.io/last-applied-configuration":"${MARKER}","vault.hashicorp.com/agent-inject-token":"${MARKER}"}`,
1996
+ );
1997
+ });
1998
+
1999
+ it("masks jsonpath env and args output", () => {
2000
+ const result: KubectlOutputRedaction = redact(
2001
+ lines(
2002
+ '[{"name":"DB_HOST","value":"postgres.prod.svc"},{"name":"DB_PASS","value":"Hunter2DbPass"},{"name":"DB_PASSWORD","valueFrom":{"secretKeyRef":{"key":"password","name":"db-creds"}}}]',
2003
+ '["--port","8080","--db-password","Sup3rS3cretPw"] ["--requirepass","R3disPw","--appendonly","yes"]',
2004
+ ),
2005
+ );
2006
+
2007
+ expect(result.text).toBe(
2008
+ lines(
2009
+ `[{"name":"DB_HOST","value":"postgres.prod.svc"},{"name":"DB_PASS","value":"${MARKER}"},{"name":"DB_PASSWORD","valueFrom":{"secretKeyRef":{"key":"password","name":"db-creds"}}}]`,
2010
+ `["--port","8080","--db-password","${MARKER}"] ["--requirepass","${MARKER}","--appendonly","yes"]`,
2011
+ ),
2012
+ );
2013
+ });
2014
+
2015
+ it("keeps an escaped closing quote intact when it masks a pair inside an escaped JSON string", () => {
2016
+ const result: KubectlOutputRedaction = redact(
2017
+ '{"msg":"exec {\\"cmd\\":\\"run --password=S3cret\\"}"}',
2018
+ );
2019
+
2020
+ expect(result.text).toBe(
2021
+ `{"msg":"exec {\\"cmd\\":\\"run --password=${MARKER}\\"}"}`,
2022
+ );
2023
+ expect(() => {
2024
+ return JSON.parse(result.text);
2025
+ }).not.toThrow();
2026
+ });
2027
+
2028
+ it.each([
2029
+ '[{"name":"DB_PASSWORD","valueFrom":{"secretKeyRef":{"key":"password","name":"db"}}}]',
2030
+ '{"key":"password","operator":"Exists"}',
2031
+ '{"image":"ghcr.io/org/secret-service:2.0"}',
2032
+ '{"secretName":"db-creds","serviceAccountName":"default","automountServiceAccountToken":false}',
2033
+ '{"level":"info","msg":"auth failed","error":"invalid credentials","attempt":3}',
2034
+ '{"otp_enabled":true,"auth":{"method":"oidc"},"tokens":[]}',
2035
+ '{"kind":"Secret","type":"kubernetes.io/service-account-token","metadata":{"name":"default-token"}}',
2036
+ '[{"name":"DB_PASSWORD","value":""},{"value":"","name":"API_TOKEN"}]',
2037
+ // Prose in an event message, not a JSON pair: a bare word is no JSON value.
2038
+ 'MountVolume.SetUp failed for volume "db-creds" : secret "db-creds" not found',
2039
+ ])("keeps %s byte for byte", (text: string) => {
2040
+ const result: KubectlOutputRedaction = redact(text);
2041
+ expect(result.text).toBe(text);
2042
+ expect(result.redactionCount).toBe(0);
2043
+ });
2044
+ });
2045
+
2046
+ describe("kubectl describe configmap", () => {
2047
+ it("masks a credential-like entry's whole value, blank lines included, and keeps the other entries", () => {
2048
+ const result: KubectlOutputRedaction = redact(DESCRIBE_CONFIGMAP);
2049
+
2050
+ expect(result.text).toBe(
2051
+ lines(
2052
+ "Name: app-config",
2053
+ "Namespace: prod",
2054
+ "Labels: app=api",
2055
+ "Annotations: <none>",
2056
+ "",
2057
+ "Data",
2058
+ "====",
2059
+ "DB_PASSWORD:",
2060
+ "----",
2061
+ MARKER,
2062
+ "",
2063
+ "LOG_LEVEL:",
2064
+ "----",
2065
+ "debug",
2066
+ "",
2067
+ "api_token:",
2068
+ "----",
2069
+ MARKER,
2070
+ "",
2071
+ "app.properties:",
2072
+ "----",
2073
+ "server.port=8080",
2074
+ "db.user=app",
2075
+ `db.password=${MARKER}`,
2076
+ "",
2077
+ "tls.key:",
2078
+ "----",
2079
+ MARKER,
2080
+ "",
2081
+ "SMTP_PASS:",
2082
+ "----",
2083
+ MARKER,
2084
+ "",
2085
+ "",
2086
+ "BinaryData",
2087
+ "====",
2088
+ "",
2089
+ "Events: <none>",
2090
+ ),
2091
+ );
2092
+ expect(result.redactionCount).toBe(5);
2093
+ });
2094
+
2095
+ it("masks the smallest describe entry", () => {
2096
+ expect(redact("DB_PASSWORD:\n----\nvalue\n").text).toBe(
2097
+ `DB_PASSWORD:\n----\n${MARKER}\n`,
2098
+ );
2099
+ });
2100
+
2101
+ it("fails closed: a value the output truncated is masked to the end", () => {
2102
+ expect(
2103
+ redact(lines("Data", "====", "DB_PASSWORD:", "----", "hunt")).text,
2104
+ ).toBe(lines("Data", "====", "DB_PASSWORD:", "----", MARKER));
2105
+ });
2106
+
2107
+ it("fails closed: without the BinaryData heading the last value runs to the end", () => {
2108
+ expect(
2109
+ redact(
2110
+ lines("DB_PASSWORD:", "----", "hunter2", "", "", "Events: <none>"),
2111
+ ).text,
2112
+ ).toBe(lines("DB_PASSWORD:", "----", MARKER));
2113
+ });
2114
+
2115
+ it("does not end a value at a KEY: / ---- pair inside it that no blank line precedes", () => {
2116
+ const result: KubectlOutputRedaction = redact(
2117
+ lines(
2118
+ "notes.creds:",
2119
+ "----",
2120
+ "line one",
2121
+ "LOG_LEVEL:",
2122
+ "----",
2123
+ "hunter2",
2124
+ "",
2125
+ "BinaryData",
2126
+ "====",
2127
+ ),
2128
+ );
2129
+
2130
+ expect(result.text).toBe(
2131
+ lines("notes.creds:", "----", MARKER, "", "BinaryData", "===="),
2132
+ );
2133
+ });
2134
+
2135
+ it.each([
2136
+ lines("LOG_LEVEL:", "----", "debug", ""),
2137
+ lines("some heading", "----", "hunter2"),
2138
+ lines("DB_PASSWORD: <none>", "----", "text"),
2139
+ lines(
2140
+ " Type Reason Age From Message",
2141
+ " ---- ------ --- ---- -------",
2142
+ ),
2143
+ ])("keeps %s", (text: string) => {
2144
+ const result: KubectlOutputRedaction = redact(text);
2145
+ expect(result.text).toBe(text);
2146
+ expect(result.redactionCount).toBe(0);
2147
+ });
2148
+ });
2149
+
2150
+ describe("free-text keys", () => {
2151
+ it("masks a credential pair in text the line parser took for a key", () => {
2152
+ const result: KubectlOutputRedaction = redact(
2153
+ "connecting DB_PASSWORD=hunter2 host: db",
2154
+ );
2155
+
2156
+ expect(result.text).not.toContain("hunter2");
2157
+ expect(result.text).toContain(`DB_PASSWORD=${MARKER}`);
2158
+ });
2159
+
2160
+ it("masks a credential flag in a shell line the parser took for a key", () => {
2161
+ const result: KubectlOutputRedaction = redact(
2162
+ "sh -c redis-server --requirepass R3disPw && echo done: ok",
2163
+ );
2164
+
2165
+ expect(result.text).not.toContain("R3disPw");
2166
+ });
2167
+
2168
+ it("still judges the whole free-text key, so a credential after it is masked", () => {
2169
+ expect(redact("Password for user=bob: hunter2").text).toBe(
2170
+ `Password for user=bob: ${MARKER}`,
2171
+ );
2172
+ });
2173
+ });
2174
+
2175
+ describe("realistic fixtures", () => {
2176
+ it("masks kubectl get deployment -o yaml and leaves every other line byte for byte", () => {
2177
+ const result: KubectlOutputRedaction = redact(DEPLOYMENT_YAML);
2178
+
2179
+ expect(result.text).toBe(
2180
+ replaceLines(DEPLOYMENT_YAML, [
2181
+ [" - Sup3rS3cretPw", ` - ${MARKER}`],
2182
+ [" - tok_live_9f8e7d6c5b", ` - ${MARKER}`],
2183
+ [" value: Hunter2DbPass", ` value: ${MARKER}`],
2184
+ [" value: SmtpPw-771", ` value: ${MARKER}`],
2185
+ [" value: rabbitPw12", ` value: ${MARKER}`],
2186
+ [" - -pRootPw99", ` - -p${MARKER}`],
2187
+ [" - R3disPw", ` - ${MARKER}`],
2188
+ ]),
2189
+ );
2190
+ expect(result.redactionCount).toBe(7);
2191
+ });
2192
+
2193
+ it("masks kubectl describe pod and leaves every other line byte for byte", () => {
2194
+ const result: KubectlOutputRedaction = redact(DESCRIBE_POD);
2195
+
2196
+ expect(result.text).toBe(
2197
+ replaceLines(DESCRIBE_POD, [
2198
+ [" Sup3rS3cretPw", ` ${MARKER}`],
2199
+ [" tok_live_9f8e7d6c5b", ` ${MARKER}`],
2200
+ [
2201
+ " Liveness: exec [mysqladmin ping -uroot -pRootPw99] delay=10s timeout=5s period=10s #success=1 #failure=3",
2202
+ ` Liveness: exec [mysqladmin ping -uroot -p${MARKER}] delay=10s timeout=5s period=10s #success=1 #failure=3`,
2203
+ ],
2204
+ [
2205
+ " DB_PASS: Hunter2DbPass",
2206
+ ` DB_PASS: ${MARKER}`,
2207
+ ],
2208
+ [
2209
+ " SMTP_PASS: SmtpPw-771",
2210
+ ` SMTP_PASS: ${MARKER}`,
2211
+ ],
2212
+ [
2213
+ " RABBITMQ_DEFAULT_PASS: rabbitPw12",
2214
+ ` RABBITMQ_DEFAULT_PASS: ${MARKER}`,
2215
+ ],
2216
+ [" R3disPw", ` ${MARKER}`],
2217
+ ]),
2218
+ );
2219
+ expect(result.redactionCount).toBe(7);
2220
+ });
2221
+
2222
+ it("masks kubectl get pod -o json, pretty-printed as kubectl prints it, and changes nothing else", () => {
2223
+ const result: KubectlOutputRedaction = redact(
2224
+ JSON.stringify(buildPod(REAL_POD_CREDENTIALS), null, 4),
2225
+ );
2226
+
2227
+ for (const literal of POD_SECRETS) {
2228
+ expect(result.text).not.toContain(literal);
2229
+ }
2230
+ expect(JSON.parse(result.text)).toEqual(buildPod(MASKED_POD_CREDENTIALS));
2231
+ });
2232
+
2233
+ it("masks the same pod as one line of JSON and changes nothing else", () => {
2234
+ const result: KubectlOutputRedaction = redact(
2235
+ JSON.stringify(buildPod(REAL_POD_CREDENTIALS)),
2236
+ );
2237
+
2238
+ for (const literal of POD_SECRETS) {
2239
+ expect(result.text).not.toContain(literal);
2240
+ }
2241
+ expect(JSON.parse(result.text)).toEqual(buildPod(MASKED_POD_CREDENTIALS));
2242
+ });
2243
+
2244
+ it("keeps the fixtures unchanged once their credentials are gone", () => {
2245
+ const withoutCredentials: Array<string> = [
2246
+ JSON.stringify(buildPod(MASKED_POD_CREDENTIALS)),
2247
+ JSON.stringify(buildPod(MASKED_POD_CREDENTIALS), null, 4),
2248
+ ];
2249
+
2250
+ for (const text of withoutCredentials) {
2251
+ expect(redact(text).text).toBe(text);
2252
+ expect(redact(text).redactionCount).toBe(0);
2253
+ }
2254
+ });
2255
+
2256
+ it.each([
2257
+ ["deployment YAML", DEPLOYMENT_YAML],
2258
+ ["describe pod", DESCRIBE_POD],
2259
+ ["describe configmap", DESCRIBE_CONFIGMAP],
2260
+ ["JSON logs", JSON_LOGS],
2261
+ ["pod JSON", JSON.stringify(buildPod(REAL_POD_CREDENTIALS), null, 4)],
2262
+ ["one-line pod JSON", JSON.stringify(buildPod(REAL_POD_CREDENTIALS))],
2263
+ ])("is idempotent on the %s fixture", (_name: string, text: string) => {
2264
+ expectIdempotent(text);
2265
+ });
2266
+ });
2267
+
2268
+ describe("ordinary output passes through", () => {
2269
+ const untouched: Array<string> = [
2270
+ lines(
2271
+ "NAME READY STATUS RESTARTS AGE",
2272
+ "web-7d9f4c8b5d-x2k9q 0/1 CrashLoopBackOff 5 12m",
2273
+ "api-6c8b9f7d4-abcde 1/1 Running 0 3d",
2274
+ ),
2275
+ lines(
2276
+ "LAST SEEN TYPE REASON OBJECT MESSAGE",
2277
+ "2m Warning BackOff pod/web-7d9f4c8b5d-x2k9q Back-off restarting failed container web in pod web-7d9f4c8b5d-x2k9q_prod(3f5a9c1e-2b4d-6f8a-0c1e-2b4d6f8a0c1e)",
2278
+ '5m Warning FailedMount pod/web-7d9f4c8b5d-x2k9q MountVolume.SetUp failed for volume "certs" : secret "tls-cert" not found',
2279
+ ),
2280
+ lines(
2281
+ " tolerations:",
2282
+ " - effect: NoExecute",
2283
+ " key: node.kubernetes.io/not-ready",
2284
+ " operator: Exists",
2285
+ " tolerationSeconds: 300",
2286
+ " nodeSelector:",
2287
+ " kubernetes.io/os: linux",
2288
+ " affinity:",
2289
+ " nodeAffinity:",
2290
+ " requiredDuringSchedulingIgnoredDuringExecution:",
2291
+ " nodeSelectorTerms:",
2292
+ " - matchExpressions:",
2293
+ " - key: topology.kubernetes.io/zone",
2294
+ " operator: In",
2295
+ " values:",
2296
+ " - us-east-1a",
2297
+ ),
2298
+ lines(
2299
+ "Name: default",
2300
+ "Namespace: prod",
2301
+ "Image pull secrets: <none>",
2302
+ "Mountable secrets: <none>",
2303
+ "Tokens: <none>",
2304
+ "Events: <none>",
2305
+ ),
2306
+ lines(
2307
+ " volumes:",
2308
+ " - name: kube-api-access-x7k2q",
2309
+ " projected:",
2310
+ " sources:",
2311
+ " - serviceAccountToken:",
2312
+ " expirationSeconds: 3607",
2313
+ " path: token",
2314
+ " - configMap:",
2315
+ " name: kube-root-ca.crt",
2316
+ ),
2317
+ lines(
2318
+ "Liveness: http-get http://:8080/healthz delay=0s timeout=1s period=10s #success=1 #failure=3",
2319
+ "Node-Selectors: kubernetes.io/os=linux",
2320
+ "Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s",
2321
+ ),
2322
+ lines(
2323
+ "Client Version: v1.31.0",
2324
+ "Kustomize Version: v5.4.2",
2325
+ "Server Version: v1.30.4-eks-a737599",
2326
+ ),
2327
+ lines(
2328
+ "NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES",
2329
+ "api-7d9f4c8b5d-x2k9q 1/1 Running 0 3d 10.0.1.57 ip-10-0-1-23.ec2.internal <none> <none>",
2330
+ "cache-0 1/1 Running 2 9d 10.0.1.58 ip-10-0-1-24.ec2.internal <none> <none>",
2331
+ ),
2332
+ lines(
2333
+ "NAME CPU(cores) MEMORY(bytes)",
2334
+ "api-7d9f4c8b5d-x2k9q 12m 184Mi",
2335
+ ),
2336
+ lines(
2337
+ "deployment.apps/api",
2338
+ "REVISION CHANGE-CAUSE",
2339
+ "1 <none>",
2340
+ "2 kubectl set image deployment/api api=ghcr.io/acme/api:2.14.1 --record=true",
2341
+ ),
2342
+ lines(
2343
+ '10.0.1.23 - - [22/Sep/2026:10:00:00 +0000] "GET /api/v1/users?page=2 HTTP/1.1" 200 512 "-" "kube-probe/1.30"',
2344
+ 'level=info ts=2026-09-22T10:00:00.120Z caller=main.go:42 msg="GET /healthz" status=200 duration=3ms trace_id=4bf92f3577b34da6a3ce929d0e0e4736',
2345
+ '{"level":"info","ts":"2026-09-22T10:00:00.120Z","msg":"request","method":"GET","path":"/healthz","status":200,"pod":"api-7d9f4c8b5d-x2k9q","resourceVersion":"48213377"}',
2346
+ "I0922 10:00:00.000000 1 leaderelection.go:250] attempting to acquire leader lease kube-system/kube-controller-manager...",
2347
+ ),
2348
+ "api-7d9f4c8b5d-x2k9q\t48213377\t2026-09-20T08:15:30Z\tghcr.io/acme/api:2.14.1",
2349
+ lines(
2350
+ " containers:",
2351
+ " - args:",
2352
+ " - --port",
2353
+ ' - "8080"',
2354
+ " - --tail",
2355
+ ' - "100"',
2356
+ " - --feature-gates",
2357
+ " - Foo=true",
2358
+ " - --leader-elect",
2359
+ " - --authorization-mode",
2360
+ " - Node,RBAC",
2361
+ " command:",
2362
+ " - /bin/sh",
2363
+ " - -c",
2364
+ " - mkdir -p /data && exec /app/server --port 8080",
2365
+ " image: ghcr.io/acme/api:2.14.1",
2366
+ ),
2367
+ lines(
2368
+ " Command:",
2369
+ " /bin/sh",
2370
+ " -c",
2371
+ " mkdir -p /data && exec /app/server --port 8080",
2372
+ " Args:",
2373
+ " --log-level",
2374
+ " info",
2375
+ " --secure-port",
2376
+ " 10250",
2377
+ " State: Running",
2378
+ ),
2379
+ ];
2380
+
2381
+ it.each(untouched)("leaves %s unchanged", (text: string) => {
2382
+ const result: KubectlOutputRedaction = redact(text);
2383
+ expect(result.text).toBe(text);
2384
+ expect(result.redactionCount).toBe(0);
2385
+ });
2386
+ });
2387
+
2388
+ /*
2389
+ * Pod logs are attacker-influenced text, and the redactor runs on the
2390
+ * server for every kubectl output. Every rule must stay linear on a large
2391
+ * input shaped to make a regex backtrack: ~200 KB of repeated key=value
2392
+ * text, long flag runs, runs of quotes and escaped quotes, deep YAML
2393
+ * indentation, long dotted runs (the URL rule's old worst case, over 30
2394
+ * seconds for "eyJ.eyJ.…") and the like. Each finishes in well under a
2395
+ * second on a laptop; the bound leaves room for a loaded CI runner while
2396
+ * still catching anything quadratic.
2397
+ */
2398
+ describe("linear time on large, adversarial output", () => {
2399
+ const size: number = 200 * 1024;
2400
+ const fill: (unit: string) => string = (unit: string): string => {
2401
+ return unit.repeat(Math.ceil(size / unit.length)).slice(0, size);
2402
+ };
2403
+ const boundMs: number = 3000;
2404
+
2405
+ const adversarial: Array<[string, string]> = [
2406
+ [
2407
+ "repeated key=value lines",
2408
+ fill("password=hunter2 user=admin token=abc123 level=info\n"),
2409
+ ],
2410
+ [
2411
+ "repeated key=value on one line",
2412
+ fill("password=hunter2 user=admin token=abc123 "),
2413
+ ],
2414
+ ["a long run of credential flags", fill("--password ")],
2415
+ ["flags glued with =", fill("--password=--password=")],
2416
+ ["a tool's short password flag, repeated", fill("mysql -p -p ")],
2417
+ ["double quotes", fill('"')],
2418
+ ["single quotes", fill("'")],
2419
+ ["JSON key/value openings", fill('"a":"')],
2420
+ ["escaped quotes", fill('\\"')],
2421
+ [
2422
+ "escaped JSON env pairs",
2423
+ fill('\\"name\\":\\"PASSWORD\\",\\"value\\":\\"'),
2424
+ ],
2425
+ ["JSON env pairs", fill('"name":"PASSWORD","value":"')],
2426
+ ["one-line JSON credentials", `{${fill('"password":"x",')}}`],
2427
+ [
2428
+ "deep YAML indentation",
2429
+ Array.from({ length: 2000 }, (_value: unknown, index: number) => {
2430
+ return `${" ".repeat(index % 400)}password: x`;
2431
+ }).join("\n"),
2432
+ ],
2433
+ [
2434
+ "a deep Secret data block",
2435
+ `kind: Secret\ndata:\n${Array.from(
2436
+ { length: 3000 },
2437
+ (_value: unknown, index: number) => {
2438
+ return `${" ".repeat(2 + (index % 300))}k${index}: dmFsdWU=`;
2439
+ },
2440
+ ).join("\n")}`,
2441
+ ],
2442
+ ["one long word", fill("a")],
2443
+ ["a long base64 run", fill("QUJD")],
2444
+ ["padded base64 words", fill("QUJD=")],
2445
+ ["Bearer, repeated", fill("Bearer ")],
2446
+ ["a long dotted run (JWT-like)", fill("eyJ.")],
2447
+ ["a long dotted run", fill("a.")],
2448
+ ["a long dotted run ending in a URL", `${fill("a.")}://u:p@h`],
2449
+ ["scheme separators", fill("a://")],
2450
+ ["URLs with credentials", fill("https://user:pass@")],
2451
+ ["dashes", fill("-")],
2452
+ ["PEM openings", fill("-----BEGIN ")],
2453
+ ["an env list", fill("- name: API_KEY\n value: abc\n")],
2454
+ ["an args list", fill("- --password\n")],
2455
+ ["escaped line breaks", fill("\\npassword=x")],
2456
+ [
2457
+ "describe's data layout",
2458
+ `Data\n====\n${fill("password:\n----\nvalue\n")}`,
2459
+ ],
2460
+ ["quoted flag pairs", fill('"--password","')],
2461
+ ["keys without a space after the colon", fill("password:x ")],
2462
+ ];
2463
+
2464
+ it.each(adversarial)(
2465
+ "redacts %s in linear time",
2466
+ (_label: string, text: string) => {
2467
+ const started: number = Date.now();
2468
+ const result: KubectlOutputRedaction = redact(text);
2469
+ const elapsedMs: number = Date.now() - started;
2470
+
2471
+ expect(result.text.length).toBeGreaterThan(0);
2472
+ expect(elapsedMs).toBeLessThan(boundMs);
2473
+ },
2474
+ );
2475
+ });
2476
+
2477
+ describe("shape", () => {
2478
+ it("returns empty output for empty input", () => {
2479
+ expect(redact("")).toEqual({ text: "", redactionCount: 0 });
2480
+ });
2481
+
2482
+ it("normalizes CRLF line endings and still finds the structure", () => {
2483
+ const result: KubectlOutputRedaction = redact(
2484
+ `apiVersion: v1\r\ndata:\r\n password: ${PASSWORD_B64}\r\nkind: Secret\r\n`,
2485
+ );
2486
+
2487
+ expect(result.text).toBe(
2488
+ lines(
2489
+ "apiVersion: v1",
2490
+ "data:",
2491
+ ` password: ${KUBECTL_REDACTED_MARKER}`,
2492
+ "kind: Secret",
2493
+ "",
2494
+ ),
2495
+ );
2496
+ });
2497
+
2498
+ it("is deterministic and idempotent", () => {
2499
+ const input: string = lines(
2500
+ "apiVersion: v1",
2501
+ "data:",
2502
+ ` password: ${PASSWORD_B64}`,
2503
+ "kind: Secret",
2504
+ "---",
2505
+ "env:",
2506
+ "- name: API_KEY",
2507
+ " value: abc",
2508
+ `Authorization: Bearer ${JWT}`,
2509
+ );
2510
+
2511
+ const first: KubectlOutputRedaction = redact(input);
2512
+ const second: KubectlOutputRedaction = redact(input);
2513
+ expect(second).toEqual(first);
2514
+ expect(redact(first.text).text).toBe(first.text);
2515
+ });
2516
+
2517
+ it("counts what it masked", () => {
2518
+ const result: KubectlOutputRedaction = redact(
2519
+ lines(
2520
+ "data:",
2521
+ ` a: ${PASSWORD_B64}`,
2522
+ ` b: ${ADMIN_B64}`,
2523
+ "kind: Secret",
2524
+ "password=hunter2",
2525
+ ),
2526
+ );
2527
+
2528
+ expect(result.redactionCount).toBe(3);
2529
+ });
2530
+ });
2531
+ });