@cyvest/cyvest-js 4.3.0 → 4.4.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 +23 -10
- package/dist/index.d.ts +23 -10
- package/dist/index.js +22 -14
- package/dist/index.mjs +21 -14
- package/package.json +1 -1
- package/src/getters.ts +23 -0
- package/src/types.generated.ts +5 -9
- package/tests/getters-finders.test.ts +29 -1
- package/tests/graph.test.ts +9 -1
package/dist/index.d.mts
CHANGED
|
@@ -13,15 +13,15 @@ type Justification = string | null;
|
|
|
13
13
|
* List of whitelist entries applied to this investigation.
|
|
14
14
|
*/
|
|
15
15
|
type Whitelists = InvestigationWhitelist[];
|
|
16
|
+
/**
|
|
17
|
+
* Append-only investigation audit log. Null when serialization disabled audit.
|
|
18
|
+
*/
|
|
19
|
+
type AuditLog = AuditEvent[] | null;
|
|
16
20
|
type Actor = string | null;
|
|
17
21
|
type Reason = string | null;
|
|
18
22
|
type Tool = string | null;
|
|
19
23
|
type ObjectType = string | null;
|
|
20
24
|
type ObjectKey = string | null;
|
|
21
|
-
/**
|
|
22
|
-
* Append-only investigation audit log.
|
|
23
|
-
*/
|
|
24
|
-
type EventLog = AuditEvent[];
|
|
25
25
|
type ThreatIntels = string[];
|
|
26
26
|
/**
|
|
27
27
|
* Direction of a relationship between observables.
|
|
@@ -63,10 +63,6 @@ interface CyvestInvestigation {
|
|
|
63
63
|
*/
|
|
64
64
|
investigation_id: string;
|
|
65
65
|
investigation_name?: InvestigationName;
|
|
66
|
-
/**
|
|
67
|
-
* Investigation start time (UTC).
|
|
68
|
-
*/
|
|
69
|
-
started_at: string;
|
|
70
66
|
/**
|
|
71
67
|
* Global investigation score.
|
|
72
68
|
*/
|
|
@@ -77,7 +73,7 @@ interface CyvestInvestigation {
|
|
|
77
73
|
*/
|
|
78
74
|
whitelisted: boolean;
|
|
79
75
|
whitelists: Whitelists;
|
|
80
|
-
|
|
76
|
+
audit_log?: AuditLog;
|
|
81
77
|
observables: Observables;
|
|
82
78
|
checks: Checks;
|
|
83
79
|
threat_intels: ThreatIntels1;
|
|
@@ -842,6 +838,23 @@ interface InvestigationCounts {
|
|
|
842
838
|
* @returns Object with counts for each entity type
|
|
843
839
|
*/
|
|
844
840
|
declare function getCounts(inv: CyvestInvestigation): InvestigationCounts;
|
|
841
|
+
/**
|
|
842
|
+
* Get the investigation start time from the event log.
|
|
843
|
+
*
|
|
844
|
+
* Looks for the INVESTIGATION_STARTED event and returns its timestamp.
|
|
845
|
+
*
|
|
846
|
+
* @param inv - The investigation
|
|
847
|
+
* @returns The start timestamp string or undefined if not found
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```ts
|
|
851
|
+
* const startedAt = getStartedAt(investigation);
|
|
852
|
+
* if (startedAt) {
|
|
853
|
+
* console.log(`Started: ${startedAt}`);
|
|
854
|
+
* }
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
declare function getStartedAt(inv: CyvestInvestigation): string | undefined;
|
|
845
858
|
|
|
846
859
|
/**
|
|
847
860
|
* Finder utilities for querying and filtering Cyvest Investigation data.
|
|
@@ -1355,4 +1368,4 @@ declare function getRelationshipsForObservable(inv: CyvestInvestigation, observa
|
|
|
1355
1368
|
}>;
|
|
1356
1369
|
};
|
|
1357
1370
|
|
|
1358
|
-
export { type Actor, type AuditEvent, type Check, type CheckLinks, type Checks, type Checks1, type ChecksByLevel, type ChecksByScope, type Container, type Containers, type CyvestInvestigation, type Data, type DataExtractionSchema, type Details, type Enrichment, type Enrichments, type
|
|
1371
|
+
export { type Actor, type AuditEvent, type AuditLog, type Check, type CheckLinks, type Checks, type Checks1, type ChecksByLevel, type ChecksByScope, type Container, type Containers, type CyvestInvestigation, type Data, type DataExtractionSchema, type Details, type Enrichment, type Enrichments, 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 SubContainers, type Taxonomies, type Taxonomy, 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, getStartedAt, getStats, 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
|
@@ -13,15 +13,15 @@ type Justification = string | null;
|
|
|
13
13
|
* List of whitelist entries applied to this investigation.
|
|
14
14
|
*/
|
|
15
15
|
type Whitelists = InvestigationWhitelist[];
|
|
16
|
+
/**
|
|
17
|
+
* Append-only investigation audit log. Null when serialization disabled audit.
|
|
18
|
+
*/
|
|
19
|
+
type AuditLog = AuditEvent[] | null;
|
|
16
20
|
type Actor = string | null;
|
|
17
21
|
type Reason = string | null;
|
|
18
22
|
type Tool = string | null;
|
|
19
23
|
type ObjectType = string | null;
|
|
20
24
|
type ObjectKey = string | null;
|
|
21
|
-
/**
|
|
22
|
-
* Append-only investigation audit log.
|
|
23
|
-
*/
|
|
24
|
-
type EventLog = AuditEvent[];
|
|
25
25
|
type ThreatIntels = string[];
|
|
26
26
|
/**
|
|
27
27
|
* Direction of a relationship between observables.
|
|
@@ -63,10 +63,6 @@ interface CyvestInvestigation {
|
|
|
63
63
|
*/
|
|
64
64
|
investigation_id: string;
|
|
65
65
|
investigation_name?: InvestigationName;
|
|
66
|
-
/**
|
|
67
|
-
* Investigation start time (UTC).
|
|
68
|
-
*/
|
|
69
|
-
started_at: string;
|
|
70
66
|
/**
|
|
71
67
|
* Global investigation score.
|
|
72
68
|
*/
|
|
@@ -77,7 +73,7 @@ interface CyvestInvestigation {
|
|
|
77
73
|
*/
|
|
78
74
|
whitelisted: boolean;
|
|
79
75
|
whitelists: Whitelists;
|
|
80
|
-
|
|
76
|
+
audit_log?: AuditLog;
|
|
81
77
|
observables: Observables;
|
|
82
78
|
checks: Checks;
|
|
83
79
|
threat_intels: ThreatIntels1;
|
|
@@ -842,6 +838,23 @@ interface InvestigationCounts {
|
|
|
842
838
|
* @returns Object with counts for each entity type
|
|
843
839
|
*/
|
|
844
840
|
declare function getCounts(inv: CyvestInvestigation): InvestigationCounts;
|
|
841
|
+
/**
|
|
842
|
+
* Get the investigation start time from the event log.
|
|
843
|
+
*
|
|
844
|
+
* Looks for the INVESTIGATION_STARTED event and returns its timestamp.
|
|
845
|
+
*
|
|
846
|
+
* @param inv - The investigation
|
|
847
|
+
* @returns The start timestamp string or undefined if not found
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```ts
|
|
851
|
+
* const startedAt = getStartedAt(investigation);
|
|
852
|
+
* if (startedAt) {
|
|
853
|
+
* console.log(`Started: ${startedAt}`);
|
|
854
|
+
* }
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
declare function getStartedAt(inv: CyvestInvestigation): string | undefined;
|
|
845
858
|
|
|
846
859
|
/**
|
|
847
860
|
* Finder utilities for querying and filtering Cyvest Investigation data.
|
|
@@ -1355,4 +1368,4 @@ declare function getRelationshipsForObservable(inv: CyvestInvestigation, observa
|
|
|
1355
1368
|
}>;
|
|
1356
1369
|
};
|
|
1357
1370
|
|
|
1358
|
-
export { type Actor, type AuditEvent, type Check, type CheckLinks, type Checks, type Checks1, type ChecksByLevel, type ChecksByScope, type Container, type Containers, type CyvestInvestigation, type Data, type DataExtractionSchema, type Details, type Enrichment, type Enrichments, type
|
|
1371
|
+
export { type Actor, type AuditEvent, type AuditLog, type Check, type CheckLinks, type Checks, type Checks1, type ChecksByLevel, type ChecksByScope, type Container, type Containers, type CyvestInvestigation, type Data, type DataExtractionSchema, type Details, type Enrichment, type Enrichments, 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 SubContainers, type Taxonomies, type Taxonomy, 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, getStartedAt, getStats, 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
|
@@ -102,6 +102,7 @@ __export(index_exports, {
|
|
|
102
102
|
getRelatedObservablesByDirection: () => getRelatedObservablesByDirection,
|
|
103
103
|
getRelatedObservablesByType: () => getRelatedObservablesByType,
|
|
104
104
|
getRelationshipsForObservable: () => getRelationshipsForObservable,
|
|
105
|
+
getStartedAt: () => getStartedAt,
|
|
105
106
|
getStats: () => getStats,
|
|
106
107
|
getSuspiciousChecks: () => getSuspiciousChecks,
|
|
107
108
|
getSuspiciousObservables: () => getSuspiciousObservables,
|
|
@@ -840,12 +841,6 @@ var cyvest_schema_default = {
|
|
|
840
841
|
description: "Optional human-readable investigation name.",
|
|
841
842
|
title: "Investigation Name"
|
|
842
843
|
},
|
|
843
|
-
started_at: {
|
|
844
|
-
description: "Investigation start time (UTC).",
|
|
845
|
-
format: "date-time",
|
|
846
|
-
title: "Started At",
|
|
847
|
-
type: "string"
|
|
848
|
-
},
|
|
849
844
|
score: {
|
|
850
845
|
description: "Global investigation score.",
|
|
851
846
|
title: "Score",
|
|
@@ -868,13 +863,20 @@ var cyvest_schema_default = {
|
|
|
868
863
|
title: "Whitelists",
|
|
869
864
|
type: "array"
|
|
870
865
|
},
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
866
|
+
audit_log: {
|
|
867
|
+
anyOf: [
|
|
868
|
+
{
|
|
869
|
+
items: {
|
|
870
|
+
$ref: "#/$defs/AuditEvent"
|
|
871
|
+
},
|
|
872
|
+
type: "array"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
type: "null"
|
|
876
|
+
}
|
|
877
|
+
],
|
|
878
|
+
description: "Append-only investigation audit log. Null when serialization disabled audit.",
|
|
879
|
+
title: "Audit Log"
|
|
878
880
|
},
|
|
879
881
|
observables: {
|
|
880
882
|
additionalProperties: {
|
|
@@ -936,7 +938,6 @@ var cyvest_schema_default = {
|
|
|
936
938
|
},
|
|
937
939
|
required: [
|
|
938
940
|
"investigation_id",
|
|
939
|
-
"started_at",
|
|
940
941
|
"score",
|
|
941
942
|
"level",
|
|
942
943
|
"whitelisted",
|
|
@@ -1332,6 +1333,12 @@ function getCounts(inv) {
|
|
|
1332
1333
|
whitelists: inv.whitelists.length
|
|
1333
1334
|
};
|
|
1334
1335
|
}
|
|
1336
|
+
function getStartedAt(inv) {
|
|
1337
|
+
const event = inv.audit_log?.find(
|
|
1338
|
+
(e) => e.event_type === "INVESTIGATION_STARTED"
|
|
1339
|
+
);
|
|
1340
|
+
return event?.timestamp;
|
|
1341
|
+
}
|
|
1335
1342
|
|
|
1336
1343
|
// src/finders.ts
|
|
1337
1344
|
function findObservablesByType(inv, type) {
|
|
@@ -1942,6 +1949,7 @@ function getRelationshipsForObservable(inv, observableKey) {
|
|
|
1942
1949
|
getRelatedObservablesByDirection,
|
|
1943
1950
|
getRelatedObservablesByType,
|
|
1944
1951
|
getRelationshipsForObservable,
|
|
1952
|
+
getStartedAt,
|
|
1945
1953
|
getStats,
|
|
1946
1954
|
getSuspiciousChecks,
|
|
1947
1955
|
getSuspiciousObservables,
|
package/dist/index.mjs
CHANGED
|
@@ -707,12 +707,6 @@ var cyvest_schema_default = {
|
|
|
707
707
|
description: "Optional human-readable investigation name.",
|
|
708
708
|
title: "Investigation Name"
|
|
709
709
|
},
|
|
710
|
-
started_at: {
|
|
711
|
-
description: "Investigation start time (UTC).",
|
|
712
|
-
format: "date-time",
|
|
713
|
-
title: "Started At",
|
|
714
|
-
type: "string"
|
|
715
|
-
},
|
|
716
710
|
score: {
|
|
717
711
|
description: "Global investigation score.",
|
|
718
712
|
title: "Score",
|
|
@@ -735,13 +729,20 @@ var cyvest_schema_default = {
|
|
|
735
729
|
title: "Whitelists",
|
|
736
730
|
type: "array"
|
|
737
731
|
},
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
732
|
+
audit_log: {
|
|
733
|
+
anyOf: [
|
|
734
|
+
{
|
|
735
|
+
items: {
|
|
736
|
+
$ref: "#/$defs/AuditEvent"
|
|
737
|
+
},
|
|
738
|
+
type: "array"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
type: "null"
|
|
742
|
+
}
|
|
743
|
+
],
|
|
744
|
+
description: "Append-only investigation audit log. Null when serialization disabled audit.",
|
|
745
|
+
title: "Audit Log"
|
|
745
746
|
},
|
|
746
747
|
observables: {
|
|
747
748
|
additionalProperties: {
|
|
@@ -803,7 +804,6 @@ var cyvest_schema_default = {
|
|
|
803
804
|
},
|
|
804
805
|
required: [
|
|
805
806
|
"investigation_id",
|
|
806
|
-
"started_at",
|
|
807
807
|
"score",
|
|
808
808
|
"level",
|
|
809
809
|
"whitelisted",
|
|
@@ -1199,6 +1199,12 @@ function getCounts(inv) {
|
|
|
1199
1199
|
whitelists: inv.whitelists.length
|
|
1200
1200
|
};
|
|
1201
1201
|
}
|
|
1202
|
+
function getStartedAt(inv) {
|
|
1203
|
+
const event = inv.audit_log?.find(
|
|
1204
|
+
(e) => e.event_type === "INVESTIGATION_STARTED"
|
|
1205
|
+
);
|
|
1206
|
+
return event?.timestamp;
|
|
1207
|
+
}
|
|
1202
1208
|
|
|
1203
1209
|
// src/finders.ts
|
|
1204
1210
|
function findObservablesByType(inv, type) {
|
|
@@ -1808,6 +1814,7 @@ export {
|
|
|
1808
1814
|
getRelatedObservablesByDirection,
|
|
1809
1815
|
getRelatedObservablesByType,
|
|
1810
1816
|
getRelationshipsForObservable,
|
|
1817
|
+
getStartedAt,
|
|
1811
1818
|
getStats,
|
|
1812
1819
|
getSuspiciousChecks,
|
|
1813
1820
|
getSuspiciousObservables,
|
package/package.json
CHANGED
package/src/getters.ts
CHANGED
|
@@ -397,3 +397,26 @@ export function getCounts(inv: CyvestInvestigation): InvestigationCounts {
|
|
|
397
397
|
whitelists: inv.whitelists.length,
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Get the investigation start time from the event log.
|
|
403
|
+
*
|
|
404
|
+
* Looks for the INVESTIGATION_STARTED event and returns its timestamp.
|
|
405
|
+
*
|
|
406
|
+
* @param inv - The investigation
|
|
407
|
+
* @returns The start timestamp string or undefined if not found
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* const startedAt = getStartedAt(investigation);
|
|
412
|
+
* if (startedAt) {
|
|
413
|
+
* console.log(`Started: ${startedAt}`);
|
|
414
|
+
* }
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
export function getStartedAt(inv: CyvestInvestigation): string | undefined {
|
|
418
|
+
const event = inv.audit_log?.find(
|
|
419
|
+
(e) => e.event_type === "INVESTIGATION_STARTED"
|
|
420
|
+
);
|
|
421
|
+
return event?.timestamp;
|
|
422
|
+
}
|
package/src/types.generated.ts
CHANGED
|
@@ -15,15 +15,15 @@ export type Justification = string | null;
|
|
|
15
15
|
* List of whitelist entries applied to this investigation.
|
|
16
16
|
*/
|
|
17
17
|
export type Whitelists = InvestigationWhitelist[];
|
|
18
|
+
/**
|
|
19
|
+
* Append-only investigation audit log. Null when serialization disabled audit.
|
|
20
|
+
*/
|
|
21
|
+
export type AuditLog = AuditEvent[] | null;
|
|
18
22
|
export type Actor = string | null;
|
|
19
23
|
export type Reason = string | null;
|
|
20
24
|
export type Tool = string | null;
|
|
21
25
|
export type ObjectType = string | null;
|
|
22
26
|
export type ObjectKey = string | null;
|
|
23
|
-
/**
|
|
24
|
-
* Append-only investigation audit log.
|
|
25
|
-
*/
|
|
26
|
-
export type EventLog = AuditEvent[];
|
|
27
27
|
export type ThreatIntels = string[];
|
|
28
28
|
/**
|
|
29
29
|
* Direction of a relationship between observables.
|
|
@@ -66,10 +66,6 @@ export interface CyvestInvestigation {
|
|
|
66
66
|
*/
|
|
67
67
|
investigation_id: string;
|
|
68
68
|
investigation_name?: InvestigationName;
|
|
69
|
-
/**
|
|
70
|
-
* Investigation start time (UTC).
|
|
71
|
-
*/
|
|
72
|
-
started_at: string;
|
|
73
69
|
/**
|
|
74
70
|
* Global investigation score.
|
|
75
71
|
*/
|
|
@@ -80,7 +76,7 @@ export interface CyvestInvestigation {
|
|
|
80
76
|
*/
|
|
81
77
|
whitelisted: boolean;
|
|
82
78
|
whitelists: Whitelists;
|
|
83
|
-
|
|
79
|
+
audit_log?: AuditLog;
|
|
84
80
|
observables: Observables;
|
|
85
81
|
checks: Checks;
|
|
86
82
|
threat_intels: ThreatIntels1;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getAllContainers,
|
|
19
19
|
getAllObservables,
|
|
20
20
|
getCounts,
|
|
21
|
+
getStartedAt,
|
|
21
22
|
// Finders
|
|
22
23
|
findObservablesByType,
|
|
23
24
|
findObservablesByLevel,
|
|
@@ -43,11 +44,19 @@ function createTestInvestigation(): CyvestInvestigation {
|
|
|
43
44
|
return {
|
|
44
45
|
investigation_id: "01HXYZTESTINVESTIGATION",
|
|
45
46
|
investigation_name: "Test Investigation",
|
|
46
|
-
started_at: "2024-01-01T00:00:00Z",
|
|
47
47
|
score: 7.5,
|
|
48
48
|
score_display: "7.50",
|
|
49
49
|
level: "MALICIOUS",
|
|
50
50
|
whitelisted: false,
|
|
51
|
+
audit_log: [
|
|
52
|
+
{
|
|
53
|
+
event_id: "01HXYZTESTEVENT001",
|
|
54
|
+
timestamp: "2024-01-01T00:00:00Z",
|
|
55
|
+
event_type: "INVESTIGATION_STARTED",
|
|
56
|
+
object_type: "investigation",
|
|
57
|
+
object_key: "01HXYZTESTINVESTIGATION",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
51
60
|
whitelists: [
|
|
52
61
|
{
|
|
53
62
|
identifier: "wl-1",
|
|
@@ -340,6 +349,25 @@ describe("Getters", () => {
|
|
|
340
349
|
expect(counts.whitelists).toBe(1);
|
|
341
350
|
});
|
|
342
351
|
});
|
|
352
|
+
|
|
353
|
+
describe("getStartedAt", () => {
|
|
354
|
+
it("returns timestamp from INVESTIGATION_STARTED event", () => {
|
|
355
|
+
const startedAt = getStartedAt(inv);
|
|
356
|
+
expect(startedAt).toBe("2024-01-01T00:00:00Z");
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
it("returns undefined when no audit_log", () => {
|
|
360
|
+
const invWithoutAuditLog = { ...inv, audit_log: undefined };
|
|
361
|
+
const startedAt = getStartedAt(invWithoutAuditLog);
|
|
362
|
+
expect(startedAt).toBeUndefined();
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it("returns undefined when no INVESTIGATION_STARTED event", () => {
|
|
366
|
+
const invWithEmptyLog = { ...inv, audit_log: [] };
|
|
367
|
+
const startedAt = getStartedAt(invWithEmptyLog);
|
|
368
|
+
expect(startedAt).toBeUndefined();
|
|
369
|
+
});
|
|
370
|
+
});
|
|
343
371
|
});
|
|
344
372
|
|
|
345
373
|
describe("Finders", () => {
|
package/tests/graph.test.ts
CHANGED
|
@@ -22,11 +22,19 @@ function createGraphTestInvestigation(): CyvestInvestigation {
|
|
|
22
22
|
return {
|
|
23
23
|
investigation_id: "01HXYZGRAPHINVESTIGATION",
|
|
24
24
|
investigation_name: "Graph Test Investigation",
|
|
25
|
-
started_at: "2024-01-01T00:00:00Z",
|
|
26
25
|
score: 5,
|
|
27
26
|
score_display: "5.00",
|
|
28
27
|
level: "MALICIOUS",
|
|
29
28
|
whitelisted: false,
|
|
29
|
+
audit_log: [
|
|
30
|
+
{
|
|
31
|
+
event_id: "01HXYZTESTEVENT001",
|
|
32
|
+
timestamp: "2024-01-01T00:00:00Z",
|
|
33
|
+
event_type: "INVESTIGATION_STARTED",
|
|
34
|
+
object_type: "investigation",
|
|
35
|
+
object_key: "01HXYZGRAPHINVESTIGATION",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
30
38
|
whitelists: [],
|
|
31
39
|
observables: {
|
|
32
40
|
"obs:email-message:msg1": {
|