@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.
- package/Models/DatabaseModels/DashboardDomain.ts +43 -0
- package/Models/DatabaseModels/MonitorTemplate.ts +15 -3
- package/Models/DatabaseModels/StatusPageDomain.ts +43 -0
- package/Server/API/DashboardDomainAPI.ts +74 -0
- package/Server/API/MicrosoftTeamsAPI.ts +81 -180
- package/Server/API/StatusPageDomainAPI.ts +74 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.ts +43 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.ts +40 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/ProjectAuthorization.ts +6 -1
- package/Server/Services/DashboardDomainService.ts +131 -0
- package/Server/Services/LogPipelineProcessorService.ts +88 -0
- package/Server/Services/MonitorTemplateService.ts +70 -11
- package/Server/Services/StatusPageDomainService.ts +163 -3
- package/Server/Services/StatusPagePrivateUserSessionService.ts +197 -56
- package/Server/Types/Domain.ts +17 -0
- package/Server/Utils/APIKey/AccessPermission.ts +24 -0
- package/Server/Utils/Greenlock/Greenlock.ts +156 -58
- package/Server/Utils/LogPipelineProcessorValidation.ts +112 -0
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.ts +1094 -45
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.ts +153 -17
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +23 -11
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +0 -170
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.ts +158 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +23 -11
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +35 -13
- package/Tests/App/Dashboard/MonitorTemplateColumnAndFacet.test.tsx +505 -0
- package/Tests/App/StatusPage/StatusPageLoginCodeBootstrap.test.ts +106 -0
- package/Tests/App/StatusPage/StatusPageLoginCodeUtil.test.ts +84 -0
- package/Tests/App/StatusPage/StatusPageRedirectSafety.test.ts +119 -0
- package/Tests/Models/MonitorTemplateMonitorNameColumn.test.ts +258 -0
- package/Tests/Server/API/CustomDomainReissueSslAPI.test.ts +469 -0
- package/Tests/Server/API/MicrosoftTeamsBotMessagesEndpoint.test.ts +729 -0
- package/Tests/Server/API/MicrosoftTeamsBotTestEndpoint.test.ts +26 -0
- package/Tests/Server/API/MicrosoftTeamsLegacyWebhookRemoval.test.ts +402 -0
- package/Tests/Server/Middleware/ProjectAuthorizationApiKeyMiddleware.test.ts +4 -0
- package/Tests/Server/Services/AddCertificateReissueRequestedAtToDomainsMigration.test.ts +287 -0
- package/Tests/Server/Services/CustomDomainCertificateReissue.test.ts +477 -0
- package/Tests/Server/Services/LogPipelineProcessorSaveValidation.test.ts +249 -0
- package/Tests/Server/Services/MonitorTemplateServiceBulkSync.test.ts +549 -0
- package/Tests/Server/Services/MonitorTemplateServiceNetworkDeviceSync.test.ts +16 -3
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +57 -0
- package/Tests/Server/Services/SecurityEventLastErrorColumnWidth.test.ts +151 -15
- package/Tests/Server/Services/StatusPagePrivateUserSessionService.test.ts +587 -0
- package/Tests/Server/Types/Database/Permissions/ApiKeyFileAccess.test.ts +286 -0
- package/Tests/Server/Types/Database/Permissions/MonitorTemplateColumnAccess.test.ts +328 -0
- package/Tests/Server/Types/Database/QueryHelperFindWithSameTextAndIsNull.test.ts +83 -0
- package/Tests/Server/Utils/AI/SRE/ConfidenceSignal.test.ts +377 -0
- package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +16 -1
- package/Tests/Server/Utils/Greenlock/CertificateRenewalSchedule.test.ts +250 -0
- package/Tests/Server/Utils/LogPipelineProcessorValidation.test.ts +198 -0
- package/Tests/Server/Utils/SecurityEvent/ConnectorErrorMessage.test.ts +48 -9
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsAuth.test.ts +726 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsClient.test.ts +74 -11
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsErrorHandling.test.ts +1107 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPoller.test.ts +20 -3
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerFailureTaxonomy.test.ts +51 -11
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerHardening.test.ts +1246 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsRequestContract.test.ts +961 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsResponseParsing.test.ts +653 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsActionAuthorization.test.ts +880 -0
- package/Tests/Types/API/HTTPResponse.test.ts +175 -0
- package/Tests/Types/API/Route.test.ts +36 -4
- package/Tests/Types/Database/DatabaseProperty.test.ts +171 -0
- package/Tests/Types/DateLocalShortDateTimeString.test.ts +518 -0
- package/Tests/Types/DateLocalTimeString.test.ts +259 -0
- package/Tests/Types/DateUserPrefers12HourFormat.test.ts +316 -0
- package/Tests/UI/Components/LogsHistogram.test.tsx +41 -2
- package/Tests/UI/Components/LogsViewerEmptyStateTimeRange.test.tsx +212 -0
- package/Tests/UI/Components/TelemetryChartClockFormat.test.tsx +359 -0
- package/Tests/UI/Components/TimeRangePickerClockFormat.test.tsx +422 -0
- package/Tests/UI/Components/TimeRangePickerDropdown.test.tsx +146 -8
- package/Tests/UI/MicrosoftTeams/MicrosoftTeamsMessagingEndpointGuidance.test.tsx +520 -0
- package/Tests/UI/Utils/Navigation.test.ts +82 -0
- package/Tests/Utils/Array.test.ts +100 -0
- package/Tests/Utils/CertificateReissue.test.ts +225 -0
- package/Tests/Utils/Grok/Grok.test.ts +492 -0
- package/Tests/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.test.ts +181 -13
- package/Types/API/Route.ts +20 -5
- package/Types/Date.ts +143 -13
- package/Types/Rum/SessionReplay.ts +62 -1
- package/UI/Components/Date/TimeRangePickerDropdown.tsx +9 -5
- package/UI/Components/LogsViewer/LogsViewer.tsx +12 -7
- package/UI/Components/LogsViewer/components/HistogramTooltip.tsx +18 -17
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +21 -28
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +2 -4
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +2 -4
- package/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.tsx +17 -16
- package/UI/Utils/Navigation.ts +42 -0
- package/Utils/Array.ts +37 -0
- package/Utils/CertificateReissue.ts +128 -0
- package/Utils/Grok/Grok.ts +461 -0
- package/Utils/Grok/GrokPatterns.ts +118 -0
- package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +58 -6
- package/build/dist/Models/DatabaseModels/DashboardDomain.js +44 -0
- package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js +17 -4
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js +44 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
- package/build/dist/Server/API/DashboardDomainAPI.js +43 -1
- package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +74 -118
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js +43 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js +28 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +6 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Services/DashboardDomainService.js +104 -0
- package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
- package/build/dist/Server/Services/LogPipelineProcessorService.js +65 -0
- package/build/dist/Server/Services/LogPipelineProcessorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +57 -11
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +132 -3
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js +112 -32
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js.map +1 -1
- package/build/dist/Server/Types/Domain.js +16 -0
- package/build/dist/Server/Types/Domain.js.map +1 -1
- package/build/dist/Server/Utils/APIKey/AccessPermission.js +24 -0
- package/build/dist/Server/Utils/APIKey/AccessPermission.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +110 -35
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/LogPipelineProcessorValidation.js +77 -0
- package/build/dist/Server/Utils/LogPipelineProcessorValidation.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js +777 -36
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js +108 -17
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +17 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +0 -159
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js +128 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +17 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +25 -13
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/API/Route.js +16 -5
- package/build/dist/Types/API/Route.js.map +1 -1
- package/build/dist/Types/Date.js +115 -13
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Rum/SessionReplay.js +38 -0
- package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js +9 -5
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +12 -7
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js +15 -14
- package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +17 -22
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +2 -4
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +2 -4
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js +15 -14
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +30 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/Utils/Array.js +25 -0
- package/build/dist/Utils/Array.js.map +1 -1
- package/build/dist/Utils/CertificateReissue.js +97 -0
- package/build/dist/Utils/CertificateReissue.js.map +1 -0
- package/build/dist/Utils/Grok/Grok.js +324 -0
- package/build/dist/Utils/Grok/Grok.js.map +1 -0
- package/build/dist/Utils/Grok/GrokPatterns.js +112 -0
- package/build/dist/Utils/Grok/GrokPatterns.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +63 -3
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -1
- package/package.json +1 -1
- package/UI/Utils/JsonWebToken.ts +0 -14
- package/build/dist/UI/Utils/JsonWebToken.js +0 -10
- 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.
|
|
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
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* null while the connector
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|