@grc-claw/compliance-orchestrator 2.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/CHANGELOG.md +20 -0
- package/dist/compiler/RegulationASTCompiler.d.ts +28 -0
- package/dist/compiler/RegulationASTCompiler.d.ts.map +1 -0
- package/dist/compiler/RegulationASTCompiler.js +408 -0
- package/dist/compiler/RegulationASTCompiler.js.map +1 -0
- package/dist/graph/UnifiedComplianceGraph.d.ts +75 -0
- package/dist/graph/UnifiedComplianceGraph.d.ts.map +1 -0
- package/dist/graph/UnifiedComplianceGraph.js +278 -0
- package/dist/graph/UnifiedComplianceGraph.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/reasoner/NeuroSymbolicReasoner.d.ts +99 -0
- package/dist/reasoner/NeuroSymbolicReasoner.d.ts.map +1 -0
- package/dist/reasoner/NeuroSymbolicReasoner.js +352 -0
- package/dist/reasoner/NeuroSymbolicReasoner.js.map +1 -0
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +117 -0
- package/dist/test.js.map +1 -0
- package/dist/types.d.ts +184 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +27 -0
- package/src/compiler/RegulationASTCompiler.ts +469 -0
- package/src/graph/UnifiedComplianceGraph.ts +387 -0
- package/src/index.ts +180 -0
- package/src/reasoner/NeuroSymbolicReasoner.ts +509 -0
- package/src/test.ts +148 -0
- package/src/types.ts +208 -0
- package/tsconfig.json +21 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { FrameworkCode, RegulationAST, CrosswalkEntry, ComplianceState, CollectedEvidence } from '../types.js';
|
|
2
|
+
export interface GraphNode {
|
|
3
|
+
id: string;
|
|
4
|
+
type: 'framework' | 'control' | 'evidence' | 'agent' | 'infrastructure' | 'risk' | 'org';
|
|
5
|
+
label: string;
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
framework?: FrameworkCode;
|
|
8
|
+
}
|
|
9
|
+
export interface GraphEdge {
|
|
10
|
+
source: string;
|
|
11
|
+
target: string;
|
|
12
|
+
relationship: string;
|
|
13
|
+
weight: number;
|
|
14
|
+
properties: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface AttackPath {
|
|
17
|
+
nodes: string[];
|
|
18
|
+
edges: string[];
|
|
19
|
+
riskScore: number;
|
|
20
|
+
description: string;
|
|
21
|
+
}
|
|
22
|
+
export interface BlastRadius {
|
|
23
|
+
controlId: string;
|
|
24
|
+
impactScore: number;
|
|
25
|
+
affectedControls: string[];
|
|
26
|
+
affectedSystems: string[];
|
|
27
|
+
propagationDepth: number;
|
|
28
|
+
}
|
|
29
|
+
export interface CompliancePosture {
|
|
30
|
+
orgId: string;
|
|
31
|
+
timestamp: string;
|
|
32
|
+
overallScore: number;
|
|
33
|
+
frameworkScores: Map<FrameworkCode, number>;
|
|
34
|
+
controlCompliance: Map<string, boolean>;
|
|
35
|
+
riskHeatmap: RiskHeatmapEntry[];
|
|
36
|
+
recommendations: Recommendation[];
|
|
37
|
+
}
|
|
38
|
+
export interface RiskHeatmapEntry {
|
|
39
|
+
controlFamily: string;
|
|
40
|
+
severity: string;
|
|
41
|
+
count: number;
|
|
42
|
+
riskScore: number;
|
|
43
|
+
}
|
|
44
|
+
export interface Recommendation {
|
|
45
|
+
id: string;
|
|
46
|
+
priority: 'critical' | 'high' | 'medium' | 'low';
|
|
47
|
+
controlId: string;
|
|
48
|
+
title: string;
|
|
49
|
+
description: string;
|
|
50
|
+
estimatedImpact: number;
|
|
51
|
+
estimatedEffort: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class UnifiedComplianceGraph {
|
|
54
|
+
private nodes;
|
|
55
|
+
private edges;
|
|
56
|
+
private adjacencyList;
|
|
57
|
+
constructor(asts: RegulationAST[]);
|
|
58
|
+
private addFrameworkNode;
|
|
59
|
+
private addControlNode;
|
|
60
|
+
addCrosswalks(crosswalks: CrosswalkEntry[]): void;
|
|
61
|
+
addEvidenceNode(evidence: CollectedEvidence, controlId: string): void;
|
|
62
|
+
addAgentNode(agentId: string, role: string, tools: string[]): void;
|
|
63
|
+
addInfrastructureNode(systemId: string, systemType: string, controls: string[]): void;
|
|
64
|
+
traceAttackPaths(startNodeId: string, maxDepth?: number): AttackPath[];
|
|
65
|
+
calculateBlastRadius(controlId: string): BlastRadius;
|
|
66
|
+
assessAgentRisk(agentId: string, context: {
|
|
67
|
+
tool: string;
|
|
68
|
+
args: Record<string, unknown>;
|
|
69
|
+
}): number;
|
|
70
|
+
calculateCompliancePosture(orgId: string, states: ComplianceState[]): CompliancePosture;
|
|
71
|
+
private calculatePathRisk;
|
|
72
|
+
private describeAttackPath;
|
|
73
|
+
getGraphHash(): string;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=UnifiedComplianceGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnifiedComplianceGraph.d.ts","sourceRoot":"","sources":["../../src/graph/UnifiedComplianceGraph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EAEb,cAAc,EACd,eAAe,EAKf,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,gBAAgB,GAAG,MAAM,GAAG,KAAK,CAAC;IACzF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MA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7
|
+
for (const ast of asts) {
|
|
8
|
+
this.addFrameworkNode(ast);
|
|
9
|
+
for (const control of ast.controls) {
|
|
10
|
+
this.addControlNode(control, ast.framework);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
addFrameworkNode(ast) {
|
|
15
|
+
this.nodes.set(`framework:${ast.framework}`, {
|
|
16
|
+
id: `framework:${ast.framework}`,
|
|
17
|
+
type: 'framework',
|
|
18
|
+
label: ast.metadata.title,
|
|
19
|
+
properties: {
|
|
20
|
+
version: ast.version,
|
|
21
|
+
issuer: ast.metadata.issuer,
|
|
22
|
+
totalControls: ast.metadata.totalControls,
|
|
23
|
+
families: ast.metadata.families,
|
|
24
|
+
},
|
|
25
|
+
framework: ast.framework,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
addControlNode(control, framework) {
|
|
29
|
+
const nodeId = `control:${framework}:${control.code}`;
|
|
30
|
+
this.nodes.set(nodeId, {
|
|
31
|
+
id: nodeId,
|
|
32
|
+
type: 'control',
|
|
33
|
+
label: `${control.code} - ${control.title}`,
|
|
34
|
+
properties: {
|
|
35
|
+
id: control.id,
|
|
36
|
+
code: control.code,
|
|
37
|
+
title: control.title,
|
|
38
|
+
crossRefs: control.crossRefs,
|
|
39
|
+
severity: control.severity,
|
|
40
|
+
},
|
|
41
|
+
framework,
|
|
42
|
+
});
|
|
43
|
+
this.edges.push({
|
|
44
|
+
source: `framework:${framework}`,
|
|
45
|
+
target: nodeId,
|
|
46
|
+
relationship: 'contains',
|
|
47
|
+
weight: 1,
|
|
48
|
+
properties: {},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
addCrosswalks(crosswalks) {
|
|
52
|
+
for (const cw of crosswalks) {
|
|
53
|
+
const sourceId = `control:${cw.sourceFramework}:${cw.sourceControl}`;
|
|
54
|
+
const targetId = `control:${cw.targetFramework}:${cw.targetControl}`;
|
|
55
|
+
if (this.nodes.has(sourceId) && this.nodes.has(targetId)) {
|
|
56
|
+
this.edges.push({
|
|
57
|
+
source: sourceId,
|
|
58
|
+
target: targetId,
|
|
59
|
+
relationship: cw.relationship,
|
|
60
|
+
weight: cw.confidence,
|
|
61
|
+
properties: { confidence: cw.confidence },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
addEvidenceNode(evidence, controlId) {
|
|
67
|
+
const nodeId = `evidence:${evidence.id}`;
|
|
68
|
+
this.nodes.set(nodeId, {
|
|
69
|
+
id: nodeId,
|
|
70
|
+
type: 'evidence',
|
|
71
|
+
label: `${evidence.type} for ${controlId}`,
|
|
72
|
+
properties: {
|
|
73
|
+
hash: evidence.hash,
|
|
74
|
+
timestamp: evidence.timestamp,
|
|
75
|
+
valid: evidence.valid,
|
|
76
|
+
source: evidence.source,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
this.edges.push({
|
|
80
|
+
source: nodeId,
|
|
81
|
+
target: `control:${controlId}`,
|
|
82
|
+
relationship: 'supports',
|
|
83
|
+
weight: evidence.valid ? 1 : 0,
|
|
84
|
+
properties: { valid: evidence.valid },
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
addAgentNode(agentId, role, tools) {
|
|
88
|
+
const nodeId = `agent:${agentId}`;
|
|
89
|
+
this.nodes.set(nodeId, {
|
|
90
|
+
id: nodeId,
|
|
91
|
+
type: 'agent',
|
|
92
|
+
label: `Agent ${agentId}`,
|
|
93
|
+
properties: { role, tools },
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
addInfrastructureNode(systemId, systemType, controls) {
|
|
97
|
+
const nodeId = `infra:${systemId}`;
|
|
98
|
+
this.nodes.set(nodeId, {
|
|
99
|
+
id: nodeId,
|
|
100
|
+
type: 'infrastructure',
|
|
101
|
+
label: systemId,
|
|
102
|
+
properties: { systemType, controls },
|
|
103
|
+
});
|
|
104
|
+
for (const control of controls) {
|
|
105
|
+
this.edges.push({
|
|
106
|
+
source: nodeId,
|
|
107
|
+
target: `control:${control}`,
|
|
108
|
+
relationship: 'implements',
|
|
109
|
+
weight: 0.8,
|
|
110
|
+
properties: {},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
traceAttackPaths(startNodeId, maxDepth = 5) {
|
|
115
|
+
const paths = [];
|
|
116
|
+
const visited = new Set();
|
|
117
|
+
const queue = [];
|
|
118
|
+
queue.push({ nodeId: startNodeId, path: [startNodeId], edges: [] });
|
|
119
|
+
visited.add(startNodeId);
|
|
120
|
+
while (queue.length > 0 && paths.length < 10) {
|
|
121
|
+
const current = queue.shift();
|
|
122
|
+
const neighbors = this.adjacencyList.get(current.nodeId) ?? [];
|
|
123
|
+
for (const edge of neighbors) {
|
|
124
|
+
const targetId = edge.source === current.nodeId ? edge.target : edge.source;
|
|
125
|
+
if (visited.has(targetId))
|
|
126
|
+
continue;
|
|
127
|
+
visited.add(targetId);
|
|
128
|
+
const newPath = [...current.path, targetId];
|
|
129
|
+
const newEdges = [...current.edges, edge.relationship];
|
|
130
|
+
if (newPath.length > 1) {
|
|
131
|
+
paths.push({
|
|
132
|
+
nodes: newPath,
|
|
133
|
+
edges: newEdges,
|
|
134
|
+
riskScore: this.calculatePathRisk(newPath),
|
|
135
|
+
description: this.describeAttackPath(newPath),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (newPath.length < maxDepth) {
|
|
139
|
+
queue.push({ nodeId: targetId, path: newPath, edges: newEdges });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return paths.sort((a, b) => b.riskScore - a.riskScore);
|
|
144
|
+
}
|
|
145
|
+
calculateBlastRadius(controlId) {
|
|
146
|
+
const affectedControls = [];
|
|
147
|
+
const affectedSystems = [];
|
|
148
|
+
let propagationDepth = 0;
|
|
149
|
+
const bfs = (startId, depth = 0) => {
|
|
150
|
+
if (depth > 3)
|
|
151
|
+
return;
|
|
152
|
+
const outgoing = this.edges.filter((e) => e.source === startId && e.relationship !== 'contains');
|
|
153
|
+
for (const edge of outgoing) {
|
|
154
|
+
const targetNode = this.nodes.get(edge.target);
|
|
155
|
+
if (!targetNode)
|
|
156
|
+
continue;
|
|
157
|
+
if (targetNode.type === 'control') {
|
|
158
|
+
affectedControls.push(edge.target);
|
|
159
|
+
}
|
|
160
|
+
else if (targetNode.type === 'infrastructure') {
|
|
161
|
+
affectedSystems.push(edge.target);
|
|
162
|
+
}
|
|
163
|
+
propagationDepth = Math.max(propagationDepth, depth + 1);
|
|
164
|
+
bfs(edge.target, depth + 1);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
bfs(controlId);
|
|
168
|
+
const impactScore = Math.min((affectedControls.length * 0.3 + affectedSystems.length * 0.5 + propagationDepth * 0.2), 1);
|
|
169
|
+
return {
|
|
170
|
+
controlId,
|
|
171
|
+
impactScore,
|
|
172
|
+
affectedControls: [...new Set(affectedControls)],
|
|
173
|
+
affectedSystems: [...new Set(affectedSystems)],
|
|
174
|
+
propagationDepth,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
assessAgentRisk(agentId, context) {
|
|
178
|
+
const agentNode = this.nodes.get(`agent:${agentId}`);
|
|
179
|
+
if (!agentNode)
|
|
180
|
+
return 1.0;
|
|
181
|
+
const connectedControls = this.edges
|
|
182
|
+
.filter((e) => e.source === `agent:${agentId}`)
|
|
183
|
+
.map((e) => this.nodes.get(e.target))
|
|
184
|
+
.filter((n) => n?.type === 'control');
|
|
185
|
+
const vulnerableControls = connectedControls.filter((n) => {
|
|
186
|
+
const evidence = this.edges.filter((e) => e.target === n?.id && e.relationship === 'supports');
|
|
187
|
+
return evidence.length === 0;
|
|
188
|
+
});
|
|
189
|
+
return vulnerableControls.length / Math.max(connectedControls.length, 1);
|
|
190
|
+
}
|
|
191
|
+
calculateCompliancePosture(orgId, states) {
|
|
192
|
+
const frameworkScores = new Map();
|
|
193
|
+
const controlCompliance = new Map();
|
|
194
|
+
const riskHeatmap = [];
|
|
195
|
+
const recommendations = [];
|
|
196
|
+
for (const state of states) {
|
|
197
|
+
const compliant = state.controlStatuses.filter((s) => s.status === 'compliant').length;
|
|
198
|
+
const total = state.controlStatuses.length;
|
|
199
|
+
const score = total > 0 ? (compliant / total) * 100 : 0;
|
|
200
|
+
frameworkScores.set(state.framework, score);
|
|
201
|
+
for (const cs of state.controlStatuses) {
|
|
202
|
+
controlCompliance.set(cs.controlId, cs.status === 'compliant');
|
|
203
|
+
if (cs.status !== 'compliant' && cs.issues.length > 0) {
|
|
204
|
+
recommendations.push({
|
|
205
|
+
id: `rec-${cs.controlId}-${Date.now()}`,
|
|
206
|
+
priority: cs.issues[0].severity === 'CRITICAL' ? 'critical' : 'high',
|
|
207
|
+
controlId: cs.controlId,
|
|
208
|
+
title: `Remediate ${cs.controlId}`,
|
|
209
|
+
description: cs.issues[0].description,
|
|
210
|
+
estimatedImpact: cs.score,
|
|
211
|
+
estimatedEffort: '1-4 hours',
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
for (const risk of state.risks) {
|
|
216
|
+
const existing = riskHeatmap.find((r) => r.severity === (risk.riskScore > 0.7 ? 'CRITICAL' : risk.riskScore > 0.4 ? 'HIGH' : 'MEDIUM'));
|
|
217
|
+
if (existing) {
|
|
218
|
+
existing.count++;
|
|
219
|
+
existing.riskScore += risk.riskScore;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
riskHeatmap.push({
|
|
223
|
+
controlFamily: risk.controlId.split('-')[0],
|
|
224
|
+
severity: risk.riskScore > 0.7 ? 'CRITICAL' : risk.riskScore > 0.4 ? 'HIGH' : 'MEDIUM',
|
|
225
|
+
count: 1,
|
|
226
|
+
riskScore: risk.riskScore,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const overallScore = Array.from(frameworkScores.values()).reduce((a, b) => a + b, 0) / Math.max(frameworkScores.size, 1);
|
|
232
|
+
return {
|
|
233
|
+
orgId,
|
|
234
|
+
timestamp: new Date().toISOString(),
|
|
235
|
+
overallScore,
|
|
236
|
+
frameworkScores,
|
|
237
|
+
controlCompliance,
|
|
238
|
+
riskHeatmap,
|
|
239
|
+
recommendations: recommendations.sort((a, b) => {
|
|
240
|
+
const priorityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
241
|
+
return priorityOrder[a.priority] - priorityOrder[b.priority];
|
|
242
|
+
}),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
calculatePathRisk(path) {
|
|
246
|
+
let risk = 0;
|
|
247
|
+
for (const nodeId of path) {
|
|
248
|
+
const node = this.nodes.get(nodeId);
|
|
249
|
+
if (node?.type === 'control') {
|
|
250
|
+
const severity = node.properties.severity ?? 'MEDIUM';
|
|
251
|
+
const severityScore = { LOW: 0.2, MEDIUM: 0.5, HIGH: 0.8, CRITICAL: 1.0 };
|
|
252
|
+
risk += severityScore[severity] ?? 0.5;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return Math.min(risk / path.length, 1);
|
|
256
|
+
}
|
|
257
|
+
describeAttackPath(path) {
|
|
258
|
+
const descriptions = path.map((nodeId) => {
|
|
259
|
+
const node = this.nodes.get(nodeId);
|
|
260
|
+
if (!node)
|
|
261
|
+
return nodeId;
|
|
262
|
+
return `${node.type}(${node.label})`;
|
|
263
|
+
});
|
|
264
|
+
return descriptions.join(' → ');
|
|
265
|
+
}
|
|
266
|
+
getGraphHash() {
|
|
267
|
+
const content = JSON.stringify({
|
|
268
|
+
nodeCount: this.nodes.size,
|
|
269
|
+
edgeCount: this.edges.length,
|
|
270
|
+
nodeTypes: Array.from(this.nodes.values()).reduce((acc, n) => {
|
|
271
|
+
acc[n.type] = (acc[n.type] ?? 0) + 1;
|
|
272
|
+
return acc;
|
|
273
|
+
}, {}),
|
|
274
|
+
});
|
|
275
|
+
return createHash('sha256').update(content).digest('hex');
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=UnifiedCompl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IAAI,IAAI,CAAC,KAAK,GAAG,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,YAAY;QACV,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;YAC7B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YAC1B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YAC5B,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC3D,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrC,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAA4B,CAAC;SACjC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { RegulationASTCompiler } from './compiler/RegulationASTCompiler.js';
|
|
2
|
+
import { NeuroSymbolicReasoner } from './reasoner/NeuroSymbolicReasoner.js';
|
|
3
|
+
import { UnifiedComplianceGraph } from './graph/UnifiedComplianceGraph.js';
|
|
4
|
+
import type { FrameworkCode, ComplianceState, CompliancePlan, ComplianceAudit, DriftEvent, RiskAssessment } from './types.js';
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export { RegulationASTCompiler, getEvidenceDeduplicationMap } from './compiler/RegulationASTCompiler.js';
|
|
7
|
+
export { NeuroSymbolicReasoner } from './reasoner/NeuroSymbolicReasoner.js';
|
|
8
|
+
export { UnifiedComplianceGraph } from './graph/UnifiedComplianceGraph.js';
|
|
9
|
+
export type { ReasoningResult, ReasoningContext, ReasoningContext as NeuroSymbolicContext } from './reasoner/NeuroSymbolicReasoner.js';
|
|
10
|
+
export type { GraphNode, GraphEdge, AttackPath, BlastRadius, CompliancePosture, Recommendation } from './graph/UnifiedComplianceGraph.js';
|
|
11
|
+
export interface ComplianceOrchestratorConfig {
|
|
12
|
+
orgId: string;
|
|
13
|
+
enabledFrameworks: FrameworkCode[];
|
|
14
|
+
riskTolerance: 'low' | 'medium' | 'high';
|
|
15
|
+
autoRemediate: boolean;
|
|
16
|
+
continuousScanInterval: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ContinuousComplianceResult {
|
|
19
|
+
orgId: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
states: ComplianceState[];
|
|
22
|
+
drift: DriftEvent[];
|
|
23
|
+
risks: RiskAssessment[];
|
|
24
|
+
graphHash: string;
|
|
25
|
+
overallScore: number;
|
|
26
|
+
}
|
|
27
|
+
export declare class ComplianceSuperOrchestrator {
|
|
28
|
+
private compiler;
|
|
29
|
+
private reasoner;
|
|
30
|
+
private graph;
|
|
31
|
+
private config;
|
|
32
|
+
private states;
|
|
33
|
+
constructor(config: ComplianceOrchestratorConfig);
|
|
34
|
+
continuousComplianceLoop(reasoningContexts: Map<FrameworkCode, import('./reasoner/NeuroSymbolicReasoner.js').ReasoningContext>): Promise<ContinuousComplianceResult>;
|
|
35
|
+
compileNaturalLanguage(framework: FrameworkCode, text: string): string;
|
|
36
|
+
synthesizePlan(framework: FrameworkCode, currentState: ComplianceState, targetScore: number): Promise<CompliancePlan>;
|
|
37
|
+
executeAudit(framework: FrameworkCode, reasoningContext: import('./reasoner/NeuroSymbolicReasoner.js').ReasoningContext): Promise<ComplianceAudit>;
|
|
38
|
+
findCrosswalk(framework: FrameworkCode, controlCode: string): CrosswalkEntry[];
|
|
39
|
+
getState(framework: FrameworkCode): ComplianceState | undefined;
|
|
40
|
+
getGraph(): UnifiedComplianceGraph;
|
|
41
|
+
getCompiler(): RegulationASTCompiler;
|
|
42
|
+
getReasoner(): NeuroSymbolicReasoner;
|
|
43
|
+
}
|
|
44
|
+
type CrosswalkEntry = import('./types.js').CrosswalkEntry;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EAGf,UAAU,EACV,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AACzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AACvI,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAE1I,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,aAAa,EAAE,CAAC;IACnC,aAAa,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,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
|
2
|
+
import { NeuroSymbolicReasoner } from './reasoner/NeuroSymbolicReasoner.js';
|
|
3
|
+
import { UnifiedComplianceGraph } from './graph/UnifiedComplianceGraph.js';
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export { RegulationASTCompiler, getEvidenceDeduplicationMap } from './compiler/RegulationASTCompiler.js';
|
|
6
|
+
export { NeuroSymbolicReasoner } from './reasoner/NeuroSymbolicReasoner.js';
|
|
7
|
+
export { UnifiedComplianceGraph } from './graph/UnifiedComplianceGraph.js';
|
|
8
|
+
export class ComplianceSuperOrchestrator {
|
|
9
|
+
compiler;
|
|
10
|
+
reasoner;
|
|
11
|
+
graph;
|
|
12
|
+
config;
|
|
13
|
+
states = new Map();
|
|
14
|
+
constructor(config) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
this.compiler = new RegulationASTCompiler();
|
|
17
|
+
const asts = this.compiler.getAllASTs();
|
|
18
|
+
this.reasoner = new NeuroSymbolicReasoner(new Map(asts.map((a) => [a.framework, a])));
|
|
19
|
+
this.graph = new UnifiedComplianceGraph(asts);
|
|
20
|
+
}
|
|
21
|
+
async continuousComplianceLoop(reasoningContexts) {
|
|
22
|
+
const states = [];
|
|
23
|
+
const allDrift = [];
|
|
24
|
+
const allRisks = [];
|
|
25
|
+
for (const [framework, context] of reasoningContexts) {
|
|
26
|
+
const previousState = this.states.get(framework);
|
|
27
|
+
const enrichedContext = { ...context, previousState };
|
|
28
|
+
const state = await this.reasoner.reason(enrichedContext);
|
|
29
|
+
states.push(state);
|
|
30
|
+
allDrift.push(...state.drift);
|
|
31
|
+
allRisks.push(...state.risks);
|
|
32
|
+
this.states.set(framework, state);
|
|
33
|
+
}
|
|
34
|
+
const compliant = states.reduce((acc, s) => acc + s.controlStatuses.filter((c) => c.status === 'compliant').length, 0);
|
|
35
|
+
const total = states.reduce((acc, s) => acc + s.controlStatuses.length, 0);
|
|
36
|
+
const overallScore = total > 0 ? (compliant / total) * 100 : 0;
|
|
37
|
+
return {
|
|
38
|
+
orgId: this.config.orgId,
|
|
39
|
+
timestamp: new Date().toISOString(),
|
|
40
|
+
states,
|
|
41
|
+
drift: allDrift,
|
|
42
|
+
risks: allRisks,
|
|
43
|
+
graphHash: this.graph.getGraphHash(),
|
|
44
|
+
overallScore,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
compileNaturalLanguage(framework, text) {
|
|
48
|
+
const control = this.compiler.compileNaturalLanguage(framework, text);
|
|
49
|
+
return control.id;
|
|
50
|
+
}
|
|
51
|
+
async synthesizePlan(framework, currentState, targetScore) {
|
|
52
|
+
const nonCompliant = currentState.controlStatuses.filter((s) => s.status !== 'compliant');
|
|
53
|
+
const actions = nonCompliant.map((nc, idx) => ({
|
|
54
|
+
id: `action-${idx}-${Date.now()}`,
|
|
55
|
+
controlId: nc.controlId,
|
|
56
|
+
action: 'remediate',
|
|
57
|
+
resource: nc.controlId,
|
|
58
|
+
evidenceRequired: ['scan', 'config'],
|
|
59
|
+
sla: '4h',
|
|
60
|
+
}));
|
|
61
|
+
const estimatedCost = actions.length * 500;
|
|
62
|
+
return {
|
|
63
|
+
id: `plan-${framework}-${Date.now()}`,
|
|
64
|
+
orgId: this.config.orgId,
|
|
65
|
+
framework,
|
|
66
|
+
createdAt: new Date().toISOString(),
|
|
67
|
+
actions,
|
|
68
|
+
estimatedCost,
|
|
69
|
+
estimatedDuration: `${Math.ceil(actions.length / 4)} days`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async executeAudit(framework, reasoningContext) {
|
|
73
|
+
const state = await this.reasoner.reason(reasoningContext);
|
|
74
|
+
const controls = state.controlStatuses.map((cs) => ({
|
|
75
|
+
controlId: cs.controlId,
|
|
76
|
+
status: cs.status === 'compliant' ? 'pass' : 'fail',
|
|
77
|
+
evidence: [],
|
|
78
|
+
issues: cs.issues,
|
|
79
|
+
duration: 0,
|
|
80
|
+
}));
|
|
81
|
+
const passed = controls.filter((c) => c.status === 'pass').length;
|
|
82
|
+
const failed = controls.filter((c) => c.status === 'fail').length;
|
|
83
|
+
return {
|
|
84
|
+
id: `audit-${framework}-${Date.now()}`,
|
|
85
|
+
orgId: this.config.orgId,
|
|
86
|
+
framework,
|
|
87
|
+
startedAt: new Date().toISOString(),
|
|
88
|
+
completedAt: new Date().toISOString(),
|
|
89
|
+
controls,
|
|
90
|
+
summary: {
|
|
91
|
+
totalControls: controls.length,
|
|
92
|
+
passed,
|
|
93
|
+
failed,
|
|
94
|
+
skipped: 0,
|
|
95
|
+
errors: 0,
|
|
96
|
+
complianceScore: controls.length > 0 ? (passed / controls.length) * 100 : 0,
|
|
97
|
+
criticalFindings: failed,
|
|
98
|
+
highFindings: 0,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
findCrosswalk(framework, controlCode) {
|
|
103
|
+
return this.compiler.findEquivalent(framework, controlCode);
|
|
104
|
+
}
|
|
105
|
+
getState(framework) {
|
|
106
|
+
return this.states.get(framework);
|
|
107
|
+
}
|
|
108
|
+
getGraph() {
|
|
109
|
+
return this.graph;
|
|
110
|
+
}
|
|
111
|
+
getCompiler() {
|
|
112
|
+
return this.compiler;
|
|
113
|
+
}
|
|
114
|
+
getReasoner() {
|
|
115
|
+
return this.reasoner;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAY3E,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AACzG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5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AAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { FrameworkCode, RegulationAST, ASTControlNode, DriftEvent, ComplianceState } from '../types.js';
|
|
2
|
+
export interface ReasoningResult {
|
|
3
|
+
control: string;
|
|
4
|
+
decision: 'compliant' | 'non-compliant' | 'partial' | 'unknown';
|
|
5
|
+
confidence: number;
|
|
6
|
+
proof: string[];
|
|
7
|
+
counterExample?: string;
|
|
8
|
+
reasoningPath: string[];
|
|
9
|
+
symbolicProof: SymbolicProof;
|
|
10
|
+
}
|
|
11
|
+
export interface SymbolicProof {
|
|
12
|
+
obligations: ProofObligation[];
|
|
13
|
+
discharged: string[];
|
|
14
|
+
remaining: string[];
|
|
15
|
+
valid: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ProofObligation {
|
|
18
|
+
id: string;
|
|
19
|
+
formula: string;
|
|
20
|
+
status: 'proven' | 'disproven' | 'unknown' | 'assumed';
|
|
21
|
+
evidenceRef?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ReasoningContext {
|
|
24
|
+
orgId: string;
|
|
25
|
+
framework: FrameworkCode;
|
|
26
|
+
currentEvidence: Map<string, EvidenceItem[]>;
|
|
27
|
+
configurationState: ConfigurationState;
|
|
28
|
+
riskTolerance: 'low' | 'medium' | 'high';
|
|
29
|
+
previousState?: ComplianceState;
|
|
30
|
+
}
|
|
31
|
+
export interface EvidenceItem {
|
|
32
|
+
id: string;
|
|
33
|
+
controlId: string;
|
|
34
|
+
type: string;
|
|
35
|
+
hash: string;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
valid: boolean;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export interface ConfigurationState {
|
|
41
|
+
iam: IAMState;
|
|
42
|
+
network: NetworkState;
|
|
43
|
+
data: DataState;
|
|
44
|
+
monitoring: MonitoringState;
|
|
45
|
+
physical: PhysicalState;
|
|
46
|
+
}
|
|
47
|
+
export interface IAMState {
|
|
48
|
+
mfaEnabled: boolean;
|
|
49
|
+
privilegedUsers: string[];
|
|
50
|
+
sessionTimeout: number;
|
|
51
|
+
lastPasswordRotation: string;
|
|
52
|
+
rbacPolicyVersion: string;
|
|
53
|
+
mfaEnforcementRate: number;
|
|
54
|
+
}
|
|
55
|
+
export interface NetworkState {
|
|
56
|
+
firewallRules: number;
|
|
57
|
+
segmentationEnabled: boolean;
|
|
58
|
+
idsEnabled: boolean;
|
|
59
|
+
tlsVersion: string;
|
|
60
|
+
publicEndpoints: string[];
|
|
61
|
+
}
|
|
62
|
+
export interface DataState {
|
|
63
|
+
encryptionAtRest: boolean;
|
|
64
|
+
encryptionInTransit: boolean;
|
|
65
|
+
backupEnabled: boolean;
|
|
66
|
+
backupFrequency: string;
|
|
67
|
+
lastBackup: string;
|
|
68
|
+
retentionDays: number;
|
|
69
|
+
}
|
|
70
|
+
export interface MonitoringState {
|
|
71
|
+
siemEnabled: boolean;
|
|
72
|
+
logRetentionDays: number;
|
|
73
|
+
alertingEnabled: boolean;
|
|
74
|
+
mttr: number;
|
|
75
|
+
monitoringCoverage: number;
|
|
76
|
+
}
|
|
77
|
+
export interface PhysicalState {
|
|
78
|
+
accessControl: boolean;
|
|
79
|
+
cctvEnabled: boolean;
|
|
80
|
+
environmentalMonitoring: boolean;
|
|
81
|
+
visitorManagement: boolean;
|
|
82
|
+
}
|
|
83
|
+
export declare class NeuroSymbolicReasoner {
|
|
84
|
+
private asts;
|
|
85
|
+
private constraintCache;
|
|
86
|
+
constructor(asts: Map<FrameworkCode, RegulationAST>);
|
|
87
|
+
reason(context: ReasoningContext): Promise<ComplianceState>;
|
|
88
|
+
evaluateControl(control: ASTControlNode, context: ReasoningContext): ReasoningResult;
|
|
89
|
+
private symbolicCheck;
|
|
90
|
+
private isPasswordFresh;
|
|
91
|
+
private calculateConfidence;
|
|
92
|
+
private evidenceFreshnessScore;
|
|
93
|
+
private mapDecisionToStatus;
|
|
94
|
+
private assessRisk;
|
|
95
|
+
private calculateBlastRadius;
|
|
96
|
+
detectDrift(context: ReasoningContext): Promise<DriftEvent[]>;
|
|
97
|
+
synthesizeRemediation(drift: DriftEvent): Promise<string>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=NeuroSymbolicReasoner.d.ts.map
|