chainlesschain 0.66.0 → 0.132.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/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
|
@@ -16,6 +16,36 @@ import {
|
|
|
16
16
|
listPolicies,
|
|
17
17
|
addPolicy,
|
|
18
18
|
checkAccess,
|
|
19
|
+
EVIDENCE_STATUS_V2,
|
|
20
|
+
POLICY_STATUS_V2,
|
|
21
|
+
REPORT_STATUS_V2,
|
|
22
|
+
SEVERITY_V2,
|
|
23
|
+
FRAMEWORKS_V2,
|
|
24
|
+
POLICY_TYPES_V2,
|
|
25
|
+
COMPLIANCE_DEFAULT_MAX_ACTIVE_POLICIES,
|
|
26
|
+
COMPLIANCE_DEFAULT_EVIDENCE_RETENTION_MS,
|
|
27
|
+
COMPLIANCE_DEFAULT_REPORT_RETENTION_MS,
|
|
28
|
+
setMaxActivePolicies,
|
|
29
|
+
setEvidenceRetentionMs,
|
|
30
|
+
setReportRetentionMs,
|
|
31
|
+
getMaxActivePolicies,
|
|
32
|
+
getEvidenceRetentionMs,
|
|
33
|
+
getReportRetentionMs,
|
|
34
|
+
getActivePolicyCount,
|
|
35
|
+
registerEvidenceV2,
|
|
36
|
+
getEvidenceStatusV2,
|
|
37
|
+
setEvidenceStatusV2,
|
|
38
|
+
autoExpireEvidence,
|
|
39
|
+
registerPolicyV2,
|
|
40
|
+
getPolicyStatusV2,
|
|
41
|
+
setPolicyStatusV2,
|
|
42
|
+
activatePolicy,
|
|
43
|
+
registerReportV2,
|
|
44
|
+
getReportStatusV2,
|
|
45
|
+
setReportStatusV2,
|
|
46
|
+
publishReport,
|
|
47
|
+
autoArchiveStaleReports,
|
|
48
|
+
getComplianceStatsV2,
|
|
19
49
|
} from "../lib/compliance-manager.js";
|
|
20
50
|
import {
|
|
21
51
|
generateFrameworkReport,
|
|
@@ -29,6 +59,38 @@ import {
|
|
|
29
59
|
matchObservable,
|
|
30
60
|
getStats as getThreatIntelStats,
|
|
31
61
|
removeIndicator,
|
|
62
|
+
FEED_MATURITY_V2,
|
|
63
|
+
INDICATOR_LIFECYCLE_V2,
|
|
64
|
+
getMaxActiveFeedsPerOwnerV2,
|
|
65
|
+
setMaxActiveFeedsPerOwnerV2,
|
|
66
|
+
getMaxActiveIndicatorsPerFeedV2,
|
|
67
|
+
setMaxActiveIndicatorsPerFeedV2,
|
|
68
|
+
getFeedIdleMsV2,
|
|
69
|
+
setFeedIdleMsV2,
|
|
70
|
+
getIndicatorStaleMsV2,
|
|
71
|
+
setIndicatorStaleMsV2,
|
|
72
|
+
getActiveFeedCountV2,
|
|
73
|
+
getActiveIndicatorCountV2,
|
|
74
|
+
registerFeedV2,
|
|
75
|
+
getFeedV2,
|
|
76
|
+
listFeedsV2,
|
|
77
|
+
setFeedMaturityV2,
|
|
78
|
+
trustFeedV2,
|
|
79
|
+
deprecateFeedV2,
|
|
80
|
+
retireFeedV2,
|
|
81
|
+
touchFeedV2,
|
|
82
|
+
createIndicatorV2,
|
|
83
|
+
getIndicatorV2,
|
|
84
|
+
listIndicatorsV2,
|
|
85
|
+
setIndicatorStatusV2,
|
|
86
|
+
activateIndicatorV2,
|
|
87
|
+
expireIndicatorV2,
|
|
88
|
+
revokeIndicatorV2,
|
|
89
|
+
supersedeIndicatorV2,
|
|
90
|
+
refreshIndicatorV2,
|
|
91
|
+
autoDeprecateIdleFeedsV2,
|
|
92
|
+
autoExpireStaleIndicatorsV2,
|
|
93
|
+
getThreatIntelStatsV2,
|
|
32
94
|
} from "../lib/threat-intel.js";
|
|
33
95
|
import { IOC_TYPES } from "../lib/stix-parser.js";
|
|
34
96
|
import {
|
|
@@ -40,6 +102,37 @@ import {
|
|
|
40
102
|
detectAnomalies,
|
|
41
103
|
rankEntities,
|
|
42
104
|
scoreEvent,
|
|
105
|
+
BASELINE_MATURITY_V2,
|
|
106
|
+
INVESTIGATION_V2,
|
|
107
|
+
getMaxActiveBaselinesPerOwnerV2,
|
|
108
|
+
setMaxActiveBaselinesPerOwnerV2,
|
|
109
|
+
getMaxOpenInvestigationsPerAnalystV2,
|
|
110
|
+
setMaxOpenInvestigationsPerAnalystV2,
|
|
111
|
+
getBaselineStaleMsV2,
|
|
112
|
+
setBaselineStaleMsV2,
|
|
113
|
+
getInvestigationStuckMsV2,
|
|
114
|
+
setInvestigationStuckMsV2,
|
|
115
|
+
getActiveBaselineCountV2,
|
|
116
|
+
getOpenInvestigationCountV2,
|
|
117
|
+
createBaselineV2,
|
|
118
|
+
getBaselineV2,
|
|
119
|
+
listBaselinesV2,
|
|
120
|
+
setBaselineMaturityV2,
|
|
121
|
+
activateBaselineV2,
|
|
122
|
+
markBaselineStaleV2,
|
|
123
|
+
archiveBaselineV2,
|
|
124
|
+
refreshBaselineV2,
|
|
125
|
+
openInvestigationV2,
|
|
126
|
+
getInvestigationV2,
|
|
127
|
+
listInvestigationsV2,
|
|
128
|
+
setInvestigationStatusV2,
|
|
129
|
+
startInvestigationV2,
|
|
130
|
+
closeInvestigationV2,
|
|
131
|
+
dismissInvestigationV2,
|
|
132
|
+
escalateInvestigationV2,
|
|
133
|
+
autoMarkStaleBaselinesV2,
|
|
134
|
+
autoEscalateStuckInvestigationsV2,
|
|
135
|
+
getUebaStatsV2,
|
|
43
136
|
} from "../lib/ueba.js";
|
|
44
137
|
|
|
45
138
|
function _loadEvidenceFromDb(db, framework) {
|
|
@@ -545,6 +638,260 @@ export function registerComplianceCommand(program) {
|
|
|
545
638
|
}
|
|
546
639
|
});
|
|
547
640
|
|
|
641
|
+
/* ═══ Threat-Intel V2 — feed maturity + indicator lifecycle ═══ */
|
|
642
|
+
|
|
643
|
+
threat
|
|
644
|
+
.command("feed-maturities-v2")
|
|
645
|
+
.description("List feed maturity states (V2)")
|
|
646
|
+
.action(() => {
|
|
647
|
+
for (const v of Object.values(FEED_MATURITY_V2)) console.log(` ${v}`);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
threat
|
|
651
|
+
.command("indicator-lifecycles-v2")
|
|
652
|
+
.description("List indicator lifecycle states (V2)")
|
|
653
|
+
.action(() => {
|
|
654
|
+
for (const v of Object.values(INDICATOR_LIFECYCLE_V2))
|
|
655
|
+
console.log(` ${v}`);
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
threat
|
|
659
|
+
.command("stats-v2")
|
|
660
|
+
.description("Show V2 feed/indicator stats")
|
|
661
|
+
.action(() => {
|
|
662
|
+
console.log(JSON.stringify(getThreatIntelStatsV2(), null, 2));
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
threat
|
|
666
|
+
.command("max-active-feeds-per-owner")
|
|
667
|
+
.argument("[n]", "New cap")
|
|
668
|
+
.description("Get/set max active feeds per owner (V2)")
|
|
669
|
+
.action((n) => {
|
|
670
|
+
if (n !== undefined) setMaxActiveFeedsPerOwnerV2(n);
|
|
671
|
+
console.log(getMaxActiveFeedsPerOwnerV2());
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
threat
|
|
675
|
+
.command("max-active-indicators-per-feed")
|
|
676
|
+
.argument("[n]", "New cap")
|
|
677
|
+
.description("Get/set max active indicators per feed (V2)")
|
|
678
|
+
.action((n) => {
|
|
679
|
+
if (n !== undefined) setMaxActiveIndicatorsPerFeedV2(n);
|
|
680
|
+
console.log(getMaxActiveIndicatorsPerFeedV2());
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
threat
|
|
684
|
+
.command("feed-idle-ms")
|
|
685
|
+
.argument("[ms]", "New idle window")
|
|
686
|
+
.description("Get/set feed idle window ms (V2)")
|
|
687
|
+
.action((ms) => {
|
|
688
|
+
if (ms !== undefined) setFeedIdleMsV2(ms);
|
|
689
|
+
console.log(getFeedIdleMsV2());
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
threat
|
|
693
|
+
.command("indicator-stale-ms")
|
|
694
|
+
.argument("[ms]", "New stale window")
|
|
695
|
+
.description("Get/set indicator stale window ms (V2)")
|
|
696
|
+
.action((ms) => {
|
|
697
|
+
if (ms !== undefined) setIndicatorStaleMsV2(ms);
|
|
698
|
+
console.log(getIndicatorStaleMsV2());
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
threat
|
|
702
|
+
.command("active-feed-count-v2 <owner>")
|
|
703
|
+
.description("Count active feeds for owner (V2)")
|
|
704
|
+
.action((owner) => {
|
|
705
|
+
console.log(getActiveFeedCountV2(owner));
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
threat
|
|
709
|
+
.command("active-indicator-count-v2 <feedId>")
|
|
710
|
+
.description("Count active indicators for feed (V2)")
|
|
711
|
+
.action((feedId) => {
|
|
712
|
+
console.log(getActiveIndicatorCountV2(feedId));
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
threat
|
|
716
|
+
.command("register-feed-v2 <id>")
|
|
717
|
+
.requiredOption("-o, --owner <owner>", "Owner")
|
|
718
|
+
.requiredOption("-n, --name <name>", "Feed name")
|
|
719
|
+
.description("Register a new pending feed (V2)")
|
|
720
|
+
.action((id, opts) => {
|
|
721
|
+
console.log(
|
|
722
|
+
JSON.stringify(
|
|
723
|
+
registerFeedV2(id, { owner: opts.owner, name: opts.name }),
|
|
724
|
+
null,
|
|
725
|
+
2,
|
|
726
|
+
),
|
|
727
|
+
);
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
threat
|
|
731
|
+
.command("feed-v2 <id>")
|
|
732
|
+
.description("Show feed by id (V2)")
|
|
733
|
+
.action((id) => {
|
|
734
|
+
const f = getFeedV2(id);
|
|
735
|
+
if (!f) {
|
|
736
|
+
console.error(`feed ${id} not found`);
|
|
737
|
+
process.exit(1);
|
|
738
|
+
}
|
|
739
|
+
console.log(JSON.stringify(f, null, 2));
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
threat
|
|
743
|
+
.command("list-feeds-v2")
|
|
744
|
+
.option("-o, --owner <owner>", "Filter by owner")
|
|
745
|
+
.option("-m, --maturity <m>", "Filter by maturity")
|
|
746
|
+
.description("List feeds (V2)")
|
|
747
|
+
.action((opts) => {
|
|
748
|
+
console.log(
|
|
749
|
+
JSON.stringify(
|
|
750
|
+
listFeedsV2({ owner: opts.owner, maturity: opts.maturity }),
|
|
751
|
+
null,
|
|
752
|
+
2,
|
|
753
|
+
),
|
|
754
|
+
);
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
threat
|
|
758
|
+
.command("set-feed-maturity-v2 <id> <next>")
|
|
759
|
+
.description("Transition feed maturity (V2)")
|
|
760
|
+
.action((id, next) => {
|
|
761
|
+
console.log(JSON.stringify(setFeedMaturityV2(id, next), null, 2));
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
threat
|
|
765
|
+
.command("trust-feed-v2 <id>")
|
|
766
|
+
.description("Trust feed (V2)")
|
|
767
|
+
.action((id) => {
|
|
768
|
+
console.log(JSON.stringify(trustFeedV2(id), null, 2));
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
threat
|
|
772
|
+
.command("deprecate-feed-v2 <id>")
|
|
773
|
+
.description("Deprecate feed (V2)")
|
|
774
|
+
.action((id) => {
|
|
775
|
+
console.log(JSON.stringify(deprecateFeedV2(id), null, 2));
|
|
776
|
+
});
|
|
777
|
+
|
|
778
|
+
threat
|
|
779
|
+
.command("retire-feed-v2 <id>")
|
|
780
|
+
.description("Retire feed terminally (V2)")
|
|
781
|
+
.action((id) => {
|
|
782
|
+
console.log(JSON.stringify(retireFeedV2(id), null, 2));
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
threat
|
|
786
|
+
.command("touch-feed-v2 <id>")
|
|
787
|
+
.description("Update feed lastSeenAt (V2)")
|
|
788
|
+
.action((id) => {
|
|
789
|
+
console.log(JSON.stringify(touchFeedV2(id), null, 2));
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
threat
|
|
793
|
+
.command("create-indicator-v2 <id>")
|
|
794
|
+
.requiredOption("-f, --feed <feedId>", "Feed id")
|
|
795
|
+
.requiredOption("-t, --type <iocType>", "IoC type")
|
|
796
|
+
.requiredOption("-v, --value <value>", "IoC value")
|
|
797
|
+
.description("Create a pending indicator under a feed (V2)")
|
|
798
|
+
.action((id, opts) => {
|
|
799
|
+
console.log(
|
|
800
|
+
JSON.stringify(
|
|
801
|
+
createIndicatorV2(id, {
|
|
802
|
+
feedId: opts.feed,
|
|
803
|
+
iocType: opts.type,
|
|
804
|
+
value: opts.value,
|
|
805
|
+
}),
|
|
806
|
+
null,
|
|
807
|
+
2,
|
|
808
|
+
),
|
|
809
|
+
);
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
threat
|
|
813
|
+
.command("indicator-v2 <id>")
|
|
814
|
+
.description("Show indicator by id (V2)")
|
|
815
|
+
.action((id) => {
|
|
816
|
+
const i = getIndicatorV2(id);
|
|
817
|
+
if (!i) {
|
|
818
|
+
console.error(`indicator ${id} not found`);
|
|
819
|
+
process.exit(1);
|
|
820
|
+
}
|
|
821
|
+
console.log(JSON.stringify(i, null, 2));
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
threat
|
|
825
|
+
.command("list-indicators-v2")
|
|
826
|
+
.option("-f, --feed <feedId>", "Filter by feedId")
|
|
827
|
+
.option("-s, --status <s>", "Filter by status")
|
|
828
|
+
.description("List indicators (V2)")
|
|
829
|
+
.action((opts) => {
|
|
830
|
+
console.log(
|
|
831
|
+
JSON.stringify(
|
|
832
|
+
listIndicatorsV2({ feedId: opts.feed, status: opts.status }),
|
|
833
|
+
null,
|
|
834
|
+
2,
|
|
835
|
+
),
|
|
836
|
+
);
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
threat
|
|
840
|
+
.command("set-indicator-status-v2 <id> <next>")
|
|
841
|
+
.description("Transition indicator status (V2)")
|
|
842
|
+
.action((id, next) => {
|
|
843
|
+
console.log(JSON.stringify(setIndicatorStatusV2(id, next), null, 2));
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
threat
|
|
847
|
+
.command("activate-indicator-v2 <id>")
|
|
848
|
+
.description("Activate indicator (V2)")
|
|
849
|
+
.action((id) => {
|
|
850
|
+
console.log(JSON.stringify(activateIndicatorV2(id), null, 2));
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
threat
|
|
854
|
+
.command("expire-indicator-v2 <id>")
|
|
855
|
+
.description("Expire indicator terminally (V2)")
|
|
856
|
+
.action((id) => {
|
|
857
|
+
console.log(JSON.stringify(expireIndicatorV2(id), null, 2));
|
|
858
|
+
});
|
|
859
|
+
|
|
860
|
+
threat
|
|
861
|
+
.command("revoke-indicator-v2 <id>")
|
|
862
|
+
.description("Revoke indicator terminally (V2)")
|
|
863
|
+
.action((id) => {
|
|
864
|
+
console.log(JSON.stringify(revokeIndicatorV2(id), null, 2));
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
threat
|
|
868
|
+
.command("supersede-indicator-v2 <id>")
|
|
869
|
+
.description("Supersede indicator terminally (V2)")
|
|
870
|
+
.action((id) => {
|
|
871
|
+
console.log(JSON.stringify(supersedeIndicatorV2(id), null, 2));
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
threat
|
|
875
|
+
.command("refresh-indicator-v2 <id>")
|
|
876
|
+
.description("Update indicator lastSeenAt (V2)")
|
|
877
|
+
.action((id) => {
|
|
878
|
+
console.log(JSON.stringify(refreshIndicatorV2(id), null, 2));
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
threat
|
|
882
|
+
.command("auto-deprecate-idle-feeds")
|
|
883
|
+
.description("Auto-deprecate trusted feeds idle past window (V2)")
|
|
884
|
+
.action(() => {
|
|
885
|
+
console.log(JSON.stringify(autoDeprecateIdleFeedsV2(), null, 2));
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
threat
|
|
889
|
+
.command("auto-expire-stale-indicators")
|
|
890
|
+
.description("Auto-expire active indicators stale past window (V2)")
|
|
891
|
+
.action(() => {
|
|
892
|
+
console.log(JSON.stringify(autoExpireStaleIndicatorsV2(), null, 2));
|
|
893
|
+
});
|
|
894
|
+
|
|
548
895
|
// ── UEBA ────────────────────────────────────────────────────
|
|
549
896
|
const ueba = compliance
|
|
550
897
|
.command("ueba")
|
|
@@ -804,4 +1151,692 @@ export function registerComplianceCommand(program) {
|
|
|
804
1151
|
process.exit(1);
|
|
805
1152
|
}
|
|
806
1153
|
});
|
|
1154
|
+
|
|
1155
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
1156
|
+
V2 SURFACE (Phase 19 canonical) — compliance V2 subcommands
|
|
1157
|
+
═══════════════════════════════════════════════════════════════ */
|
|
1158
|
+
|
|
1159
|
+
const parseMeta = (s) => {
|
|
1160
|
+
if (!s) return {};
|
|
1161
|
+
try {
|
|
1162
|
+
return JSON.parse(s);
|
|
1163
|
+
} catch {
|
|
1164
|
+
return {};
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1168
|
+
compliance
|
|
1169
|
+
.command("evidence-statuses-v2")
|
|
1170
|
+
.description("List evidence V2 lifecycle states")
|
|
1171
|
+
.action(() => {
|
|
1172
|
+
for (const v of Object.values(EVIDENCE_STATUS_V2)) console.log(" " + v);
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
compliance
|
|
1176
|
+
.command("policy-statuses-v2")
|
|
1177
|
+
.description("List policy V2 lifecycle states")
|
|
1178
|
+
.action(() => {
|
|
1179
|
+
for (const v of Object.values(POLICY_STATUS_V2)) console.log(" " + v);
|
|
1180
|
+
});
|
|
1181
|
+
|
|
1182
|
+
compliance
|
|
1183
|
+
.command("report-statuses-v2")
|
|
1184
|
+
.description("List report V2 lifecycle states")
|
|
1185
|
+
.action(() => {
|
|
1186
|
+
for (const v of Object.values(REPORT_STATUS_V2)) console.log(" " + v);
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
compliance
|
|
1190
|
+
.command("severities-v2")
|
|
1191
|
+
.description("List V2 severity buckets")
|
|
1192
|
+
.action(() => {
|
|
1193
|
+
for (const v of Object.values(SEVERITY_V2)) console.log(" " + v);
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
compliance
|
|
1197
|
+
.command("frameworks-v2")
|
|
1198
|
+
.description("List V2 supported frameworks")
|
|
1199
|
+
.action(() => {
|
|
1200
|
+
for (const v of FRAMEWORKS_V2) console.log(" " + v);
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
compliance
|
|
1204
|
+
.command("policy-types-v2")
|
|
1205
|
+
.description("List V2 supported policy types")
|
|
1206
|
+
.action(() => {
|
|
1207
|
+
for (const v of POLICY_TYPES_V2) console.log(" " + v);
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
compliance
|
|
1211
|
+
.command("default-max-active-policies")
|
|
1212
|
+
.description("Show default max-active-policies cap")
|
|
1213
|
+
.action(() => console.log(COMPLIANCE_DEFAULT_MAX_ACTIVE_POLICIES));
|
|
1214
|
+
|
|
1215
|
+
compliance
|
|
1216
|
+
.command("max-active-policies")
|
|
1217
|
+
.description("Show current max-active-policies cap")
|
|
1218
|
+
.action(() => console.log(getMaxActivePolicies()));
|
|
1219
|
+
|
|
1220
|
+
compliance
|
|
1221
|
+
.command("set-max-active-policies <n>")
|
|
1222
|
+
.description("Set max-active-policies cap")
|
|
1223
|
+
.action((n) => {
|
|
1224
|
+
try {
|
|
1225
|
+
console.log(setMaxActivePolicies(n));
|
|
1226
|
+
} catch (err) {
|
|
1227
|
+
logger.error(err.message);
|
|
1228
|
+
process.exit(1);
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
compliance
|
|
1233
|
+
.command("default-evidence-retention-ms")
|
|
1234
|
+
.description("Show default evidence retention (ms)")
|
|
1235
|
+
.action(() => console.log(COMPLIANCE_DEFAULT_EVIDENCE_RETENTION_MS));
|
|
1236
|
+
|
|
1237
|
+
compliance
|
|
1238
|
+
.command("evidence-retention-ms")
|
|
1239
|
+
.description("Show current evidence retention (ms)")
|
|
1240
|
+
.action(() => console.log(getEvidenceRetentionMs()));
|
|
1241
|
+
|
|
1242
|
+
compliance
|
|
1243
|
+
.command("set-evidence-retention-ms <ms>")
|
|
1244
|
+
.description("Set evidence retention (ms)")
|
|
1245
|
+
.action((ms) => {
|
|
1246
|
+
try {
|
|
1247
|
+
console.log(setEvidenceRetentionMs(ms));
|
|
1248
|
+
} catch (err) {
|
|
1249
|
+
logger.error(err.message);
|
|
1250
|
+
process.exit(1);
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
compliance
|
|
1255
|
+
.command("default-report-retention-ms")
|
|
1256
|
+
.description("Show default report retention (ms)")
|
|
1257
|
+
.action(() => console.log(COMPLIANCE_DEFAULT_REPORT_RETENTION_MS));
|
|
1258
|
+
|
|
1259
|
+
compliance
|
|
1260
|
+
.command("report-retention-ms")
|
|
1261
|
+
.description("Show current report retention (ms)")
|
|
1262
|
+
.action(() => console.log(getReportRetentionMs()));
|
|
1263
|
+
|
|
1264
|
+
compliance
|
|
1265
|
+
.command("set-report-retention-ms <ms>")
|
|
1266
|
+
.description("Set report retention (ms)")
|
|
1267
|
+
.action((ms) => {
|
|
1268
|
+
try {
|
|
1269
|
+
console.log(setReportRetentionMs(ms));
|
|
1270
|
+
} catch (err) {
|
|
1271
|
+
logger.error(err.message);
|
|
1272
|
+
process.exit(1);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
compliance
|
|
1277
|
+
.command("active-policy-count")
|
|
1278
|
+
.description("Show current active-policy count")
|
|
1279
|
+
.option("-f, --framework <fw>", "Filter by framework")
|
|
1280
|
+
.action((options) => {
|
|
1281
|
+
console.log(getActivePolicyCount(options.framework));
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
compliance
|
|
1285
|
+
.command("register-evidence-v2 <evidence-id>")
|
|
1286
|
+
.description("Register a new V2 evidence entry (tagged COLLECTED)")
|
|
1287
|
+
.option("-f, --framework <fw>", "Framework (gdpr|soc2|hipaa|iso27001)")
|
|
1288
|
+
.option("-t, --type <type>", "Evidence type", "general")
|
|
1289
|
+
.option("-d, --description <desc>", "Description")
|
|
1290
|
+
.option("-s, --source <source>", "Source", "cli")
|
|
1291
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
1292
|
+
.action((evidenceId, options) => {
|
|
1293
|
+
try {
|
|
1294
|
+
const r = registerEvidenceV2(null, {
|
|
1295
|
+
evidenceId,
|
|
1296
|
+
framework: options.framework,
|
|
1297
|
+
type: options.type,
|
|
1298
|
+
description: options.description,
|
|
1299
|
+
source: options.source,
|
|
1300
|
+
metadata: parseMeta(options.metadata),
|
|
1301
|
+
});
|
|
1302
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1303
|
+
} catch (err) {
|
|
1304
|
+
logger.error(err.message);
|
|
1305
|
+
process.exit(1);
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
|
|
1309
|
+
compliance
|
|
1310
|
+
.command("evidence-status-v2 <evidence-id>")
|
|
1311
|
+
.description("Show V2 evidence lifecycle entry")
|
|
1312
|
+
.action((evidenceId) => {
|
|
1313
|
+
const r = getEvidenceStatusV2(evidenceId);
|
|
1314
|
+
if (!r) {
|
|
1315
|
+
logger.warn("Evidence not found");
|
|
1316
|
+
process.exit(1);
|
|
1317
|
+
}
|
|
1318
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1319
|
+
});
|
|
1320
|
+
|
|
1321
|
+
compliance
|
|
1322
|
+
.command("set-evidence-status-v2 <evidence-id> <status>")
|
|
1323
|
+
.description(
|
|
1324
|
+
"Transition V2 evidence lifecycle (collected/verified/rejected/expired)",
|
|
1325
|
+
)
|
|
1326
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1327
|
+
.option("-m, --metadata <json>", "Metadata patch JSON")
|
|
1328
|
+
.action((evidenceId, status, options) => {
|
|
1329
|
+
try {
|
|
1330
|
+
const r = setEvidenceStatusV2(null, evidenceId, status, {
|
|
1331
|
+
reason: options.reason,
|
|
1332
|
+
metadata: options.metadata ? parseMeta(options.metadata) : undefined,
|
|
1333
|
+
});
|
|
1334
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1335
|
+
} catch (err) {
|
|
1336
|
+
logger.error(err.message);
|
|
1337
|
+
process.exit(1);
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
|
|
1341
|
+
compliance
|
|
1342
|
+
.command("auto-expire-evidence")
|
|
1343
|
+
.description("Bulk-flip stale evidence to EXPIRED")
|
|
1344
|
+
.action(() => {
|
|
1345
|
+
const r = autoExpireEvidence(null, Date.now());
|
|
1346
|
+
console.log(JSON.stringify({ expired: r.length, entries: r }, null, 2));
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
compliance
|
|
1350
|
+
.command("register-policy-v2 <policy-id>")
|
|
1351
|
+
.description("Register a new V2 policy entry (tagged DRAFT)")
|
|
1352
|
+
.option("-n, --name <name>", "Policy name")
|
|
1353
|
+
.option("-t, --type <type>", "Policy type")
|
|
1354
|
+
.option("-f, --framework <fw>", "Framework")
|
|
1355
|
+
.option(
|
|
1356
|
+
"-s, --severity <sev>",
|
|
1357
|
+
"Severity (critical|high|medium|low)",
|
|
1358
|
+
"medium",
|
|
1359
|
+
)
|
|
1360
|
+
.option("-r, --rules <json>", "Rules JSON")
|
|
1361
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
1362
|
+
.action((policyId, options) => {
|
|
1363
|
+
try {
|
|
1364
|
+
const r = registerPolicyV2(null, {
|
|
1365
|
+
policyId,
|
|
1366
|
+
name: options.name,
|
|
1367
|
+
type: options.type,
|
|
1368
|
+
framework: options.framework,
|
|
1369
|
+
severity: options.severity,
|
|
1370
|
+
rules: parseMeta(options.rules),
|
|
1371
|
+
metadata: parseMeta(options.metadata),
|
|
1372
|
+
});
|
|
1373
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1374
|
+
} catch (err) {
|
|
1375
|
+
logger.error(err.message);
|
|
1376
|
+
process.exit(1);
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
|
|
1380
|
+
compliance
|
|
1381
|
+
.command("policy-status-v2 <policy-id>")
|
|
1382
|
+
.description("Show V2 policy lifecycle entry")
|
|
1383
|
+
.action((policyId) => {
|
|
1384
|
+
const r = getPolicyStatusV2(policyId);
|
|
1385
|
+
if (!r) {
|
|
1386
|
+
logger.warn("Policy not found");
|
|
1387
|
+
process.exit(1);
|
|
1388
|
+
}
|
|
1389
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
compliance
|
|
1393
|
+
.command("set-policy-status-v2 <policy-id> <status>")
|
|
1394
|
+
.description(
|
|
1395
|
+
"Transition V2 policy lifecycle (draft/active/suspended/deprecated)",
|
|
1396
|
+
)
|
|
1397
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1398
|
+
.option("-m, --metadata <json>", "Metadata patch JSON")
|
|
1399
|
+
.action((policyId, status, options) => {
|
|
1400
|
+
try {
|
|
1401
|
+
const r = setPolicyStatusV2(null, policyId, status, {
|
|
1402
|
+
reason: options.reason,
|
|
1403
|
+
metadata: options.metadata ? parseMeta(options.metadata) : undefined,
|
|
1404
|
+
});
|
|
1405
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1406
|
+
} catch (err) {
|
|
1407
|
+
logger.error(err.message);
|
|
1408
|
+
process.exit(1);
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
compliance
|
|
1413
|
+
.command("activate-policy <policy-id>")
|
|
1414
|
+
.description("Activate a V2 policy (DRAFT→ACTIVE, enforces max-active cap)")
|
|
1415
|
+
.action((policyId) => {
|
|
1416
|
+
try {
|
|
1417
|
+
const r = activatePolicy(null, policyId);
|
|
1418
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1419
|
+
} catch (err) {
|
|
1420
|
+
logger.error(err.message);
|
|
1421
|
+
process.exit(1);
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
compliance
|
|
1426
|
+
.command("register-report-v2 <report-id>")
|
|
1427
|
+
.description("Register a new V2 report entry (tagged PENDING)")
|
|
1428
|
+
.option("-f, --framework <fw>", "Framework")
|
|
1429
|
+
.option("-t, --title <title>", "Title")
|
|
1430
|
+
.option("-m, --metadata <json>", "Metadata JSON")
|
|
1431
|
+
.action((reportId, options) => {
|
|
1432
|
+
try {
|
|
1433
|
+
const r = registerReportV2(null, {
|
|
1434
|
+
reportId,
|
|
1435
|
+
framework: options.framework,
|
|
1436
|
+
title: options.title,
|
|
1437
|
+
metadata: parseMeta(options.metadata),
|
|
1438
|
+
});
|
|
1439
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1440
|
+
} catch (err) {
|
|
1441
|
+
logger.error(err.message);
|
|
1442
|
+
process.exit(1);
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
|
|
1446
|
+
compliance
|
|
1447
|
+
.command("report-status-v2 <report-id>")
|
|
1448
|
+
.description("Show V2 report lifecycle entry")
|
|
1449
|
+
.action((reportId) => {
|
|
1450
|
+
const r = getReportStatusV2(reportId);
|
|
1451
|
+
if (!r) {
|
|
1452
|
+
logger.warn("Report not found");
|
|
1453
|
+
process.exit(1);
|
|
1454
|
+
}
|
|
1455
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
compliance
|
|
1459
|
+
.command("set-report-status-v2 <report-id> <status>")
|
|
1460
|
+
.description(
|
|
1461
|
+
"Transition V2 report lifecycle (pending/generating/published/archived)",
|
|
1462
|
+
)
|
|
1463
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1464
|
+
.option("-s, --score <n>", "Score (on publish)")
|
|
1465
|
+
.option("-y, --summary <text>", "Summary (on publish)")
|
|
1466
|
+
.option("-m, --metadata <json>", "Metadata patch JSON")
|
|
1467
|
+
.action((reportId, status, options) => {
|
|
1468
|
+
try {
|
|
1469
|
+
const r = setReportStatusV2(null, reportId, status, {
|
|
1470
|
+
reason: options.reason,
|
|
1471
|
+
score:
|
|
1472
|
+
options.score !== undefined ? Number(options.score) : undefined,
|
|
1473
|
+
summary: options.summary,
|
|
1474
|
+
metadata: options.metadata ? parseMeta(options.metadata) : undefined,
|
|
1475
|
+
});
|
|
1476
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1477
|
+
} catch (err) {
|
|
1478
|
+
logger.error(err.message);
|
|
1479
|
+
process.exit(1);
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
|
|
1483
|
+
compliance
|
|
1484
|
+
.command("publish-report <report-id>")
|
|
1485
|
+
.description("Publish a V2 report (pending→generating→published)")
|
|
1486
|
+
.option("-s, --score <n>", "Score", "0")
|
|
1487
|
+
.option("-y, --summary <text>", "Summary", "")
|
|
1488
|
+
.action((reportId, options) => {
|
|
1489
|
+
try {
|
|
1490
|
+
const r = publishReport(null, reportId, {
|
|
1491
|
+
score: Number(options.score),
|
|
1492
|
+
summary: options.summary,
|
|
1493
|
+
});
|
|
1494
|
+
console.log(JSON.stringify(r, null, 2));
|
|
1495
|
+
} catch (err) {
|
|
1496
|
+
logger.error(err.message);
|
|
1497
|
+
process.exit(1);
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
|
|
1501
|
+
compliance
|
|
1502
|
+
.command("auto-archive-stale-reports")
|
|
1503
|
+
.description("Bulk-flip stale published reports to ARCHIVED")
|
|
1504
|
+
.action(() => {
|
|
1505
|
+
const r = autoArchiveStaleReports(null, Date.now());
|
|
1506
|
+
console.log(JSON.stringify({ archived: r.length, entries: r }, null, 2));
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1509
|
+
compliance
|
|
1510
|
+
.command("stats-v2")
|
|
1511
|
+
.description("V2 compliance stats (all-enum-key zero-initialized)")
|
|
1512
|
+
.action(() => {
|
|
1513
|
+
console.log(JSON.stringify(getComplianceStatsV2(), null, 2));
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
/* ═══ UEBA V2 ═══ */
|
|
1517
|
+
|
|
1518
|
+
function _parseMetaUeba(s) {
|
|
1519
|
+
if (!s) return undefined;
|
|
1520
|
+
try {
|
|
1521
|
+
return JSON.parse(s);
|
|
1522
|
+
} catch {
|
|
1523
|
+
throw new Error("--metadata must be valid JSON");
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
ueba
|
|
1528
|
+
.command("baseline-maturities-v2")
|
|
1529
|
+
.description("List baseline maturity states (V2)")
|
|
1530
|
+
.action(() => {
|
|
1531
|
+
for (const v of Object.values(BASELINE_MATURITY_V2)) logger.log(` ${v}`);
|
|
1532
|
+
});
|
|
1533
|
+
|
|
1534
|
+
ueba
|
|
1535
|
+
.command("investigation-lifecycles-v2")
|
|
1536
|
+
.description("List investigation lifecycle states (V2)")
|
|
1537
|
+
.action(() => {
|
|
1538
|
+
for (const v of Object.values(INVESTIGATION_V2)) logger.log(` ${v}`);
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1541
|
+
ueba
|
|
1542
|
+
.command("stats-v2")
|
|
1543
|
+
.description("UEBA V2 stats")
|
|
1544
|
+
.action(() => {
|
|
1545
|
+
console.log(JSON.stringify(getUebaStatsV2(), null, 2));
|
|
1546
|
+
});
|
|
1547
|
+
|
|
1548
|
+
ueba
|
|
1549
|
+
.command("max-active-baselines-per-owner")
|
|
1550
|
+
.description("Get/set max active baselines per owner (V2)")
|
|
1551
|
+
.option("-s, --set <n>", "Set value", (v) => parseInt(v, 10))
|
|
1552
|
+
.action((o) => {
|
|
1553
|
+
if (typeof o.set === "number")
|
|
1554
|
+
console.log(setMaxActiveBaselinesPerOwnerV2(o.set));
|
|
1555
|
+
else console.log(getMaxActiveBaselinesPerOwnerV2());
|
|
1556
|
+
});
|
|
1557
|
+
|
|
1558
|
+
ueba
|
|
1559
|
+
.command("max-open-investigations-per-analyst")
|
|
1560
|
+
.description("Get/set max open investigations per analyst (V2)")
|
|
1561
|
+
.option("-s, --set <n>", "Set value", (v) => parseInt(v, 10))
|
|
1562
|
+
.action((o) => {
|
|
1563
|
+
if (typeof o.set === "number")
|
|
1564
|
+
console.log(setMaxOpenInvestigationsPerAnalystV2(o.set));
|
|
1565
|
+
else console.log(getMaxOpenInvestigationsPerAnalystV2());
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1568
|
+
ueba
|
|
1569
|
+
.command("baseline-stale-ms")
|
|
1570
|
+
.description("Get/set baseline stale threshold ms (V2)")
|
|
1571
|
+
.option("-s, --set <n>", "Set value", (v) => parseInt(v, 10))
|
|
1572
|
+
.action((o) => {
|
|
1573
|
+
if (typeof o.set === "number") console.log(setBaselineStaleMsV2(o.set));
|
|
1574
|
+
else console.log(getBaselineStaleMsV2());
|
|
1575
|
+
});
|
|
1576
|
+
|
|
1577
|
+
ueba
|
|
1578
|
+
.command("investigation-stuck-ms")
|
|
1579
|
+
.description("Get/set investigation stuck threshold ms (V2)")
|
|
1580
|
+
.option("-s, --set <n>", "Set value", (v) => parseInt(v, 10))
|
|
1581
|
+
.action((o) => {
|
|
1582
|
+
if (typeof o.set === "number")
|
|
1583
|
+
console.log(setInvestigationStuckMsV2(o.set));
|
|
1584
|
+
else console.log(getInvestigationStuckMsV2());
|
|
1585
|
+
});
|
|
1586
|
+
|
|
1587
|
+
ueba
|
|
1588
|
+
.command("active-baseline-count")
|
|
1589
|
+
.description("Count active baselines for owner (V2)")
|
|
1590
|
+
.requiredOption("-o, --owner <owner>", "Owner")
|
|
1591
|
+
.action((o) => {
|
|
1592
|
+
console.log(getActiveBaselineCountV2(o.owner));
|
|
1593
|
+
});
|
|
1594
|
+
|
|
1595
|
+
ueba
|
|
1596
|
+
.command("open-investigation-count")
|
|
1597
|
+
.description("Count open investigations for analyst (V2)")
|
|
1598
|
+
.requiredOption("-a, --analyst <analyst>", "Analyst")
|
|
1599
|
+
.action((o) => {
|
|
1600
|
+
console.log(getOpenInvestigationCountV2(o.analyst));
|
|
1601
|
+
});
|
|
1602
|
+
|
|
1603
|
+
ueba
|
|
1604
|
+
.command("create-baseline-v2 <id>")
|
|
1605
|
+
.description("Create baseline V2 (draft)")
|
|
1606
|
+
.requiredOption("-o, --owner <owner>", "Owner")
|
|
1607
|
+
.requiredOption("-e, --entity <entity>", "Entity")
|
|
1608
|
+
.option("-m, --metadata <json>", "JSON metadata")
|
|
1609
|
+
.action((id, o) => {
|
|
1610
|
+
console.log(
|
|
1611
|
+
JSON.stringify(
|
|
1612
|
+
createBaselineV2({
|
|
1613
|
+
id,
|
|
1614
|
+
owner: o.owner,
|
|
1615
|
+
entity: o.entity,
|
|
1616
|
+
metadata: _parseMetaUeba(o.metadata),
|
|
1617
|
+
}),
|
|
1618
|
+
null,
|
|
1619
|
+
2,
|
|
1620
|
+
),
|
|
1621
|
+
);
|
|
1622
|
+
});
|
|
1623
|
+
|
|
1624
|
+
ueba
|
|
1625
|
+
.command("baseline-v2 <id>")
|
|
1626
|
+
.description("Show baseline V2")
|
|
1627
|
+
.action((id) => {
|
|
1628
|
+
const b = getBaselineV2(id);
|
|
1629
|
+
if (!b) {
|
|
1630
|
+
logger.error(`baseline ${id} not found`);
|
|
1631
|
+
process.exit(1);
|
|
1632
|
+
}
|
|
1633
|
+
console.log(JSON.stringify(b, null, 2));
|
|
1634
|
+
});
|
|
1635
|
+
|
|
1636
|
+
ueba
|
|
1637
|
+
.command("list-baselines-v2")
|
|
1638
|
+
.description("List baselines V2")
|
|
1639
|
+
.option("-o, --owner <owner>", "Filter by owner")
|
|
1640
|
+
.option("-s, --status <status>", "Filter by status")
|
|
1641
|
+
.action((o) => {
|
|
1642
|
+
console.log(
|
|
1643
|
+
JSON.stringify(
|
|
1644
|
+
listBaselinesV2({ owner: o.owner, status: o.status }),
|
|
1645
|
+
null,
|
|
1646
|
+
2,
|
|
1647
|
+
),
|
|
1648
|
+
);
|
|
1649
|
+
});
|
|
1650
|
+
|
|
1651
|
+
ueba
|
|
1652
|
+
.command("set-baseline-maturity-v2 <id> <status>")
|
|
1653
|
+
.description("Transition baseline V2 to status")
|
|
1654
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1655
|
+
.option("-m, --metadata <json>", "JSON metadata patch")
|
|
1656
|
+
.action((id, status, o) => {
|
|
1657
|
+
console.log(
|
|
1658
|
+
JSON.stringify(
|
|
1659
|
+
setBaselineMaturityV2(id, status, {
|
|
1660
|
+
reason: o.reason,
|
|
1661
|
+
metadata: _parseMetaUeba(o.metadata),
|
|
1662
|
+
}),
|
|
1663
|
+
null,
|
|
1664
|
+
2,
|
|
1665
|
+
),
|
|
1666
|
+
);
|
|
1667
|
+
});
|
|
1668
|
+
|
|
1669
|
+
ueba
|
|
1670
|
+
.command("activate-baseline-v2 <id>")
|
|
1671
|
+
.description("Baseline → active (V2)")
|
|
1672
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1673
|
+
.action((id, o) => {
|
|
1674
|
+
console.log(
|
|
1675
|
+
JSON.stringify(activateBaselineV2(id, { reason: o.reason }), null, 2),
|
|
1676
|
+
);
|
|
1677
|
+
});
|
|
1678
|
+
|
|
1679
|
+
ueba
|
|
1680
|
+
.command("mark-baseline-stale <id>")
|
|
1681
|
+
.description("Baseline → stale (V2)")
|
|
1682
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1683
|
+
.action((id, o) => {
|
|
1684
|
+
console.log(
|
|
1685
|
+
JSON.stringify(markBaselineStaleV2(id, { reason: o.reason }), null, 2),
|
|
1686
|
+
);
|
|
1687
|
+
});
|
|
1688
|
+
|
|
1689
|
+
ueba
|
|
1690
|
+
.command("archive-baseline-v2 <id>")
|
|
1691
|
+
.description("Baseline → archived (V2)")
|
|
1692
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1693
|
+
.action((id, o) => {
|
|
1694
|
+
console.log(
|
|
1695
|
+
JSON.stringify(archiveBaselineV2(id, { reason: o.reason }), null, 2),
|
|
1696
|
+
);
|
|
1697
|
+
});
|
|
1698
|
+
|
|
1699
|
+
ueba
|
|
1700
|
+
.command("refresh-baseline-v2 <id>")
|
|
1701
|
+
.description("Update lastRefreshedAt (V2)")
|
|
1702
|
+
.action((id) => {
|
|
1703
|
+
console.log(JSON.stringify(refreshBaselineV2(id), null, 2));
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1706
|
+
ueba
|
|
1707
|
+
.command("open-investigation-v2 <id>")
|
|
1708
|
+
.description("Open investigation V2")
|
|
1709
|
+
.requiredOption("-a, --analyst <analyst>", "Analyst")
|
|
1710
|
+
.requiredOption("-b, --baseline <baselineId>", "Baseline id")
|
|
1711
|
+
.option("--summary <summary>", "Summary")
|
|
1712
|
+
.option("-m, --metadata <json>", "JSON metadata")
|
|
1713
|
+
.action((id, o) => {
|
|
1714
|
+
console.log(
|
|
1715
|
+
JSON.stringify(
|
|
1716
|
+
openInvestigationV2({
|
|
1717
|
+
id,
|
|
1718
|
+
analyst: o.analyst,
|
|
1719
|
+
baselineId: o.baseline,
|
|
1720
|
+
summary: o.summary,
|
|
1721
|
+
metadata: _parseMetaUeba(o.metadata),
|
|
1722
|
+
}),
|
|
1723
|
+
null,
|
|
1724
|
+
2,
|
|
1725
|
+
),
|
|
1726
|
+
);
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
ueba
|
|
1730
|
+
.command("investigation-v2 <id>")
|
|
1731
|
+
.description("Show investigation V2")
|
|
1732
|
+
.action((id) => {
|
|
1733
|
+
const i = getInvestigationV2(id);
|
|
1734
|
+
if (!i) {
|
|
1735
|
+
logger.error(`investigation ${id} not found`);
|
|
1736
|
+
process.exit(1);
|
|
1737
|
+
}
|
|
1738
|
+
console.log(JSON.stringify(i, null, 2));
|
|
1739
|
+
});
|
|
1740
|
+
|
|
1741
|
+
ueba
|
|
1742
|
+
.command("list-investigations-v2")
|
|
1743
|
+
.description("List investigations V2")
|
|
1744
|
+
.option("-a, --analyst <analyst>", "Filter by analyst")
|
|
1745
|
+
.option("-s, --status <status>", "Filter by status")
|
|
1746
|
+
.option("-b, --baseline <baselineId>", "Filter by baseline")
|
|
1747
|
+
.action((o) => {
|
|
1748
|
+
console.log(
|
|
1749
|
+
JSON.stringify(
|
|
1750
|
+
listInvestigationsV2({
|
|
1751
|
+
analyst: o.analyst,
|
|
1752
|
+
status: o.status,
|
|
1753
|
+
baselineId: o.baseline,
|
|
1754
|
+
}),
|
|
1755
|
+
null,
|
|
1756
|
+
2,
|
|
1757
|
+
),
|
|
1758
|
+
);
|
|
1759
|
+
});
|
|
1760
|
+
|
|
1761
|
+
ueba
|
|
1762
|
+
.command("set-investigation-status-v2 <id> <status>")
|
|
1763
|
+
.description("Transition investigation V2 to status")
|
|
1764
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1765
|
+
.option("-m, --metadata <json>", "JSON metadata patch")
|
|
1766
|
+
.action((id, status, o) => {
|
|
1767
|
+
console.log(
|
|
1768
|
+
JSON.stringify(
|
|
1769
|
+
setInvestigationStatusV2(id, status, {
|
|
1770
|
+
reason: o.reason,
|
|
1771
|
+
metadata: _parseMetaUeba(o.metadata),
|
|
1772
|
+
}),
|
|
1773
|
+
null,
|
|
1774
|
+
2,
|
|
1775
|
+
),
|
|
1776
|
+
);
|
|
1777
|
+
});
|
|
1778
|
+
|
|
1779
|
+
ueba
|
|
1780
|
+
.command("start-investigation-v2 <id>")
|
|
1781
|
+
.description("Investigation → investigating (V2)")
|
|
1782
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1783
|
+
.action((id, o) => {
|
|
1784
|
+
console.log(
|
|
1785
|
+
JSON.stringify(startInvestigationV2(id, { reason: o.reason }), null, 2),
|
|
1786
|
+
);
|
|
1787
|
+
});
|
|
1788
|
+
|
|
1789
|
+
ueba
|
|
1790
|
+
.command("close-investigation-v2 <id>")
|
|
1791
|
+
.description("Investigation → closed (V2)")
|
|
1792
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1793
|
+
.action((id, o) => {
|
|
1794
|
+
console.log(
|
|
1795
|
+
JSON.stringify(closeInvestigationV2(id, { reason: o.reason }), null, 2),
|
|
1796
|
+
);
|
|
1797
|
+
});
|
|
1798
|
+
|
|
1799
|
+
ueba
|
|
1800
|
+
.command("dismiss-investigation-v2 <id>")
|
|
1801
|
+
.description("Investigation → dismissed (V2)")
|
|
1802
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1803
|
+
.action((id, o) => {
|
|
1804
|
+
console.log(
|
|
1805
|
+
JSON.stringify(
|
|
1806
|
+
dismissInvestigationV2(id, { reason: o.reason }),
|
|
1807
|
+
null,
|
|
1808
|
+
2,
|
|
1809
|
+
),
|
|
1810
|
+
);
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1813
|
+
ueba
|
|
1814
|
+
.command("escalate-investigation-v2 <id>")
|
|
1815
|
+
.description("Investigation → escalated (V2)")
|
|
1816
|
+
.option("-r, --reason <reason>", "Reason")
|
|
1817
|
+
.action((id, o) => {
|
|
1818
|
+
console.log(
|
|
1819
|
+
JSON.stringify(
|
|
1820
|
+
escalateInvestigationV2(id, { reason: o.reason }),
|
|
1821
|
+
null,
|
|
1822
|
+
2,
|
|
1823
|
+
),
|
|
1824
|
+
);
|
|
1825
|
+
});
|
|
1826
|
+
|
|
1827
|
+
ueba
|
|
1828
|
+
.command("auto-mark-stale-baselines")
|
|
1829
|
+
.description("Bulk auto-flip active→stale past threshold (V2)")
|
|
1830
|
+
.action(() => {
|
|
1831
|
+
console.log(JSON.stringify(autoMarkStaleBaselinesV2(), null, 2));
|
|
1832
|
+
});
|
|
1833
|
+
|
|
1834
|
+
ueba
|
|
1835
|
+
.command("auto-escalate-stuck-investigations")
|
|
1836
|
+
.description(
|
|
1837
|
+
"Bulk auto-escalate investigating → escalated past threshold (V2)",
|
|
1838
|
+
)
|
|
1839
|
+
.action(() => {
|
|
1840
|
+
console.log(JSON.stringify(autoEscalateStuckInvestigationsV2(), null, 2));
|
|
1841
|
+
});
|
|
807
1842
|
}
|