@oneuptime/common 12.0.28 → 12.0.29

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 (182) hide show
  1. package/Models/DatabaseModels/DashboardDomain.ts +43 -0
  2. package/Models/DatabaseModels/MonitorTemplate.ts +15 -3
  3. package/Models/DatabaseModels/StatusPageDomain.ts +43 -0
  4. package/Server/API/DashboardDomainAPI.ts +74 -0
  5. package/Server/API/MicrosoftTeamsAPI.ts +81 -180
  6. package/Server/API/StatusPageDomainAPI.ts +74 -0
  7. package/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.ts +43 -0
  8. package/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.ts +40 -0
  9. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  10. package/Server/Middleware/ProjectAuthorization.ts +6 -1
  11. package/Server/Services/DashboardDomainService.ts +131 -0
  12. package/Server/Services/LogPipelineProcessorService.ts +88 -0
  13. package/Server/Services/MonitorTemplateService.ts +70 -11
  14. package/Server/Services/StatusPageDomainService.ts +163 -3
  15. package/Server/Services/StatusPagePrivateUserSessionService.ts +197 -56
  16. package/Server/Types/Domain.ts +17 -0
  17. package/Server/Utils/APIKey/AccessPermission.ts +24 -0
  18. package/Server/Utils/Greenlock/Greenlock.ts +156 -58
  19. package/Server/Utils/LogPipelineProcessorValidation.ts +112 -0
  20. package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.ts +1094 -45
  21. package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.ts +153 -17
  22. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +23 -11
  23. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +0 -170
  24. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.ts +158 -0
  25. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +23 -11
  26. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +35 -13
  27. package/Tests/App/Dashboard/MonitorTemplateColumnAndFacet.test.tsx +505 -0
  28. package/Tests/App/StatusPage/StatusPageLoginCodeBootstrap.test.ts +106 -0
  29. package/Tests/App/StatusPage/StatusPageLoginCodeUtil.test.ts +84 -0
  30. package/Tests/App/StatusPage/StatusPageRedirectSafety.test.ts +119 -0
  31. package/Tests/Models/MonitorTemplateMonitorNameColumn.test.ts +258 -0
  32. package/Tests/Server/API/CustomDomainReissueSslAPI.test.ts +469 -0
  33. package/Tests/Server/API/MicrosoftTeamsBotMessagesEndpoint.test.ts +729 -0
  34. package/Tests/Server/API/MicrosoftTeamsBotTestEndpoint.test.ts +26 -0
  35. package/Tests/Server/API/MicrosoftTeamsLegacyWebhookRemoval.test.ts +402 -0
  36. package/Tests/Server/Middleware/ProjectAuthorizationApiKeyMiddleware.test.ts +4 -0
  37. package/Tests/Server/Services/AddCertificateReissueRequestedAtToDomainsMigration.test.ts +287 -0
  38. package/Tests/Server/Services/CustomDomainCertificateReissue.test.ts +477 -0
  39. package/Tests/Server/Services/LogPipelineProcessorSaveValidation.test.ts +249 -0
  40. package/Tests/Server/Services/MonitorTemplateServiceBulkSync.test.ts +549 -0
  41. package/Tests/Server/Services/MonitorTemplateServiceNetworkDeviceSync.test.ts +16 -3
  42. package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +57 -0
  43. package/Tests/Server/Services/SecurityEventLastErrorColumnWidth.test.ts +151 -15
  44. package/Tests/Server/Services/StatusPagePrivateUserSessionService.test.ts +587 -0
  45. package/Tests/Server/Types/Database/Permissions/ApiKeyFileAccess.test.ts +286 -0
  46. package/Tests/Server/Types/Database/Permissions/MonitorTemplateColumnAccess.test.ts +328 -0
  47. package/Tests/Server/Types/Database/QueryHelperFindWithSameTextAndIsNull.test.ts +83 -0
  48. package/Tests/Server/Utils/AI/SRE/ConfidenceSignal.test.ts +377 -0
  49. package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +16 -1
  50. package/Tests/Server/Utils/Greenlock/CertificateRenewalSchedule.test.ts +250 -0
  51. package/Tests/Server/Utils/LogPipelineProcessorValidation.test.ts +198 -0
  52. package/Tests/Server/Utils/SecurityEvent/ConnectorErrorMessage.test.ts +48 -9
  53. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsAuth.test.ts +726 -0
  54. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsClient.test.ts +74 -11
  55. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsErrorHandling.test.ts +1107 -0
  56. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPoller.test.ts +20 -3
  57. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerFailureTaxonomy.test.ts +51 -11
  58. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerHardening.test.ts +1246 -0
  59. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsRequestContract.test.ts +961 -0
  60. package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsResponseParsing.test.ts +653 -0
  61. package/Tests/Server/Utils/Workspace/MicrosoftTeamsActionAuthorization.test.ts +880 -0
  62. package/Tests/Types/API/HTTPResponse.test.ts +175 -0
  63. package/Tests/Types/API/Route.test.ts +36 -4
  64. package/Tests/Types/Database/DatabaseProperty.test.ts +171 -0
  65. package/Tests/Types/DateLocalShortDateTimeString.test.ts +518 -0
  66. package/Tests/Types/DateLocalTimeString.test.ts +259 -0
  67. package/Tests/Types/DateUserPrefers12HourFormat.test.ts +316 -0
  68. package/Tests/UI/Components/LogsHistogram.test.tsx +41 -2
  69. package/Tests/UI/Components/LogsViewerEmptyStateTimeRange.test.tsx +212 -0
  70. package/Tests/UI/Components/TelemetryChartClockFormat.test.tsx +359 -0
  71. package/Tests/UI/Components/TimeRangePickerClockFormat.test.tsx +422 -0
  72. package/Tests/UI/Components/TimeRangePickerDropdown.test.tsx +146 -8
  73. package/Tests/UI/MicrosoftTeams/MicrosoftTeamsMessagingEndpointGuidance.test.tsx +520 -0
  74. package/Tests/UI/Utils/Navigation.test.ts +82 -0
  75. package/Tests/Utils/Array.test.ts +100 -0
  76. package/Tests/Utils/CertificateReissue.test.ts +225 -0
  77. package/Tests/Utils/Grok/Grok.test.ts +492 -0
  78. package/Tests/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.test.ts +181 -13
  79. package/Types/API/Route.ts +20 -5
  80. package/Types/Date.ts +143 -13
  81. package/Types/Rum/SessionReplay.ts +62 -1
  82. package/UI/Components/Date/TimeRangePickerDropdown.tsx +9 -5
  83. package/UI/Components/LogsViewer/LogsViewer.tsx +12 -7
  84. package/UI/Components/LogsViewer/components/HistogramTooltip.tsx +18 -17
  85. package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +21 -28
  86. package/UI/Components/LogsViewer/components/LogsHistogram.tsx +2 -4
  87. package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +2 -4
  88. package/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.tsx +17 -16
  89. package/UI/Utils/Navigation.ts +42 -0
  90. package/Utils/Array.ts +37 -0
  91. package/Utils/CertificateReissue.ts +128 -0
  92. package/Utils/Grok/Grok.ts +461 -0
  93. package/Utils/Grok/GrokPatterns.ts +118 -0
  94. package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +58 -6
  95. package/build/dist/Models/DatabaseModels/DashboardDomain.js +44 -0
  96. package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -1
  97. package/build/dist/Models/DatabaseModels/MonitorTemplate.js +17 -4
  98. package/build/dist/Models/DatabaseModels/MonitorTemplate.js.map +1 -1
  99. package/build/dist/Models/DatabaseModels/StatusPageDomain.js +44 -0
  100. package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
  101. package/build/dist/Server/API/DashboardDomainAPI.js +43 -1
  102. package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
  103. package/build/dist/Server/API/MicrosoftTeamsAPI.js +74 -118
  104. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  105. package/build/dist/Server/API/StatusPageDomainAPI.js +43 -1
  106. package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
  107. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js +34 -0
  108. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js.map +1 -0
  109. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js +28 -0
  110. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js.map +1 -0
  111. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  112. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  113. package/build/dist/Server/Middleware/ProjectAuthorization.js +6 -1
  114. package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
  115. package/build/dist/Server/Services/DashboardDomainService.js +104 -0
  116. package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
  117. package/build/dist/Server/Services/LogPipelineProcessorService.js +65 -0
  118. package/build/dist/Server/Services/LogPipelineProcessorService.js.map +1 -1
  119. package/build/dist/Server/Services/MonitorTemplateService.js +57 -11
  120. package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
  121. package/build/dist/Server/Services/StatusPageDomainService.js +132 -3
  122. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  123. package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js +112 -32
  124. package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js.map +1 -1
  125. package/build/dist/Server/Types/Domain.js +16 -0
  126. package/build/dist/Server/Types/Domain.js.map +1 -1
  127. package/build/dist/Server/Utils/APIKey/AccessPermission.js +24 -0
  128. package/build/dist/Server/Utils/APIKey/AccessPermission.js.map +1 -1
  129. package/build/dist/Server/Utils/Greenlock/Greenlock.js +110 -35
  130. package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
  131. package/build/dist/Server/Utils/LogPipelineProcessorValidation.js +77 -0
  132. package/build/dist/Server/Utils/LogPipelineProcessorValidation.js.map +1 -0
  133. package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js +777 -36
  134. package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js.map +1 -1
  135. package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js +108 -17
  136. package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js.map +1 -1
  137. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +17 -6
  138. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  139. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +0 -159
  140. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
  141. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js +128 -0
  142. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js.map +1 -0
  143. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +17 -6
  144. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  145. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +25 -13
  146. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  147. package/build/dist/Types/API/Route.js +16 -5
  148. package/build/dist/Types/API/Route.js.map +1 -1
  149. package/build/dist/Types/Date.js +115 -13
  150. package/build/dist/Types/Date.js.map +1 -1
  151. package/build/dist/Types/Rum/SessionReplay.js +38 -0
  152. package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
  153. package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js +9 -5
  154. package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js.map +1 -1
  155. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +12 -7
  156. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  157. package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js +15 -14
  158. package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js.map +1 -1
  159. package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +17 -22
  160. package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
  161. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +2 -4
  162. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
  163. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +2 -4
  164. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
  165. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js +15 -14
  166. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js.map +1 -1
  167. package/build/dist/UI/Utils/Navigation.js +30 -0
  168. package/build/dist/UI/Utils/Navigation.js.map +1 -1
  169. package/build/dist/Utils/Array.js +25 -0
  170. package/build/dist/Utils/Array.js.map +1 -1
  171. package/build/dist/Utils/CertificateReissue.js +97 -0
  172. package/build/dist/Utils/CertificateReissue.js.map +1 -0
  173. package/build/dist/Utils/Grok/Grok.js +324 -0
  174. package/build/dist/Utils/Grok/Grok.js.map +1 -0
  175. package/build/dist/Utils/Grok/GrokPatterns.js +112 -0
  176. package/build/dist/Utils/Grok/GrokPatterns.js.map +1 -0
  177. package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +63 -3
  178. package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -1
  179. package/package.json +1 -1
  180. package/UI/Utils/JsonWebToken.ts +0 -14
  181. package/build/dist/UI/Utils/JsonWebToken.js +0 -10
  182. package/build/dist/UI/Utils/JsonWebToken.js.map +0 -1
