runcloud 0.2.215 → 0.2.216
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.
|
@@ -10,21 +10,42 @@ export function processFreshness(scan, now) {
|
|
|
10
10
|
return 'stale';
|
|
11
11
|
return 'fresh';
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const unknownScanStatuses = ['unreachable', 'incomplete', 'unprivileged', 'unknown', 'failed', 'error'];
|
|
14
|
+
export function lastKnownIocResult(scan) {
|
|
15
|
+
if (!scan?.observedAt || !(scan.iocs ?? []).length)
|
|
15
16
|
return null;
|
|
17
|
+
const by = (status) => (scan.iocs ?? []).filter(ioc => ioc.status === status || (status === 'contained' && ioc.contained)).length;
|
|
18
|
+
const parts = [['present', by('present') + by('active')], ['contained', by('contained')], ['unknown', by('unknown')]]
|
|
19
|
+
.filter(([, count]) => count > 0).map(([label, count]) => `${count} ${label}`);
|
|
20
|
+
return parts.length ? `IOC families ${parts.join(', ')}` : 'no IOC family detected';
|
|
21
|
+
}
|
|
22
|
+
export function processSecurityAlert(scan, held = false, options = {}) {
|
|
23
|
+
const lastKnown = lastKnownIocResult(scan);
|
|
24
|
+
if (options.neverContact)
|
|
25
|
+
return { state: 'compromised', lastKnown, observedAt: scan?.observedAt ?? null,
|
|
26
|
+
label: 'Known compromised · collection stopped on purpose (never-contact list)' };
|
|
27
|
+
if (!scan)
|
|
28
|
+
return { state: 'unknown', label: 'IOC scan not reported · treat as unverified', observedAt: null, lastKnown };
|
|
16
29
|
const strongIocs = (scan.iocs ?? []).filter(ioc => ['present', 'active'].includes(ioc.status) && ((ioc.signals ?? []).some(signal => ['binary_hash', 'running_hash'].includes(signal)) ||
|
|
17
30
|
((ioc.signals ?? []).includes('original_path') && (ioc.signals ?? []).some(signal => ['plist_hash', 'loaded_label', 'root_daemon', 'running_path'].includes(signal)))));
|
|
18
31
|
const knownFindings = (scan.findings ?? []).filter(finding => finding.reason === 'known_ioc' && finding.confidence === 'high');
|
|
19
32
|
const contained = (scan.iocs ?? []).filter(ioc => ioc.contained || ioc.status === 'contained');
|
|
20
33
|
const detected = scan.status === 'critical' || strongIocs.length > 0 || knownFindings.length > 0;
|
|
21
|
-
if (!detected &&
|
|
22
|
-
|
|
34
|
+
if (!detected && !contained.length) {
|
|
35
|
+
const unknown = !scan.observedAt || scan.error || scan.sourceUnavailable || unknownScanStatuses.includes(scan.status)
|
|
36
|
+
|| ['partial', 'skipped'].includes(scan.coverage?.iocs ?? '') || scan.root === false
|
|
37
|
+
|| (scan.iocs ?? []).some(ioc => ioc.status === 'unknown');
|
|
38
|
+
return unknown ? { state: 'unknown', label: `IOC scan ${scan.error ?? scan.status} · treat as unverified`, observedAt: scan.observedAt, lastKnown } : null;
|
|
39
|
+
}
|
|
23
40
|
const timestamps = (detected ? [...strongIocs.map(ioc => ioc.lastObservedAt), ...knownFindings.map(finding => finding.lastObservedAt)]
|
|
24
41
|
: contained.map(ioc => ioc.lastObservedAt)).filter((value) => !!value && Number.isFinite(Date.parse(value)));
|
|
25
42
|
const observedAt = timestamps.sort((a, b) => Date.parse(b) - Date.parse(a))[0] ?? scan.observedAt;
|
|
26
|
-
return detected ? { state: 'detected', label: 'Known malware detected', observedAt }
|
|
27
|
-
: { state: 'contained-hold', label: 'Malware contained · hold reported', observedAt }
|
|
43
|
+
return detected ? { state: 'detected', label: 'Known malware detected', observedAt, lastKnown }
|
|
44
|
+
: held ? { state: 'contained-hold', label: 'Malware contained · hold reported', observedAt, lastKnown }
|
|
45
|
+
: { state: 'contained', label: 'Malware contained · no hold reported', observedAt, lastKnown };
|
|
46
|
+
}
|
|
47
|
+
export function securityOverridesHold(alert) {
|
|
48
|
+
return !!alert && alert.state !== 'unknown';
|
|
28
49
|
}
|
|
29
50
|
export function leaseStateLabel(state) {
|
|
30
51
|
return { accepting: 'Lease gate open', rejecting: 'Lease gate closed', unknown: 'Lease gate unknown', held: 'Operator hold' }[state] ?? state;
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.2.
|
|
1
|
+
export const CLI_VERSION = '0.2.216';
|
package/package.json
CHANGED
|
Binary file
|
package/runcloud-0.2.215.tgz
DELETED
|
Binary file
|