@oneuptime/common 14.0.97 → 14.0.98
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/CodeRepository.d.mts +3 -0
- package/Models/DatabaseModels/CodeRepository.d.ts +3 -0
- package/Models/DatabaseModels/CodeRepository.js +104 -0
- package/Models/DatabaseModels/Index.js +2 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.d.mts +4 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.d.ts +4 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.js +64 -5
- package/Models/DatabaseModels/SecurityHunt.d.mts +34 -0
- package/Models/DatabaseModels/SecurityHunt.d.ts +34 -0
- package/Models/DatabaseModels/SecurityHunt.js +608 -0
- package/Models/DatabaseModels/SecurityHunt.mjs +2 -0
- package/Types/AI/AIChatTypes.d.mts +1 -0
- package/Types/AI/AIChatTypes.d.ts +1 -0
- package/Types/AI/AIRunEventType.d.mts +1 -0
- package/Types/AI/AIRunEventType.d.ts +1 -0
- package/Types/AI/AIRunEventType.js +8 -0
- package/Types/AI/AiTokenCount.d.mts +22 -1
- package/Types/AI/AiTokenCount.d.ts +22 -1
- package/Types/AI/AiTokenCount.js +126 -57
- package/Types/AI/AiTokenCount.mjs +2 -0
- package/Types/AI/CodeFixTaskContext.d.mts +1 -0
- package/Types/AI/CodeFixTaskContext.d.ts +1 -0
- package/Types/CodeRepository/CodeRepositorySetting.d.mts +1 -0
- package/Types/CodeRepository/CodeRepositorySetting.d.ts +1 -0
- package/Types/CodeRepository/CodeRepositorySetting.js +2 -0
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +2 -0
- package/Types/Link.d.mts +1 -0
- package/Types/Link.d.ts +1 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.d.mts +1 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.d.ts +1 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +9 -0
- package/Types/NotificationSetting/NotificationSettingEventType.d.mts +1 -0
- package/Types/NotificationSetting/NotificationSettingEventType.d.ts +1 -0
- package/Types/NotificationSetting/NotificationSettingEventType.js +6 -0
- package/Types/SecurityCase/SecurityCaseEventEvidence.d.mts +67 -0
- package/Types/SecurityCase/SecurityCaseEventEvidence.d.ts +67 -0
- package/Types/SecurityCase/SecurityCaseEventEvidence.js +271 -0
- package/Types/SecurityCase/SecurityCaseEventEvidence.mjs +13 -0
- package/Types/SecurityCase/SecurityCaseEvidenceKind.d.mts +2 -1
- package/Types/SecurityCase/SecurityCaseEvidenceKind.d.ts +2 -1
- package/Types/SecurityCase/SecurityCaseEvidenceKind.js +11 -1
- package/Types/SecurityEvent/SecurityHunt.d.mts +122 -0
- package/Types/SecurityEvent/SecurityHunt.d.ts +122 -0
- package/Types/SecurityEvent/SecurityHunt.js +391 -0
- package/Types/SecurityEvent/SecurityHunt.mjs +32 -0
- package/Types/Workflow/RunRecord.d.mts +3 -14
- package/Types/Workflow/RunRecord.d.ts +3 -14
- package/Types/Workflow/RunRecord.js +10 -51
- package/Utils/AI/InvestigationLogStall.d.mts +38 -0
- package/Utils/AI/InvestigationLogStall.d.ts +38 -0
- package/Utils/AI/InvestigationLogStall.js +163 -0
- package/Utils/AI/InvestigationLogStall.mjs +11 -0
- package/Utils/Project/RecordNumber.d.mts +43 -0
- package/Utils/Project/RecordNumber.d.ts +43 -0
- package/Utils/Project/RecordNumber.js +151 -0
- package/Utils/Project/RecordNumber.mjs +6 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.mts +9 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.ts +9 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.js +20 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.mjs +2 -0
- package/Utils/SecurityEvent/SecurityEventSearch.d.mts +56 -0
- package/Utils/SecurityEvent/SecurityEventSearch.d.ts +56 -0
- package/Utils/SecurityEvent/SecurityEventSearch.js +422 -0
- package/Utils/SecurityEvent/SecurityEventSearch.mjs +21 -0
- package/Utils/SecurityEvent/SecurityHuntSearch.d.mts +12 -0
- package/Utils/SecurityEvent/SecurityHuntSearch.d.ts +12 -0
- package/Utils/SecurityEvent/SecurityHuntSearch.js +51 -0
- package/Utils/SecurityEvent/SecurityHuntSearch.mjs +3 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.d.mts +9 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.d.ts +9 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.js +69 -1
- package/Utils/Suggestions/TracePerformanceFixSuggestion.mjs +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* SECURITY EVENTS BOOKMARKED ONTO A CASE.
|
|
4
|
+
*
|
|
5
|
+
* A person who finds events that belong to a case - with a hunt, or any
|
|
6
|
+
* search on Security Events > Events - keeps them on the case as evidence
|
|
7
|
+
* (SecurityCaseEvidenceKind.Event). OneUptime reads each event itself, as
|
|
8
|
+
* that person (only an event they can read is kept), and keeps what it read
|
|
9
|
+
* as the event's snapshot: the case still shows the event once the event is
|
|
10
|
+
* past its retention, and what is kept is what OneUptime read, never what a
|
|
11
|
+
* request said it was.
|
|
12
|
+
*
|
|
13
|
+
* Shared by the server, which reads and keeps the events
|
|
14
|
+
* (SecurityCaseEvidenceService.addEvents), and the Dashboard, which asks for
|
|
15
|
+
* it and draws each kept event on the case's Evidence page.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SECURITY_CASE_EVENTS_ADD_REASONS = exports.SECURITY_CASE_EVENT_SNAPSHOT_COLUMNS = exports.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTE_VALUE_MAX_LENGTH = exports.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTES_MAX = exports.SECURITY_CASE_EVENT_SNAPSHOT_LIST_MAX = exports.SECURITY_CASE_EVENT_SNAPSHOT_TEXT_MAX_LENGTH = exports.SECURITY_CASE_EVENT_EVIDENCE_MAX_PER_ADD = void 0;
|
|
19
|
+
exports.readSecurityCaseEventsAddResult = readSecurityCaseEventsAddResult;
|
|
20
|
+
exports.buildSecurityCaseEventSnapshot = buildSecurityCaseEventSnapshot;
|
|
21
|
+
exports.readSecurityCaseEventSnapshot = readSecurityCaseEventSnapshot;
|
|
22
|
+
exports.getSecurityCaseEventEvidenceName = getSecurityCaseEventEvidenceName;
|
|
23
|
+
exports.readSecurityCaseEventReferences = readSecurityCaseEventReferences;
|
|
24
|
+
// The most events one request keeps on a case: a page of a list, ticked.
|
|
25
|
+
exports.SECURITY_CASE_EVENT_EVIDENCE_MAX_PER_ADD = 100;
|
|
26
|
+
/*
|
|
27
|
+
* What a snapshot keeps of an event's longer text: enough to read it on
|
|
28
|
+
* the case. The event's full record is a click away while it is kept.
|
|
29
|
+
*/
|
|
30
|
+
exports.SECURITY_CASE_EVENT_SNAPSHOT_TEXT_MAX_LENGTH = 4000;
|
|
31
|
+
exports.SECURITY_CASE_EVENT_SNAPSHOT_LIST_MAX = 100;
|
|
32
|
+
exports.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTES_MAX = 100;
|
|
33
|
+
exports.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTE_VALUE_MAX_LENGTH = 1000;
|
|
34
|
+
/*
|
|
35
|
+
* The SecurityEvent columns a snapshot is read from: who, what and where,
|
|
36
|
+
* as the event's panel on Events shows them, and its source attributes.
|
|
37
|
+
*/
|
|
38
|
+
exports.SECURITY_CASE_EVENT_SNAPSHOT_COLUMNS = [
|
|
39
|
+
"time",
|
|
40
|
+
"eventUid",
|
|
41
|
+
"primaryEntityId",
|
|
42
|
+
"severityName",
|
|
43
|
+
"className",
|
|
44
|
+
"categoryName",
|
|
45
|
+
"activityName",
|
|
46
|
+
"statusName",
|
|
47
|
+
"message",
|
|
48
|
+
"vendorName",
|
|
49
|
+
"productName",
|
|
50
|
+
"ruleName",
|
|
51
|
+
"principalUser",
|
|
52
|
+
"principalHost",
|
|
53
|
+
"principalIp",
|
|
54
|
+
"targetUser",
|
|
55
|
+
"targetHost",
|
|
56
|
+
"targetIp",
|
|
57
|
+
"targetPort",
|
|
58
|
+
"processName",
|
|
59
|
+
"processCommandLine",
|
|
60
|
+
"observables",
|
|
61
|
+
"mitreTactics",
|
|
62
|
+
"mitreTechniques",
|
|
63
|
+
"attributes",
|
|
64
|
+
];
|
|
65
|
+
// The answer as the Dashboard reads it: each list of event ids, or none.
|
|
66
|
+
function readSecurityCaseEventsAddResult(value) {
|
|
67
|
+
const record = value && typeof value === "object" && !Array.isArray(value)
|
|
68
|
+
? value
|
|
69
|
+
: {};
|
|
70
|
+
const ids = (key) => {
|
|
71
|
+
const list = record[key];
|
|
72
|
+
return Array.isArray(list)
|
|
73
|
+
? list.filter((item) => {
|
|
74
|
+
return typeof item === "string" && item.length > 0;
|
|
75
|
+
})
|
|
76
|
+
: [];
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
added: ids("added"),
|
|
80
|
+
alreadyOnCase: ids("alreadyOnCase"),
|
|
81
|
+
notFound: ids("notFound"),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/*
|
|
85
|
+
* The reasons the answer gives per event, in words the Dashboard's result
|
|
86
|
+
* shows (and translates).
|
|
87
|
+
*/
|
|
88
|
+
exports.SECURITY_CASE_EVENTS_ADD_REASONS = {
|
|
89
|
+
alreadyOnCase: { message: "Already kept on this case." },
|
|
90
|
+
notFound: {
|
|
91
|
+
message: "This event was not found. It may be past its retention, or one you cannot read.",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
/*
|
|
95
|
+
* A value as text, kept to `maxLength`: text, a number or a yes/no as
|
|
96
|
+
* written, and a value of a class of its own (an ObjectID) as it writes
|
|
97
|
+
* itself. Anything else - a list, a plain object - is not text.
|
|
98
|
+
*/
|
|
99
|
+
function readText(value, maxLength) {
|
|
100
|
+
let text = "";
|
|
101
|
+
if (typeof value === "string") {
|
|
102
|
+
text = value;
|
|
103
|
+
}
|
|
104
|
+
else if (typeof value === "number" || typeof value === "boolean") {
|
|
105
|
+
text = String(value);
|
|
106
|
+
}
|
|
107
|
+
else if (value &&
|
|
108
|
+
typeof value === "object" &&
|
|
109
|
+
!Array.isArray(value) &&
|
|
110
|
+
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
111
|
+
text = String(value);
|
|
112
|
+
}
|
|
113
|
+
return text.length > maxLength ? text.substring(0, maxLength) : text;
|
|
114
|
+
}
|
|
115
|
+
function readList(value) {
|
|
116
|
+
if (!Array.isArray(value)) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
const list = [];
|
|
120
|
+
for (const item of value) {
|
|
121
|
+
const text = readText(item, exports.SECURITY_CASE_EVENT_SNAPSHOT_TEXT_MAX_LENGTH);
|
|
122
|
+
if (text && !list.includes(text)) {
|
|
123
|
+
list.push(text);
|
|
124
|
+
}
|
|
125
|
+
if (list.length >= exports.SECURITY_CASE_EVENT_SNAPSHOT_LIST_MAX) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return list;
|
|
130
|
+
}
|
|
131
|
+
function readAttributes(value) {
|
|
132
|
+
const attributes = {};
|
|
133
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
134
|
+
return attributes;
|
|
135
|
+
}
|
|
136
|
+
const keys = Object.keys(value).sort();
|
|
137
|
+
for (const key of keys) {
|
|
138
|
+
if (Object.keys(attributes).length >=
|
|
139
|
+
exports.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTES_MAX) {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
const text = readText(value[key], exports.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTE_VALUE_MAX_LENGTH);
|
|
143
|
+
if (key && text) {
|
|
144
|
+
attributes[key] = text;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return attributes;
|
|
148
|
+
}
|
|
149
|
+
function readTime(value) {
|
|
150
|
+
if (value instanceof Date) {
|
|
151
|
+
return Number.isNaN(value.getTime()) ? "" : value.toISOString();
|
|
152
|
+
}
|
|
153
|
+
if (typeof value === "string" && value) {
|
|
154
|
+
// ClickHouse writes "2026-10-14 13:05:00.123" (UTC) for a DateTime64.
|
|
155
|
+
const date = new Date(value.includes("T") || value.endsWith("Z")
|
|
156
|
+
? value
|
|
157
|
+
: `${value.replace(" ", "T")}Z`);
|
|
158
|
+
return Number.isNaN(date.getTime()) ? "" : date.toISOString();
|
|
159
|
+
}
|
|
160
|
+
return "";
|
|
161
|
+
}
|
|
162
|
+
function readPort(value) {
|
|
163
|
+
const port = Number(value);
|
|
164
|
+
return Number.isInteger(port) && port > 0 && port <= 65535 ? port : null;
|
|
165
|
+
}
|
|
166
|
+
function readHunt(value) {
|
|
167
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
const id = readText(value.id, 100);
|
|
171
|
+
const name = readText(value.name, 100);
|
|
172
|
+
return id && name ? { id, name } : null;
|
|
173
|
+
}
|
|
174
|
+
/*
|
|
175
|
+
* An event, as a snapshot: every column of
|
|
176
|
+
* SECURITY_CASE_EVENT_SNAPSHOT_COLUMNS read from the row OneUptime read
|
|
177
|
+
* (each kept to its limit), and the hunt that found it.
|
|
178
|
+
*/
|
|
179
|
+
function buildSecurityCaseEventSnapshot(data) {
|
|
180
|
+
const row = data.event;
|
|
181
|
+
const text = (column) => {
|
|
182
|
+
return readText(row[column], exports.SECURITY_CASE_EVENT_SNAPSHOT_TEXT_MAX_LENGTH);
|
|
183
|
+
};
|
|
184
|
+
return {
|
|
185
|
+
time: readTime(row["time"]),
|
|
186
|
+
eventUid: text("eventUid"),
|
|
187
|
+
sourceId: text("primaryEntityId"),
|
|
188
|
+
severityName: text("severityName"),
|
|
189
|
+
className: text("className"),
|
|
190
|
+
categoryName: text("categoryName"),
|
|
191
|
+
activityName: text("activityName"),
|
|
192
|
+
statusName: text("statusName"),
|
|
193
|
+
message: text("message"),
|
|
194
|
+
vendorName: text("vendorName"),
|
|
195
|
+
productName: text("productName"),
|
|
196
|
+
ruleName: text("ruleName"),
|
|
197
|
+
principalUser: text("principalUser"),
|
|
198
|
+
principalHost: text("principalHost"),
|
|
199
|
+
principalIp: text("principalIp"),
|
|
200
|
+
targetUser: text("targetUser"),
|
|
201
|
+
targetHost: text("targetHost"),
|
|
202
|
+
targetIp: text("targetIp"),
|
|
203
|
+
targetPort: readPort(row["targetPort"]),
|
|
204
|
+
processName: text("processName"),
|
|
205
|
+
processCommandLine: text("processCommandLine"),
|
|
206
|
+
observables: readList(row["observables"]),
|
|
207
|
+
mitreTactics: readList(row["mitreTactics"]),
|
|
208
|
+
mitreTechniques: readList(row["mitreTechniques"]),
|
|
209
|
+
attributes: readAttributes(row["attributes"]),
|
|
210
|
+
hunt: data.hunt ? readHunt(data.hunt) : null,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/*
|
|
214
|
+
* A kept snapshot, read back for the page: null when the value is not one
|
|
215
|
+
* (a row written by hand, a shape from before). Every field is read as the
|
|
216
|
+
* builder writes it, so a page never trusts a stored value's type.
|
|
217
|
+
*/
|
|
218
|
+
function readSecurityCaseEventSnapshot(value) {
|
|
219
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const record = value;
|
|
223
|
+
const snapshot = buildSecurityCaseEventSnapshot({
|
|
224
|
+
event: Object.assign(Object.assign({}, record), { primaryEntityId: record["sourceId"] }),
|
|
225
|
+
hunt: readHunt(record["hunt"]),
|
|
226
|
+
});
|
|
227
|
+
return snapshot.eventUid || snapshot.time ? snapshot : null;
|
|
228
|
+
}
|
|
229
|
+
/*
|
|
230
|
+
* What a kept event is called on the case: its message, else its class
|
|
231
|
+
* and activity, else what it is.
|
|
232
|
+
*/
|
|
233
|
+
function getSecurityCaseEventEvidenceName(snapshot) {
|
|
234
|
+
const message = snapshot.message.trim();
|
|
235
|
+
if (message) {
|
|
236
|
+
return message.length > 500 ? `${message.substring(0, 499)}…` : message;
|
|
237
|
+
}
|
|
238
|
+
const kind = [snapshot.className, snapshot.activityName]
|
|
239
|
+
.map((part) => {
|
|
240
|
+
return part.trim();
|
|
241
|
+
})
|
|
242
|
+
.filter((part) => {
|
|
243
|
+
return Boolean(part);
|
|
244
|
+
})
|
|
245
|
+
.join(": ");
|
|
246
|
+
return kind || "Security event";
|
|
247
|
+
}
|
|
248
|
+
/*
|
|
249
|
+
* The events a request names, each once (by id), in the order named; any
|
|
250
|
+
* entry without an id or a time it can read is left out.
|
|
251
|
+
*/
|
|
252
|
+
function readSecurityCaseEventReferences(value) {
|
|
253
|
+
if (!Array.isArray(value)) {
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
const references = [];
|
|
257
|
+
const seen = new Set();
|
|
258
|
+
for (const item of value) {
|
|
259
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const eventUid = readText(item.eventUid, 500).trim();
|
|
263
|
+
const time = readTime(item.time);
|
|
264
|
+
if (!eventUid || !time || seen.has(eventUid)) {
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
seen.add(eventUid);
|
|
268
|
+
references.push({ eventUid, time: new Date(time) });
|
|
269
|
+
}
|
|
270
|
+
return references;
|
|
271
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import commonJsModule from "./SecurityCaseEventEvidence.js";
|
|
2
|
+
export const SECURITY_CASE_EVENTS_ADD_REASONS = commonJsModule.SECURITY_CASE_EVENTS_ADD_REASONS;
|
|
3
|
+
export const SECURITY_CASE_EVENT_EVIDENCE_MAX_PER_ADD = commonJsModule.SECURITY_CASE_EVENT_EVIDENCE_MAX_PER_ADD;
|
|
4
|
+
export const SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTES_MAX = commonJsModule.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTES_MAX;
|
|
5
|
+
export const SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTE_VALUE_MAX_LENGTH = commonJsModule.SECURITY_CASE_EVENT_SNAPSHOT_ATTRIBUTE_VALUE_MAX_LENGTH;
|
|
6
|
+
export const SECURITY_CASE_EVENT_SNAPSHOT_COLUMNS = commonJsModule.SECURITY_CASE_EVENT_SNAPSHOT_COLUMNS;
|
|
7
|
+
export const SECURITY_CASE_EVENT_SNAPSHOT_LIST_MAX = commonJsModule.SECURITY_CASE_EVENT_SNAPSHOT_LIST_MAX;
|
|
8
|
+
export const SECURITY_CASE_EVENT_SNAPSHOT_TEXT_MAX_LENGTH = commonJsModule.SECURITY_CASE_EVENT_SNAPSHOT_TEXT_MAX_LENGTH;
|
|
9
|
+
export const buildSecurityCaseEventSnapshot = commonJsModule.buildSecurityCaseEventSnapshot;
|
|
10
|
+
export const getSecurityCaseEventEvidenceName = commonJsModule.getSecurityCaseEventEvidenceName;
|
|
11
|
+
export const readSecurityCaseEventReferences = commonJsModule.readSecurityCaseEventReferences;
|
|
12
|
+
export const readSecurityCaseEventSnapshot = commonJsModule.readSecurityCaseEventSnapshot;
|
|
13
|
+
export const readSecurityCaseEventsAddResult = commonJsModule.readSecurityCaseEventsAddResult;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare enum SecurityCaseEvidenceKind {
|
|
2
2
|
File = "File",
|
|
3
|
-
Link = "Link"
|
|
3
|
+
Link = "Link",
|
|
4
|
+
Event = "Event"
|
|
4
5
|
}
|
|
5
6
|
export declare const SECURITY_CASE_EVIDENCE_KINDS: ReadonlyArray<SecurityCaseEvidenceKind>;
|
|
6
7
|
export declare function isSecurityCaseEvidenceKind(value: unknown): value is SecurityCaseEvidenceKind;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare enum SecurityCaseEvidenceKind {
|
|
2
2
|
File = "File",
|
|
3
|
-
Link = "Link"
|
|
3
|
+
Link = "Link",
|
|
4
|
+
Event = "Event"
|
|
4
5
|
}
|
|
5
6
|
export declare const SECURITY_CASE_EVIDENCE_KINDS: ReadonlyArray<SecurityCaseEvidenceKind>;
|
|
6
7
|
export declare function isSecurityCaseEvidenceKind(value: unknown): value is SecurityCaseEvidenceKind;
|
|
@@ -11,13 +11,23 @@ exports.isSecurityCaseEvidenceKind = isSecurityCaseEvidenceKind;
|
|
|
11
11
|
* that what they download is what was kept.
|
|
12
12
|
* - Link: an address of evidence kept somewhere else - an EDR console's
|
|
13
13
|
* page, a ticket, an object in the team's own evidence store.
|
|
14
|
+
* - Event: a security event bookmarked onto the case from Security
|
|
15
|
+
* Events - one a hunt found, or any the Events explorer lists - kept as
|
|
16
|
+
* OneUptime read it when it was bookmarked
|
|
17
|
+
* (Types/SecurityCase/SecurityCaseEventEvidence), so the case still
|
|
18
|
+
* shows it once the event itself is past its retention.
|
|
14
19
|
*/
|
|
15
20
|
var SecurityCaseEvidenceKind;
|
|
16
21
|
(function (SecurityCaseEvidenceKind) {
|
|
17
22
|
SecurityCaseEvidenceKind["File"] = "File";
|
|
18
23
|
SecurityCaseEvidenceKind["Link"] = "Link";
|
|
24
|
+
SecurityCaseEvidenceKind["Event"] = "Event";
|
|
19
25
|
})(SecurityCaseEvidenceKind || (SecurityCaseEvidenceKind = {}));
|
|
20
|
-
exports.SECURITY_CASE_EVIDENCE_KINDS = [
|
|
26
|
+
exports.SECURITY_CASE_EVIDENCE_KINDS = [
|
|
27
|
+
SecurityCaseEvidenceKind.File,
|
|
28
|
+
SecurityCaseEvidenceKind.Link,
|
|
29
|
+
SecurityCaseEvidenceKind.Event,
|
|
30
|
+
];
|
|
21
31
|
function isSecurityCaseEvidenceKind(value) {
|
|
22
32
|
return exports.SECURITY_CASE_EVIDENCE_KINDS.includes(value);
|
|
23
33
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import TimeRange from "../Time/TimeRange.mjs";
|
|
2
|
+
export declare enum SecurityHuntSchedule {
|
|
3
|
+
NotScheduled = "Not Scheduled",
|
|
4
|
+
EveryHour = "Every Hour",
|
|
5
|
+
EverySixHours = "Every 6 Hours",
|
|
6
|
+
EveryDay = "Every Day",
|
|
7
|
+
EveryWeek = "Every Week"
|
|
8
|
+
}
|
|
9
|
+
export declare const SECURITY_HUNT_SCHEDULES: ReadonlyArray<SecurityHuntSchedule>;
|
|
10
|
+
export declare function isSecurityHuntSchedule(value: unknown): value is SecurityHuntSchedule;
|
|
11
|
+
export declare function getSecurityHuntIntervalInMinutes(schedule: SecurityHuntSchedule | string | undefined | null): number | null;
|
|
12
|
+
export declare function isScheduledSecurityHunt(schedule: SecurityHuntSchedule | string | undefined | null): boolean;
|
|
13
|
+
export declare const SECURITY_HUNT_TIME_RANGES: ReadonlyArray<TimeRange>;
|
|
14
|
+
export declare const DEFAULT_SECURITY_HUNT_TIME_RANGE: TimeRange;
|
|
15
|
+
export declare function isSecurityHuntTimeRange(value: unknown): value is TimeRange;
|
|
16
|
+
export declare function getSecurityHuntTimeRangeForLength(lengthInMinutes: number): TimeRange;
|
|
17
|
+
export type SecurityHuntFilters = {
|
|
18
|
+
[facetKey: string]: Array<string>;
|
|
19
|
+
};
|
|
20
|
+
export declare const SECURITY_HUNT_NAME_MAX_LENGTH: number;
|
|
21
|
+
export declare const SECURITY_HUNT_DESCRIPTION_MAX_LENGTH: number;
|
|
22
|
+
export declare const SECURITY_HUNT_SEARCH_MAX_LENGTH: number;
|
|
23
|
+
export declare const SECURITY_HUNT_FILTER_VALUES_MAX: number;
|
|
24
|
+
export declare const SECURITY_HUNT_FILTER_VALUE_MAX_LENGTH: number;
|
|
25
|
+
export declare const SECURITY_HUNT_RECIPIENTS_MAX: number;
|
|
26
|
+
export declare const SECURITY_HUNTS_PER_PROJECT_MAX: number;
|
|
27
|
+
export declare const SECURITY_HUNT_MESSAGES: {
|
|
28
|
+
enterName: {
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
nameTooLong: {
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
descriptionTooLong: {
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
enterSearch: {
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
searchTooLong: {
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
unknownFilter: {
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
tooManyFilterValues: {
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
filterValueTooLong: {
|
|
50
|
+
message: string;
|
|
51
|
+
};
|
|
52
|
+
unknownSchedule: {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
unknownTimeRange: {
|
|
56
|
+
message: string;
|
|
57
|
+
};
|
|
58
|
+
chooseRecipients: {
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
tooManyRecipients: {
|
|
62
|
+
message: string;
|
|
63
|
+
};
|
|
64
|
+
tooManyHunts: {
|
|
65
|
+
message: string;
|
|
66
|
+
};
|
|
67
|
+
scheduleNeedsPerson: {
|
|
68
|
+
message: string;
|
|
69
|
+
};
|
|
70
|
+
oneHuntAtATime: {
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export type SecurityHuntField = "name" | "description" | "searchQuery";
|
|
75
|
+
export interface SecurityHuntProblem {
|
|
76
|
+
field: SecurityHuntField;
|
|
77
|
+
message: string;
|
|
78
|
+
}
|
|
79
|
+
export declare function getSecurityHuntProblems(data: {
|
|
80
|
+
name?: string | undefined | null;
|
|
81
|
+
description?: string | undefined | null;
|
|
82
|
+
searchQuery?: string | undefined | null;
|
|
83
|
+
filters?: SecurityHuntFilters | undefined | null;
|
|
84
|
+
}): Array<SecurityHuntProblem>;
|
|
85
|
+
export declare function readSecurityHuntFilters(value: unknown): SecurityHuntFilters;
|
|
86
|
+
export declare function countSecurityHuntFilterValues(filters: SecurityHuntFilters | undefined | null): number;
|
|
87
|
+
export declare function securityHuntFiltersToMap(filters: SecurityHuntFilters | undefined | null): Map<string, Set<string>>;
|
|
88
|
+
export declare function securityHuntFiltersFromMap(map: Map<string, Set<string>>): SecurityHuntFilters;
|
|
89
|
+
export declare function areSecurityHuntFiltersEqual(a: SecurityHuntFilters | undefined | null, b: SecurityHuntFilters | undefined | null): boolean;
|
|
90
|
+
export declare const SECURITY_HUNT_RUN_DELAY_IN_SECONDS: number;
|
|
91
|
+
export declare const SECURITY_HUNT_MAX_CATCH_UP_IN_MINUTES: number;
|
|
92
|
+
export declare const SECURITY_HUNT_RETRY_AFTER_FAILURE_IN_MINUTES: number;
|
|
93
|
+
export interface SecurityHuntRunWindow {
|
|
94
|
+
startTime: Date;
|
|
95
|
+
endTime: Date;
|
|
96
|
+
}
|
|
97
|
+
export declare function getSecurityHuntSearchStart(now: Date): Date;
|
|
98
|
+
export declare function getSecurityHuntRunWindow(data: {
|
|
99
|
+
schedule: SecurityHuntSchedule | string | undefined | null;
|
|
100
|
+
searchedUpTo: Date | undefined | null;
|
|
101
|
+
now: Date;
|
|
102
|
+
}): SecurityHuntRunWindow | null;
|
|
103
|
+
export declare function getNextSecurityHuntRunAt(data: {
|
|
104
|
+
schedule: SecurityHuntSchedule | string | undefined | null;
|
|
105
|
+
dueAt: Date | undefined | null;
|
|
106
|
+
now: Date;
|
|
107
|
+
}): Date | null;
|
|
108
|
+
export declare function getSecurityHuntRetryAt(data: {
|
|
109
|
+
schedule: SecurityHuntSchedule | string | undefined | null;
|
|
110
|
+
now: Date;
|
|
111
|
+
}): Date | null;
|
|
112
|
+
export declare const SECURITY_HUNT_RUN_ERRORS: {
|
|
113
|
+
schedulerCannotRead: {
|
|
114
|
+
message: string;
|
|
115
|
+
};
|
|
116
|
+
timedOut: {
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
119
|
+
searchFailed: {
|
|
120
|
+
message: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import TimeRange from "../Time/TimeRange";
|
|
2
|
+
export declare enum SecurityHuntSchedule {
|
|
3
|
+
NotScheduled = "Not Scheduled",
|
|
4
|
+
EveryHour = "Every Hour",
|
|
5
|
+
EverySixHours = "Every 6 Hours",
|
|
6
|
+
EveryDay = "Every Day",
|
|
7
|
+
EveryWeek = "Every Week"
|
|
8
|
+
}
|
|
9
|
+
export declare const SECURITY_HUNT_SCHEDULES: ReadonlyArray<SecurityHuntSchedule>;
|
|
10
|
+
export declare function isSecurityHuntSchedule(value: unknown): value is SecurityHuntSchedule;
|
|
11
|
+
export declare function getSecurityHuntIntervalInMinutes(schedule: SecurityHuntSchedule | string | undefined | null): number | null;
|
|
12
|
+
export declare function isScheduledSecurityHunt(schedule: SecurityHuntSchedule | string | undefined | null): boolean;
|
|
13
|
+
export declare const SECURITY_HUNT_TIME_RANGES: ReadonlyArray<TimeRange>;
|
|
14
|
+
export declare const DEFAULT_SECURITY_HUNT_TIME_RANGE: TimeRange;
|
|
15
|
+
export declare function isSecurityHuntTimeRange(value: unknown): value is TimeRange;
|
|
16
|
+
export declare function getSecurityHuntTimeRangeForLength(lengthInMinutes: number): TimeRange;
|
|
17
|
+
export type SecurityHuntFilters = {
|
|
18
|
+
[facetKey: string]: Array<string>;
|
|
19
|
+
};
|
|
20
|
+
export declare const SECURITY_HUNT_NAME_MAX_LENGTH: number;
|
|
21
|
+
export declare const SECURITY_HUNT_DESCRIPTION_MAX_LENGTH: number;
|
|
22
|
+
export declare const SECURITY_HUNT_SEARCH_MAX_LENGTH: number;
|
|
23
|
+
export declare const SECURITY_HUNT_FILTER_VALUES_MAX: number;
|
|
24
|
+
export declare const SECURITY_HUNT_FILTER_VALUE_MAX_LENGTH: number;
|
|
25
|
+
export declare const SECURITY_HUNT_RECIPIENTS_MAX: number;
|
|
26
|
+
export declare const SECURITY_HUNTS_PER_PROJECT_MAX: number;
|
|
27
|
+
export declare const SECURITY_HUNT_MESSAGES: {
|
|
28
|
+
enterName: {
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
nameTooLong: {
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
descriptionTooLong: {
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
enterSearch: {
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
searchTooLong: {
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
unknownFilter: {
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
tooManyFilterValues: {
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
filterValueTooLong: {
|
|
50
|
+
message: string;
|
|
51
|
+
};
|
|
52
|
+
unknownSchedule: {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
unknownTimeRange: {
|
|
56
|
+
message: string;
|
|
57
|
+
};
|
|
58
|
+
chooseRecipients: {
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
tooManyRecipients: {
|
|
62
|
+
message: string;
|
|
63
|
+
};
|
|
64
|
+
tooManyHunts: {
|
|
65
|
+
message: string;
|
|
66
|
+
};
|
|
67
|
+
scheduleNeedsPerson: {
|
|
68
|
+
message: string;
|
|
69
|
+
};
|
|
70
|
+
oneHuntAtATime: {
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export type SecurityHuntField = "name" | "description" | "searchQuery";
|
|
75
|
+
export interface SecurityHuntProblem {
|
|
76
|
+
field: SecurityHuntField;
|
|
77
|
+
message: string;
|
|
78
|
+
}
|
|
79
|
+
export declare function getSecurityHuntProblems(data: {
|
|
80
|
+
name?: string | undefined | null;
|
|
81
|
+
description?: string | undefined | null;
|
|
82
|
+
searchQuery?: string | undefined | null;
|
|
83
|
+
filters?: SecurityHuntFilters | undefined | null;
|
|
84
|
+
}): Array<SecurityHuntProblem>;
|
|
85
|
+
export declare function readSecurityHuntFilters(value: unknown): SecurityHuntFilters;
|
|
86
|
+
export declare function countSecurityHuntFilterValues(filters: SecurityHuntFilters | undefined | null): number;
|
|
87
|
+
export declare function securityHuntFiltersToMap(filters: SecurityHuntFilters | undefined | null): Map<string, Set<string>>;
|
|
88
|
+
export declare function securityHuntFiltersFromMap(map: Map<string, Set<string>>): SecurityHuntFilters;
|
|
89
|
+
export declare function areSecurityHuntFiltersEqual(a: SecurityHuntFilters | undefined | null, b: SecurityHuntFilters | undefined | null): boolean;
|
|
90
|
+
export declare const SECURITY_HUNT_RUN_DELAY_IN_SECONDS: number;
|
|
91
|
+
export declare const SECURITY_HUNT_MAX_CATCH_UP_IN_MINUTES: number;
|
|
92
|
+
export declare const SECURITY_HUNT_RETRY_AFTER_FAILURE_IN_MINUTES: number;
|
|
93
|
+
export interface SecurityHuntRunWindow {
|
|
94
|
+
startTime: Date;
|
|
95
|
+
endTime: Date;
|
|
96
|
+
}
|
|
97
|
+
export declare function getSecurityHuntSearchStart(now: Date): Date;
|
|
98
|
+
export declare function getSecurityHuntRunWindow(data: {
|
|
99
|
+
schedule: SecurityHuntSchedule | string | undefined | null;
|
|
100
|
+
searchedUpTo: Date | undefined | null;
|
|
101
|
+
now: Date;
|
|
102
|
+
}): SecurityHuntRunWindow | null;
|
|
103
|
+
export declare function getNextSecurityHuntRunAt(data: {
|
|
104
|
+
schedule: SecurityHuntSchedule | string | undefined | null;
|
|
105
|
+
dueAt: Date | undefined | null;
|
|
106
|
+
now: Date;
|
|
107
|
+
}): Date | null;
|
|
108
|
+
export declare function getSecurityHuntRetryAt(data: {
|
|
109
|
+
schedule: SecurityHuntSchedule | string | undefined | null;
|
|
110
|
+
now: Date;
|
|
111
|
+
}): Date | null;
|
|
112
|
+
export declare const SECURITY_HUNT_RUN_ERRORS: {
|
|
113
|
+
schedulerCannotRead: {
|
|
114
|
+
message: string;
|
|
115
|
+
};
|
|
116
|
+
timedOut: {
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
119
|
+
searchFailed: {
|
|
120
|
+
message: string;
|
|
121
|
+
};
|
|
122
|
+
};
|