@@ -0,0 +1,198 @@
1
+ import { validateLogPipelineProcessor } from "../../../Server/Utils/LogPipelineProcessorValidation";
2
+ import BadDataException from "../../../Types/Exception/BadDataException";
3
+ import { JSONObject } from "../../../Types/JSON";
4
+ import LogPipelineProcessorType from "../../../Types/Log/LogPipelineProcessorType";
5
+ import { describe, expect, it } from "@jest/globals";
6
+
7
+ /*
8
+ * Contract under test — the save-time gate on log pipeline processors.
9
+ *
10
+ * A processor that cannot run is invisible: it sits in the pipeline list
11
+ * looking configured while every log flows past it untouched. That is
12
+ * exactly the shape of OneUptime/oneuptime#2515, where GrokParser was a
13
+ * valid processor type with no implementation behind it.
14
+ *
15
+ * The grok pattern is where a typo is easy and silent, so it is compiled
16
+ * here — once per human edit, in front of the only person who can fix
17
+ * it. Everything else is left alone: this gate exists to catch what
18
+ * would otherwise fail quietly, not to re-validate the whole form.
19
+ */
20
+
21
+ function grokProcessor(configuration: JSONObject | string): {
22
+ processorType: string;
23
+ configuration: JSONObject | string;
24
+ } {
25
+ return {
26
+ processorType: LogPipelineProcessorType.GrokParser,
27
+ configuration: configuration,
28
+ };
29
+ }
30
+
31
+ describe("log pipeline processor validation — grok patterns", () => {
32
+ it("accepts a valid pattern", () => {
33
+ expect(() => {
34
+ return validateLogPipelineProcessor(
35
+ grokProcessor({
36
+ source: "body",
37
+ pattern: "%{IPV4:client_ip} %{WORD:verb} %{NUMBER:status:int}",
38
+ }),
39
+ );
40
+ }).not.toThrow();
41
+ });
42
+
43
+ it("accepts a configuration persisted as a JSON string", () => {
44
+ expect(() => {
45
+ return validateLogPipelineProcessor(
46
+ grokProcessor(
47
+ JSON.stringify({ source: "body", pattern: "%{WORD:verb}" }),
48
+ ),
49
+ );
50
+ }).not.toThrow();
51
+ });
52
+
53
+ it("rejects a configuration string that is not JSON", () => {
54
+ expect(() => {
55
+ return validateLogPipelineProcessor(grokProcessor("not json at all"));
56
+ }).toThrow(BadDataException);
57
+ });
58
+
59
+ it("rejects a missing configuration", () => {
60
+ expect(() => {
61
+ return validateLogPipelineProcessor({
62
+ processorType: LogPipelineProcessorType.GrokParser,
63
+ configuration: null,
64
+ });
65
+ }).toThrow(BadDataException);
66
+ });
67
+
68
+ it("rejects a missing or blank pattern", () => {
69
+ for (const pattern of [undefined, "", " "]) {
70
+ expect(() => {
71
+ return validateLogPipelineProcessor(
72
+ grokProcessor({ source: "body", pattern: pattern as string }),
73
+ );
74
+ }).toThrow(BadDataException);
75
+ }
76
+ });
77
+
78
+ it("rejects an unknown pattern name, naming it in the error", () => {
79
+ expect(() => {
80
+ return validateLogPipelineProcessor(
81
+ grokProcessor({ source: "body", pattern: "%{NOSUCHTHING:x}" }),
82
+ );
83
+ }).toThrow('Unknown grok pattern "%{NOSUCHTHING}"');
84
+ });
85
+
86
+ it("rejects a pattern whose regex does not parse", () => {
87
+ expect(() => {
88
+ return validateLogPipelineProcessor(
89
+ grokProcessor({ source: "body", pattern: "%{WORD:verb} ([unclosed" }),
90
+ );
91
+ }).toThrow(BadDataException);
92
+ });
93
+
94
+ it("rejects a field name that could not become an attribute key", () => {
95
+ expect(() => {
96
+ return validateLogPipelineProcessor(
97
+ grokProcessor({ source: "body", pattern: "%{WORD:client ip}" }),
98
+ );
99
+ }).toThrow(BadDataException);
100
+ });
101
+
102
+ it("rejects an unknown capture type", () => {
103
+ expect(() => {
104
+ return validateLogPipelineProcessor(
105
+ grokProcessor({ source: "body", pattern: "%{NUMBER:status:decimal}" }),
106
+ );
107
+ }).toThrow(BadDataException);
108
+ });
109
+ });
110
+
111
+ describe("log pipeline processor validation — target prefix", () => {
112
+ it("accepts prefixes that read like attribute-key namespaces", () => {
113
+ for (const targetPrefix of ["http", "http.", "http_", "_private", "a-b"]) {
114
+ expect(() => {
115
+ return validateLogPipelineProcessor(
116
+ grokProcessor({
117
+ source: "body",
118
+ pattern: "%{WORD:verb}",
119
+ targetPrefix,
120
+ }),
121
+ );
122
+ }).not.toThrow();
123
+ }
124
+ });
125
+
126
+ it("accepts an absent or blank prefix", () => {
127
+ for (const targetPrefix of [undefined, "", " "]) {
128
+ expect(() => {
129
+ return validateLogPipelineProcessor(
130
+ grokProcessor({
131
+ source: "body",
132
+ pattern: "%{WORD:verb}",
133
+ targetPrefix: targetPrefix as string,
134
+ }),
135
+ );
136
+ }).not.toThrow();
137
+ }
138
+ });
139
+
140
+ it("rejects a prefix with characters an attribute key should not carry", () => {
141
+ for (const targetPrefix of ["my prefix", "1http", "http!", "{x}"]) {
142
+ expect(() => {
143
+ return validateLogPipelineProcessor(
144
+ grokProcessor({
145
+ source: "body",
146
+ pattern: "%{WORD:verb}",
147
+ targetPrefix,
148
+ }),
149
+ );
150
+ }).toThrow(BadDataException);
151
+ }
152
+ });
153
+
154
+ it("rejects a non-string prefix or source", () => {
155
+ expect(() => {
156
+ return validateLogPipelineProcessor(
157
+ grokProcessor({
158
+ source: "body",
159
+ pattern: "%{WORD:verb}",
160
+ targetPrefix: 12 as unknown as string,
161
+ } as unknown as JSONObject),
162
+ );
163
+ }).toThrow(BadDataException);
164
+
165
+ expect(() => {
166
+ return validateLogPipelineProcessor(
167
+ grokProcessor({
168
+ source: 12 as unknown as string,
169
+ pattern: "%{WORD:verb}",
170
+ } as unknown as JSONObject),
171
+ );
172
+ }).toThrow(BadDataException);
173
+ });
174
+ });
175
+
176
+ describe("log pipeline processor validation — other processor types", () => {
177
+ /*
178
+ * The other three processor types were shipped without a save-time
179
+ * gate and are not silently broken the way grok was. Adding one for
180
+ * them is a separate decision; this pins that it did not happen by
181
+ * accident here.
182
+ */
183
+ it("leaves non-grok processors alone", () => {
184
+ for (const processorType of [
185
+ LogPipelineProcessorType.AttributeRemapper,
186
+ LogPipelineProcessorType.SeverityRemapper,
187
+ LogPipelineProcessorType.CategoryProcessor,
188
+ "SomethingElse",
189
+ ]) {
190
+ expect(() => {
191
+ return validateLogPipelineProcessor({
192
+ processorType: processorType,
193
+ configuration: { anything: "goes" },
194
+ });
195
+ }).not.toThrow();
196
+ }
197
+ });
198
+ });
@@ -329,10 +329,16 @@ describe("ConnectorErrorMessage.toMessage on the real Google SecOps client error
329
329
  publicKeyEncoding: { type: "spki", format: "pem" },
330
330
  });
