@cyvest/cyvest-js 3.2.0 → 4.0.0
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/dist/index.d.mts +53 -16
- package/dist/index.d.ts +53 -16
- package/dist/index.js +184 -36
- package/dist/index.mjs +184 -35
- package/package.json +5 -5
- package/src/finders.ts +29 -20
- package/src/types.generated.ts +52 -8
- package/tests/getters-finders.test.ts +38 -18
- package/tests/graph.test.ts +19 -10
- package/vitest.config.ts +8 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional human-readable investigation name.
|
|
3
|
+
*/
|
|
4
|
+
type InvestigationName = string | null;
|
|
1
5
|
/**
|
|
2
6
|
* Security level classification for checks, observables, and threat intelligence.
|
|
3
7
|
*
|
|
@@ -9,6 +13,15 @@ type Justification = string | null;
|
|
|
9
13
|
* List of whitelist entries applied to this investigation.
|
|
10
14
|
*/
|
|
11
15
|
type Whitelists = InvestigationWhitelist[];
|
|
16
|
+
type Actor = string | null;
|
|
17
|
+
type Reason = string | null;
|
|
18
|
+
type Tool = string | null;
|
|
19
|
+
type ObjectType = string | null;
|
|
20
|
+
type ObjectKey = string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Append-only investigation audit log.
|
|
23
|
+
*/
|
|
24
|
+
type EventLog = AuditEvent[];
|
|
12
25
|
type ThreatIntels = string[];
|
|
13
26
|
/**
|
|
14
27
|
* Direction of a relationship between observables.
|
|
@@ -16,14 +29,14 @@ type ThreatIntels = string[];
|
|
|
16
29
|
type RelationshipDirection = "outbound" | "inbound" | "bidirectional";
|
|
17
30
|
type Relationships = Relationship[];
|
|
18
31
|
/**
|
|
19
|
-
* Checks that
|
|
32
|
+
* Checks that currently link to this observable (navigation-only).
|
|
20
33
|
*/
|
|
21
|
-
type
|
|
22
|
-
type Observables1 = string[];
|
|
34
|
+
type CheckLinks = string[];
|
|
23
35
|
/**
|
|
24
|
-
* Controls how a
|
|
36
|
+
* Controls how a Check↔Observable link propagates across merged investigations.
|
|
25
37
|
*/
|
|
26
|
-
type
|
|
38
|
+
type PropagationMode = "LOCAL_ONLY" | "GLOBAL";
|
|
39
|
+
type ObservableLinks = ObservableLink[];
|
|
27
40
|
type Taxonomies = {
|
|
28
41
|
[k: string]: unknown;
|
|
29
42
|
}[];
|
|
@@ -47,6 +60,11 @@ type ScoreMode = "max" | "sum";
|
|
|
47
60
|
* schemas matching the actual model_dump() output.
|
|
48
61
|
*/
|
|
49
62
|
interface CyvestInvestigation {
|
|
63
|
+
/**
|
|
64
|
+
* Stable investigation identity (ULID).
|
|
65
|
+
*/
|
|
66
|
+
investigation_id: string;
|
|
67
|
+
investigation_name?: InvestigationName;
|
|
50
68
|
/**
|
|
51
69
|
* Investigation start time (UTC).
|
|
52
70
|
*/
|
|
@@ -61,6 +79,7 @@ interface CyvestInvestigation {
|
|
|
61
79
|
*/
|
|
62
80
|
whitelisted: boolean;
|
|
63
81
|
whitelists: Whitelists;
|
|
82
|
+
event_log?: EventLog;
|
|
64
83
|
observables: Observables;
|
|
65
84
|
checks: Checks;
|
|
66
85
|
checks_by_level: ChecksByLevel;
|
|
@@ -84,6 +103,24 @@ interface InvestigationWhitelist {
|
|
|
84
103
|
justification?: Justification;
|
|
85
104
|
[k: string]: unknown;
|
|
86
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Centralized audit event for investigation-level changes.
|
|
108
|
+
*/
|
|
109
|
+
interface AuditEvent {
|
|
110
|
+
event_id: string;
|
|
111
|
+
timestamp: string;
|
|
112
|
+
event_type: string;
|
|
113
|
+
actor?: Actor;
|
|
114
|
+
reason?: Reason;
|
|
115
|
+
tool?: Tool;
|
|
116
|
+
object_type?: ObjectType;
|
|
117
|
+
object_key?: ObjectKey;
|
|
118
|
+
details?: Details;
|
|
119
|
+
[k: string]: unknown;
|
|
120
|
+
}
|
|
121
|
+
interface Details {
|
|
122
|
+
[k: string]: unknown;
|
|
123
|
+
}
|
|
87
124
|
/**
|
|
88
125
|
* Observables keyed by their unique key.
|
|
89
126
|
*/
|
|
@@ -108,7 +145,7 @@ interface Observable {
|
|
|
108
145
|
threat_intels: ThreatIntels;
|
|
109
146
|
relationships: Relationships;
|
|
110
147
|
key: string;
|
|
111
|
-
|
|
148
|
+
check_links: CheckLinks;
|
|
112
149
|
score_display: string;
|
|
113
150
|
[k: string]: unknown;
|
|
114
151
|
}
|
|
@@ -144,8 +181,8 @@ interface Check {
|
|
|
144
181
|
extra: Extra1;
|
|
145
182
|
score: number;
|
|
146
183
|
level: Level;
|
|
147
|
-
|
|
148
|
-
|
|
184
|
+
origin_investigation_id: string;
|
|
185
|
+
observable_links: ObservableLinks;
|
|
149
186
|
key: string;
|
|
150
187
|
score_display: string;
|
|
151
188
|
[k: string]: unknown;
|
|
@@ -153,6 +190,13 @@ interface Check {
|
|
|
153
190
|
interface Extra1 {
|
|
154
191
|
[k: string]: unknown;
|
|
155
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Edge metadata for a Check↔Observable association.
|
|
195
|
+
*/
|
|
196
|
+
interface ObservableLink {
|
|
197
|
+
observable_key: string;
|
|
198
|
+
propagation_mode?: PropagationMode;
|
|
199
|
+
}
|
|
156
200
|
/**
|
|
157
201
|
* Check keys organized by level name.
|
|
158
202
|
*/
|
|
@@ -954,13 +998,6 @@ declare function findChecksAtLeast(inv: CyvestInvestigation, minLevel: Level): C
|
|
|
954
998
|
* @returns Array of matching checks
|
|
955
999
|
*/
|
|
956
1000
|
declare function findChecksByCheckId(inv: CyvestInvestigation, checkId: string): Check[];
|
|
957
|
-
/**
|
|
958
|
-
* Find checks with score policy set to manual.
|
|
959
|
-
*
|
|
960
|
-
* @param inv - The investigation to search
|
|
961
|
-
* @returns Array of manually scored checks
|
|
962
|
-
*/
|
|
963
|
-
declare function findManuallyScored(inv: CyvestInvestigation): Check[];
|
|
964
1001
|
/**
|
|
965
1002
|
* Find all threat intel from a specific source.
|
|
966
1003
|
*
|
|
@@ -1334,4 +1371,4 @@ declare function getRelationshipsForObservable(inv: CyvestInvestigation, observa
|
|
|
1334
1371
|
}>;
|
|
1335
1372
|
};
|
|
1336
1373
|
|
|
1337
|
-
export { type Check, type
|
|
1374
|
+
export { type Actor, type AuditEvent, type Check, type CheckLinks, type Checks, type Checks1, type ChecksByLevel, type ChecksByLevel1, type ChecksByScope, type Container, type Containers, type CyvestInvestigation, type Data, type DataExtractionSchema, type Details, type Enrichment, type Enrichments, type EventLog, type Extra, type Extra1, type Extra2, type GraphEdge, type GraphNode, type InvestigationCounts, type InvestigationGraph, type InvestigationName, type InvestigationWhitelist, type Justification, type KeyType, LEVEL_COLORS, LEVEL_ORDER, LEVEL_VALUES, type Level, type ObjectKey, type ObjectType, type Observable, type ObservableLink, type ObservableLinks, type Observables, type ObservablesByLevel, type ObservablesByType, type ObservablesByTypeAndLevel, type PropagationMode, type Reason, type Relationship, type RelationshipDirection, type Relationships, type RootType, type ScoreMode, type StatisticsSchema, type StatsChecksSchema, type SubContainers, type Taxonomies, type ThreatIntel, type ThreatIntelByLevel, type ThreatIntelBySource, type ThreatIntels, type ThreatIntels1, type Tool, type Whitelists, areConnected, compareLevels, countRelationshipsByType, findChecksAtLeast, findChecksByCheckId, findChecksByLevel, findChecksByScope, findContainersAtLeast, findContainersByLevel, findExternalObservables, findInternalObservables, findLeafObservables, findObservablesAtLeast, findObservablesByLevel, findObservablesByType, findObservablesByValue, findObservablesContaining, findObservablesMatching, findObservablesWithThreatIntel, findOrphanObservables, findPath, findRootObservables, findThreatIntelAtLeast, findThreatIntelByLevel, findThreatIntelBySource, findWhitelistedObservables, generateCheckKey, generateContainerKey, generateEnrichmentKey, generateObservableKey, generateThreatIntelKey, getAllChecks, getAllContainers, getAllEnrichments, getAllObservableTypes, getAllObservables, getAllRelationshipTypes, getAllScopes, getAllThreatIntelSources, getAllThreatIntels, getCheck, getCheckByIdScope, getChecksForContainer, getChecksForObservable, getColorForLevel, getColorForScore, getContainer, getContainerByPath, getCounts, getDataExtraction, getEnrichment, getEnrichmentByName, getEntityLevel, getHighestScoringChecks, getHighestScoringObservables, getLevelFromScore, getMaliciousChecks, getMaliciousObservables, getObservable, getObservableByTypeValue, getObservableChildren, getObservableGraph, getObservableParents, getObservablesForCheck, getReachableObservables, getRelatedObservables, getRelatedObservablesByDirection, getRelatedObservablesByType, getRelationshipsForObservable, getStats, getStatsChecks, getSuspiciousChecks, getSuspiciousObservables, getThreatIntel, getThreatIntelBySourceObservable, getThreatIntelsForObservable, getWhitelists, hasLevel, isCyvest, isLevelAtLeast, isLevelHigherThan, isLevelLowerThan, isValidLevel, maxLevel, minLevel, normalizeLevel, parseCheckKey, parseCyvest, parseKeyType, parseObservableKey, parseThreatIntelKey, sortChecksByLevel, sortChecksByScore, sortObservablesByLevel, sortObservablesByScore, validateKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional human-readable investigation name.
|
|
3
|
+
*/
|
|
4
|
+
type InvestigationName = string | null;
|
|
1
5
|
/**
|
|
2
6
|
* Security level classification for checks, observables, and threat intelligence.
|
|
3
7
|
*
|
|
@@ -9,6 +13,15 @@ type Justification = string | null;
|
|
|
9
13
|
* List of whitelist entries applied to this investigation.
|
|
10
14
|
*/
|
|
11
15
|
type Whitelists = InvestigationWhitelist[];
|
|
16
|
+
type Actor = string | null;
|
|
17
|
+
type Reason = string | null;
|
|
18
|
+
type Tool = string | null;
|
|
19
|
+
type ObjectType = string | null;
|
|
20
|
+
type ObjectKey = string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Append-only investigation audit log.
|
|
23
|
+
*/
|
|
24
|
+
type EventLog = AuditEvent[];
|
|
12
25
|
type ThreatIntels = string[];
|
|
13
26
|
/**
|
|
14
27
|
* Direction of a relationship between observables.
|
|
@@ -16,14 +29,14 @@ type ThreatIntels = string[];
|
|
|
16
29
|
type RelationshipDirection = "outbound" | "inbound" | "bidirectional";
|
|
17
30
|
type Relationships = Relationship[];
|
|
18
31
|
/**
|
|
19
|
-
* Checks that
|
|
32
|
+
* Checks that currently link to this observable (navigation-only).
|
|
20
33
|
*/
|
|
21
|
-
type
|
|
22
|
-
type Observables1 = string[];
|
|
34
|
+
type CheckLinks = string[];
|
|
23
35
|
/**
|
|
24
|
-
* Controls how a
|
|
36
|
+
* Controls how a Check↔Observable link propagates across merged investigations.
|
|
25
37
|
*/
|
|
26
|
-
type
|
|
38
|
+
type PropagationMode = "LOCAL_ONLY" | "GLOBAL";
|
|
39
|
+
type ObservableLinks = ObservableLink[];
|
|
27
40
|
type Taxonomies = {
|
|
28
41
|
[k: string]: unknown;
|
|
29
42
|
}[];
|
|
@@ -47,6 +60,11 @@ type ScoreMode = "max" | "sum";
|
|
|
47
60
|
* schemas matching the actual model_dump() output.
|
|
48
61
|
*/
|
|
49
62
|
interface CyvestInvestigation {
|
|
63
|
+
/**
|
|
64
|
+
* Stable investigation identity (ULID).
|
|
65
|
+
*/
|
|
66
|
+
investigation_id: string;
|
|
67
|
+
investigation_name?: InvestigationName;
|
|
50
68
|
/**
|
|
51
69
|
* Investigation start time (UTC).
|
|
52
70
|
*/
|
|
@@ -61,6 +79,7 @@ interface CyvestInvestigation {
|
|
|
61
79
|
*/
|
|
62
80
|
whitelisted: boolean;
|
|
63
81
|
whitelists: Whitelists;
|
|
82
|
+
event_log?: EventLog;
|
|
64
83
|
observables: Observables;
|
|
65
84
|
checks: Checks;
|
|
66
85
|
checks_by_level: ChecksByLevel;
|
|
@@ -84,6 +103,24 @@ interface InvestigationWhitelist {
|
|
|
84
103
|
justification?: Justification;
|
|
85
104
|
[k: string]: unknown;
|
|
86
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Centralized audit event for investigation-level changes.
|
|
108
|
+
*/
|
|
109
|
+
interface AuditEvent {
|
|
110
|
+
event_id: string;
|
|
111
|
+
timestamp: string;
|
|
112
|
+
event_type: string;
|
|
113
|
+
actor?: Actor;
|
|
114
|
+
reason?: Reason;
|
|
115
|
+
tool?: Tool;
|
|
116
|
+
object_type?: ObjectType;
|
|
117
|
+
object_key?: ObjectKey;
|
|
118
|
+
details?: Details;
|
|
119
|
+
[k: string]: unknown;
|
|
120
|
+
}
|
|
121
|
+
interface Details {
|
|
122
|
+
[k: string]: unknown;
|
|
123
|
+
}
|
|
87
124
|
/**
|
|
88
125
|
* Observables keyed by their unique key.
|
|
89
126
|
*/
|
|
@@ -108,7 +145,7 @@ interface Observable {
|
|
|
108
145
|
threat_intels: ThreatIntels;
|
|
109
146
|
relationships: Relationships;
|
|
110
147
|
key: string;
|
|
111
|
-
|
|
148
|
+
check_links: CheckLinks;
|
|
112
149
|
score_display: string;
|
|
113
150
|
[k: string]: unknown;
|
|
114
151
|
}
|
|
@@ -144,8 +181,8 @@ interface Check {
|
|
|
144
181
|
extra: Extra1;
|
|
145
182
|
score: number;
|
|
146
183
|
level: Level;
|
|
147
|
-
|
|
148
|
-
|
|
184
|
+
origin_investigation_id: string;
|
|
185
|
+
observable_links: ObservableLinks;
|
|
149
186
|
key: string;
|
|
150
187
|
score_display: string;
|
|
151
188
|
[k: string]: unknown;
|
|
@@ -153,6 +190,13 @@ interface Check {
|
|
|
153
190
|
interface Extra1 {
|
|
154
191
|
[k: string]: unknown;
|
|
155
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Edge metadata for a Check↔Observable association.
|
|
195
|
+
*/
|
|
196
|
+
interface ObservableLink {
|
|
197
|
+
observable_key: string;
|
|
198
|
+
propagation_mode?: PropagationMode;
|
|
199
|
+
}
|
|
156
200
|
/**
|
|
157
201
|
* Check keys organized by level name.
|
|
158
202
|
*/
|
|
@@ -954,13 +998,6 @@ declare function findChecksAtLeast(inv: CyvestInvestigation, minLevel: Level): C
|
|
|
954
998
|
* @returns Array of matching checks
|
|
955
999
|
*/
|
|
956
1000
|
declare function findChecksByCheckId(inv: CyvestInvestigation, checkId: string): Check[];
|
|
957
|
-
/**
|
|
958
|
-
* Find checks with score policy set to manual.
|
|
959
|
-
*
|
|
960
|
-
* @param inv - The investigation to search
|
|
961
|
-
* @returns Array of manually scored checks
|
|
962
|
-
*/
|
|
963
|
-
declare function findManuallyScored(inv: CyvestInvestigation): Check[];
|
|
964
1001
|
/**
|
|
965
1002
|
* Find all threat intel from a specific source.
|
|
966
1003
|
*
|
|
@@ -1334,4 +1371,4 @@ declare function getRelationshipsForObservable(inv: CyvestInvestigation, observa
|
|
|
1334
1371
|
}>;
|
|
1335
1372
|
};
|
|
1336
1373
|
|
|
1337
|
-
export { type Check, type
|
|
1374
|
+
export { type Actor, type AuditEvent, type Check, type CheckLinks, type Checks, type Checks1, type ChecksByLevel, type ChecksByLevel1, type ChecksByScope, type Container, type Containers, type CyvestInvestigation, type Data, type DataExtractionSchema, type Details, type Enrichment, type Enrichments, type EventLog, type Extra, type Extra1, type Extra2, type GraphEdge, type GraphNode, type InvestigationCounts, type InvestigationGraph, type InvestigationName, type InvestigationWhitelist, type Justification, type KeyType, LEVEL_COLORS, LEVEL_ORDER, LEVEL_VALUES, type Level, type ObjectKey, type ObjectType, type Observable, type ObservableLink, type ObservableLinks, type Observables, type ObservablesByLevel, type ObservablesByType, type ObservablesByTypeAndLevel, type PropagationMode, type Reason, type Relationship, type RelationshipDirection, type Relationships, type RootType, type ScoreMode, type StatisticsSchema, type StatsChecksSchema, type SubContainers, type Taxonomies, type ThreatIntel, type ThreatIntelByLevel, type ThreatIntelBySource, type ThreatIntels, type ThreatIntels1, type Tool, type Whitelists, areConnected, compareLevels, countRelationshipsByType, findChecksAtLeast, findChecksByCheckId, findChecksByLevel, findChecksByScope, findContainersAtLeast, findContainersByLevel, findExternalObservables, findInternalObservables, findLeafObservables, findObservablesAtLeast, findObservablesByLevel, findObservablesByType, findObservablesByValue, findObservablesContaining, findObservablesMatching, findObservablesWithThreatIntel, findOrphanObservables, findPath, findRootObservables, findThreatIntelAtLeast, findThreatIntelByLevel, findThreatIntelBySource, findWhitelistedObservables, generateCheckKey, generateContainerKey, generateEnrichmentKey, generateObservableKey, generateThreatIntelKey, getAllChecks, getAllContainers, getAllEnrichments, getAllObservableTypes, getAllObservables, getAllRelationshipTypes, getAllScopes, getAllThreatIntelSources, getAllThreatIntels, getCheck, getCheckByIdScope, getChecksForContainer, getChecksForObservable, getColorForLevel, getColorForScore, getContainer, getContainerByPath, getCounts, getDataExtraction, getEnrichment, getEnrichmentByName, getEntityLevel, getHighestScoringChecks, getHighestScoringObservables, getLevelFromScore, getMaliciousChecks, getMaliciousObservables, getObservable, getObservableByTypeValue, getObservableChildren, getObservableGraph, getObservableParents, getObservablesForCheck, getReachableObservables, getRelatedObservables, getRelatedObservablesByDirection, getRelatedObservablesByType, getRelationshipsForObservable, getStats, getStatsChecks, getSuspiciousChecks, getSuspiciousObservables, getThreatIntel, getThreatIntelBySourceObservable, getThreatIntelsForObservable, getWhitelists, hasLevel, isCyvest, isLevelAtLeast, isLevelHigherThan, isLevelLowerThan, isValidLevel, maxLevel, minLevel, normalizeLevel, parseCheckKey, parseCyvest, parseKeyType, parseObservableKey, parseThreatIntelKey, sortChecksByLevel, sortChecksByScore, sortObservablesByLevel, sortObservablesByScore, validateKey };
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,6 @@ __export(index_exports, {
|
|
|
45
45
|
findExternalObservables: () => findExternalObservables,
|
|
46
46
|
findInternalObservables: () => findInternalObservables,
|
|
47
47
|
findLeafObservables: () => findLeafObservables,
|
|
48
|
-
findManuallyScored: () => findManuallyScored,
|
|
49
48
|
findObservablesAtLeast: () => findObservablesAtLeast,
|
|
50
49
|
findObservablesByLevel: () => findObservablesByLevel,
|
|
51
50
|
findObservablesByType: () => findObservablesByType,
|
|
@@ -140,6 +139,97 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
|
140
139
|
// ../../../schema/cyvest.schema.json
|
|
141
140
|
var cyvest_schema_default = {
|
|
142
141
|
$defs: {
|
|
142
|
+
AuditEvent: {
|
|
143
|
+
additionalProperties: true,
|
|
144
|
+
description: "Centralized audit event for investigation-level changes.",
|
|
145
|
+
properties: {
|
|
146
|
+
event_id: {
|
|
147
|
+
title: "Event Id",
|
|
148
|
+
type: "string"
|
|
149
|
+
},
|
|
150
|
+
timestamp: {
|
|
151
|
+
format: "date-time",
|
|
152
|
+
title: "Timestamp",
|
|
153
|
+
type: "string"
|
|
154
|
+
},
|
|
155
|
+
event_type: {
|
|
156
|
+
title: "Event Type",
|
|
157
|
+
type: "string"
|
|
158
|
+
},
|
|
159
|
+
actor: {
|
|
160
|
+
anyOf: [
|
|
161
|
+
{
|
|
162
|
+
type: "string"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: "null"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
default: null,
|
|
169
|
+
title: "Actor"
|
|
170
|
+
},
|
|
171
|
+
reason: {
|
|
172
|
+
anyOf: [
|
|
173
|
+
{
|
|
174
|
+
type: "string"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
type: "null"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
default: null,
|
|
181
|
+
title: "Reason"
|
|
182
|
+
},
|
|
183
|
+
tool: {
|
|
184
|
+
anyOf: [
|
|
185
|
+
{
|
|
186
|
+
type: "string"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: "null"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
default: null,
|
|
193
|
+
title: "Tool"
|
|
194
|
+
},
|
|
195
|
+
object_type: {
|
|
196
|
+
anyOf: [
|
|
197
|
+
{
|
|
198
|
+
type: "string"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: "null"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
default: null,
|
|
205
|
+
title: "Object Type"
|
|
206
|
+
},
|
|
207
|
+
object_key: {
|
|
208
|
+
anyOf: [
|
|
209
|
+
{
|
|
210
|
+
type: "string"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: "null"
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
default: null,
|
|
217
|
+
title: "Object Key"
|
|
218
|
+
},
|
|
219
|
+
details: {
|
|
220
|
+
additionalProperties: true,
|
|
221
|
+
title: "Details",
|
|
222
|
+
type: "object"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
required: [
|
|
226
|
+
"event_id",
|
|
227
|
+
"timestamp",
|
|
228
|
+
"event_type"
|
|
229
|
+
],
|
|
230
|
+
title: "AuditEvent",
|
|
231
|
+
type: "object"
|
|
232
|
+
},
|
|
143
233
|
Check: {
|
|
144
234
|
description: "Represents a verification step in the investigation.\n\nA check validates a specific aspect of the data under investigation\nand contributes to the overall investigation score.",
|
|
145
235
|
properties: {
|
|
@@ -171,17 +261,17 @@ var cyvest_schema_default = {
|
|
|
171
261
|
level: {
|
|
172
262
|
$ref: "#/$defs/Level"
|
|
173
263
|
},
|
|
174
|
-
|
|
264
|
+
origin_investigation_id: {
|
|
265
|
+
title: "Origin Investigation Id",
|
|
266
|
+
type: "string"
|
|
267
|
+
},
|
|
268
|
+
observable_links: {
|
|
175
269
|
items: {
|
|
176
|
-
|
|
270
|
+
$ref: "#/$defs/ObservableLink"
|
|
177
271
|
},
|
|
178
|
-
title: "
|
|
272
|
+
title: "Observable Links",
|
|
179
273
|
type: "array"
|
|
180
274
|
},
|
|
181
|
-
score_policy: {
|
|
182
|
-
$ref: "#/$defs/CheckScorePolicy",
|
|
183
|
-
default: "auto"
|
|
184
|
-
},
|
|
185
275
|
key: {
|
|
186
276
|
title: "Key",
|
|
187
277
|
type: "string"
|
|
@@ -200,22 +290,14 @@ var cyvest_schema_default = {
|
|
|
200
290
|
"extra",
|
|
201
291
|
"score",
|
|
202
292
|
"level",
|
|
203
|
-
"
|
|
293
|
+
"origin_investigation_id",
|
|
294
|
+
"observable_links",
|
|
204
295
|
"key",
|
|
205
296
|
"score_display"
|
|
206
297
|
],
|
|
207
298
|
title: "Check",
|
|
208
299
|
type: "object"
|
|
209
300
|
},
|
|
210
|
-
CheckScorePolicy: {
|
|
211
|
-
description: "Controls how a check reacts to linked observables.",
|
|
212
|
-
enum: [
|
|
213
|
-
"auto",
|
|
214
|
-
"manual"
|
|
215
|
-
],
|
|
216
|
-
title: "CheckScorePolicy",
|
|
217
|
-
type: "string"
|
|
218
|
-
},
|
|
219
301
|
Container: {
|
|
220
302
|
additionalProperties: false,
|
|
221
303
|
description: "Groups checks and sub-containers for hierarchical organization.\n\nContainers allow structuring the investigation into logical sections\nwith aggregated scores and levels.",
|
|
@@ -425,13 +507,13 @@ var cyvest_schema_default = {
|
|
|
425
507
|
title: "Key",
|
|
426
508
|
type: "string"
|
|
427
509
|
},
|
|
428
|
-
|
|
429
|
-
description: "Checks that
|
|
510
|
+
check_links: {
|
|
511
|
+
description: "Checks that currently link to this observable (navigation-only).",
|
|
430
512
|
items: {
|
|
431
513
|
type: "string"
|
|
432
514
|
},
|
|
433
515
|
readOnly: true,
|
|
434
|
-
title: "
|
|
516
|
+
title: "Check Links",
|
|
435
517
|
type: "array"
|
|
436
518
|
},
|
|
437
519
|
score_display: {
|
|
@@ -452,12 +534,40 @@ var cyvest_schema_default = {
|
|
|
452
534
|
"threat_intels",
|
|
453
535
|
"relationships",
|
|
454
536
|
"key",
|
|
455
|
-
"
|
|
537
|
+
"check_links",
|
|
456
538
|
"score_display"
|
|
457
539
|
],
|
|
458
540
|
title: "Observable",
|
|
459
541
|
type: "object"
|
|
460
542
|
},
|
|
543
|
+
ObservableLink: {
|
|
544
|
+
additionalProperties: false,
|
|
545
|
+
description: "Edge metadata for a Check\u2194Observable association.",
|
|
546
|
+
properties: {
|
|
547
|
+
observable_key: {
|
|
548
|
+
title: "Observable Key",
|
|
549
|
+
type: "string"
|
|
550
|
+
},
|
|
551
|
+
propagation_mode: {
|
|
552
|
+
$ref: "#/$defs/PropagationMode",
|
|
553
|
+
default: "LOCAL_ONLY"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
required: [
|
|
557
|
+
"observable_key"
|
|
558
|
+
],
|
|
559
|
+
title: "ObservableLink",
|
|
560
|
+
type: "object"
|
|
561
|
+
},
|
|
562
|
+
PropagationMode: {
|
|
563
|
+
description: "Controls how a Check\u2194Observable link propagates across merged investigations.",
|
|
564
|
+
enum: [
|
|
565
|
+
"LOCAL_ONLY",
|
|
566
|
+
"GLOBAL"
|
|
567
|
+
],
|
|
568
|
+
title: "PropagationMode",
|
|
569
|
+
type: "string"
|
|
570
|
+
},
|
|
461
571
|
Relationship: {
|
|
462
572
|
description: "Represents a relationship between observables.",
|
|
463
573
|
properties: {
|
|
@@ -704,6 +814,24 @@ var cyvest_schema_default = {
|
|
|
704
814
|
additionalProperties: false,
|
|
705
815
|
description: "Schema for a complete serialized investigation.\n\nThis model describes the output of `serialize_investigation()` from\n`cyvest.io_serialization`. It is the top-level schema for exported investigations.\n\nEntity types reference the runtime models directly. When generating schemas with\n`mode='serialization'`, Pydantic respects field_serializer decorators and produces\nschemas matching the actual model_dump() output.",
|
|
706
816
|
properties: {
|
|
817
|
+
investigation_id: {
|
|
818
|
+
description: "Stable investigation identity (ULID).",
|
|
819
|
+
title: "Investigation Id",
|
|
820
|
+
type: "string"
|
|
821
|
+
},
|
|
822
|
+
investigation_name: {
|
|
823
|
+
anyOf: [
|
|
824
|
+
{
|
|
825
|
+
type: "string"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
type: "null"
|
|
829
|
+
}
|
|
830
|
+
],
|
|
831
|
+
default: null,
|
|
832
|
+
description: "Optional human-readable investigation name.",
|
|
833
|
+
title: "Investigation Name"
|
|
834
|
+
},
|
|
707
835
|
started_at: {
|
|
708
836
|
description: "Investigation start time (UTC).",
|
|
709
837
|
format: "date-time",
|
|
@@ -732,6 +860,14 @@ var cyvest_schema_default = {
|
|
|
732
860
|
title: "Whitelists",
|
|
733
861
|
type: "array"
|
|
734
862
|
},
|
|
863
|
+
event_log: {
|
|
864
|
+
description: "Append-only investigation audit log.",
|
|
865
|
+
items: {
|
|
866
|
+
$ref: "#/$defs/AuditEvent"
|
|
867
|
+
},
|
|
868
|
+
title: "Event Log",
|
|
869
|
+
type: "array"
|
|
870
|
+
},
|
|
735
871
|
observables: {
|
|
736
872
|
additionalProperties: {
|
|
737
873
|
$ref: "#/$defs/Observable"
|
|
@@ -806,6 +942,7 @@ var cyvest_schema_default = {
|
|
|
806
942
|
}
|
|
807
943
|
},
|
|
808
944
|
required: [
|
|
945
|
+
"investigation_id",
|
|
809
946
|
"started_at",
|
|
810
947
|
"score",
|
|
811
948
|
"level",
|
|
@@ -1300,17 +1437,6 @@ function findChecksByCheckId(inv, checkId) {
|
|
|
1300
1437
|
}
|
|
1301
1438
|
return result;
|
|
1302
1439
|
}
|
|
1303
|
-
function findManuallyScored(inv) {
|
|
1304
|
-
const result = [];
|
|
1305
|
-
for (const checks of Object.values(inv.checks)) {
|
|
1306
|
-
for (const check of checks) {
|
|
1307
|
-
if (check.score_policy === "manual") {
|
|
1308
|
-
result.push(check);
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
return result;
|
|
1313
|
-
}
|
|
1314
1440
|
function findThreatIntelBySource(inv, source) {
|
|
1315
1441
|
const normalizedSource = source.trim().toLowerCase();
|
|
1316
1442
|
return Object.values(inv.threat_intels).filter(
|
|
@@ -1353,13 +1479,32 @@ function findContainersAtLeast(inv, minLevel2) {
|
|
|
1353
1479
|
}
|
|
1354
1480
|
function getChecksForObservable(inv, observableKey) {
|
|
1355
1481
|
const result = [];
|
|
1482
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1483
|
+
const checkLookup = /* @__PURE__ */ new Map();
|
|
1356
1484
|
for (const checks of Object.values(inv.checks)) {
|
|
1357
1485
|
for (const check of checks) {
|
|
1358
|
-
|
|
1486
|
+
checkLookup.set(check.key, check);
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
const observable = inv.observables[observableKey];
|
|
1490
|
+
if (observable) {
|
|
1491
|
+
for (const checkKey of observable.check_links) {
|
|
1492
|
+
const check = checkLookup.get(checkKey);
|
|
1493
|
+
if (check && !seen.has(check.key)) {
|
|
1359
1494
|
result.push(check);
|
|
1495
|
+
seen.add(check.key);
|
|
1360
1496
|
}
|
|
1361
1497
|
}
|
|
1362
1498
|
}
|
|
1499
|
+
for (const check of checkLookup.values()) {
|
|
1500
|
+
if (seen.has(check.key)) {
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
if (check.observable_links.some((link) => link.observable_key === observableKey)) {
|
|
1504
|
+
result.push(check);
|
|
1505
|
+
seen.add(check.key);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1363
1508
|
return result;
|
|
1364
1509
|
}
|
|
1365
1510
|
function getThreatIntelsForObservable(inv, observableKey) {
|
|
@@ -1375,7 +1520,11 @@ function getObservablesForCheck(inv, checkKey) {
|
|
|
1375
1520
|
for (const checks of Object.values(inv.checks)) {
|
|
1376
1521
|
for (const check of checks) {
|
|
1377
1522
|
if (check.key === checkKey) {
|
|
1378
|
-
|
|
1523
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1524
|
+
for (const link of check.observable_links) {
|
|
1525
|
+
keys.add(link.observable_key);
|
|
1526
|
+
}
|
|
1527
|
+
return Array.from(keys).map((obsKey) => inv.observables[obsKey]).filter((obs) => obs !== void 0);
|
|
1379
1528
|
}
|
|
1380
1529
|
}
|
|
1381
1530
|
}
|
|
@@ -1748,7 +1897,6 @@ function getRelationshipsForObservable(inv, observableKey) {
|
|
|
1748
1897
|
findExternalObservables,
|
|
1749
1898
|
findInternalObservables,
|
|
1750
1899
|
findLeafObservables,
|
|
1751
|
-
findManuallyScored,
|
|
1752
1900
|
findObservablesAtLeast,
|
|
1753
1901
|
findObservablesByLevel,
|
|
1754
1902
|
findObservablesByType,
|