331
331
 
332
+ /*
333
+ * A real Google token host, because the client now allowlists token_uri
334
+ * and rejects anything else at construction. Nothing here reaches the
335
+ * network — the fetch is injected — so the host is only ever a string
336
+ * the validator has to accept.
337
+ */
332
338
  const SERVICE_ACCOUNT_JSON: string = JSON.stringify({
333
339
  client_email: "poller@example.iam.gserviceaccount.com",
334
340
  private_key: privateKey,
335
- token_uri: "https://oauth2.example.com/token",
341
+ token_uri: "https://oauth2.googleapis.com/token",
336
342
  });
337
343
 
338
344
  const INSTANCE: string =
@@ -410,14 +416,29 @@ describe("ConnectorErrorMessage.toMessage on the real Google SecOps client error
410
416
  expect(rawMessage.startsWith(prefix)).toBe(true);
411
417
 
412
418
  /*
413
- * The template is a 46-character prefix plus responseText.slice(0, 500).
414
- * 546 > 500, so under the old TableColumnType.LongText declaration
415
- * checkMaxLengthOfFields threw BadDataException on the poller's own
416
- * recovery write which is how lastPolledAt and lastError both stayed
417
- * null while the connector silently stopped polling.
419
+ * The template is a 46-character prefix plus responseText.slice(0, 500),
420
+ * and now an operator hint behind that. 546 was already > 500, so under
421
+ * the old TableColumnType.LongText declaration checkMaxLengthOfFields
422
+ * threw BadDataException on the poller's own recovery write which is
423
+ * how lastPolledAt and lastError both stayed null while the connector
424
+ * silently stopped polling. The hint only makes the overflow worse.
425
+ *
426
+ * Both halves are pinned by content rather than by total length: the
427
+ * echo is exactly the first 500 characters of the body, and the tail is
428
+ * exactly what describeHttpFailure derives for this status and body. A
429
+ * length-only check would go on passing if the echo and the hint ever
430
+ * traded characters with each other.
418
431
  */
432
+ const guidance: string = GoogleSecOpsClient.describeHttpFailure(
433
+ 403,
434
+ HUGE_ERROR_BODY,
435
+ );
436
+
419
437
  expect(prefix.length).toBe(46);
420
- expect(rawMessage.length).toBe(prefix.length + 500);
438
+ expect(guidance.length).toBeGreaterThan(0);
439
+ expect(rawMessage).toBe(
440
+ `${prefix}${HUGE_ERROR_BODY.slice(0, 500)}${guidance}`,
441
+ );
421
442
  expect(rawMessage.length).toBeGreaterThan(OLD_LAST_ERROR_COLUMN_MAX_LENGTH);
422
443
  expect(rawMessage.length).toBeGreaterThan(
423
444
  getMaxLengthFromTableColumnType(TableColumnType.LongText)!,
@@ -428,7 +449,16 @@ describe("ConnectorErrorMessage.toMessage on the real Google SecOps client error
428
449
  expect(stored.length).toBeLessThanOrEqual(
429
450
  MAX_CONNECTOR_ERROR_MESSAGE_LENGTH,
430
451
  );
431
- // 546 fits inside 1000, so the whole diagnostic survives the clamp.
452
+
453
+ /*
454
+ * Prefix + echo + hint still fits inside 1000, so the whole diagnostic
455
+ * survives the clamp. Asserted rather than assumed: if a future hint
456
+ * pushes the worst case past the clamp, the operator starts reading a
457
+ * truncated message and this test should be the thing that says so.
458
+ */
459
+ expect(rawMessage.length).toBeLessThanOrEqual(
460
+ MAX_CONNECTOR_ERROR_MESSAGE_LENGTH,
461
+ );
432
462
  expect(stored).toBe(rawMessage);
433
463
  });
434
464
 
@@ -442,7 +472,16 @@ describe("ConnectorErrorMessage.toMessage on the real Google SecOps client error
442
472
 
443
473
  expect(rawMessage.startsWith(prefix)).toBe(true);
444
474
 
445
- // Same shape as above: prefix + 500 characters of echoed body > 500.
475
+ /*
476
+ * Prefix + 500 characters of echoed body, and nothing behind it. The
477
+ * token exchange deliberately carries no Chronicle hint: every hint
478
+ * describeHttpFailure knows how to give is about the instance resource
479
+ * name, the chronicle.viewer role or the region prefix, none of which
480
+ * explains a refusal from the OAuth token endpoint. Pinned exactly, so
481
+ * that appending guidance here becomes a decision rather than a
482
+ * side effect of editing the alerts path.
483
+ */
484
+ expect(rawMessage).toBe(`${prefix}${HUGE_ERROR_BODY.slice(0, 500)}`);
446
485
  expect(rawMessage.length).toBe(prefix.length + 500);
447
486
  expect(rawMessage.length).toBeGreaterThan(OLD_LAST_ERROR_COLUMN_MAX_LENGTH);
448
487