aura-security 0.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/LICENSE +21 -0
- package/README.md +446 -0
- package/deploy/AWS-DEPLOYMENT.md +358 -0
- package/deploy/terraform/main.tf +362 -0
- package/deploy/terraform/terraform.tfvars.example +6 -0
- package/dist/agents/base.d.ts +44 -0
- package/dist/agents/base.js +96 -0
- package/dist/agents/index.d.ts +14 -0
- package/dist/agents/index.js +17 -0
- package/dist/agents/policy/evaluator.d.ts +15 -0
- package/dist/agents/policy/evaluator.js +183 -0
- package/dist/agents/policy/index.d.ts +12 -0
- package/dist/agents/policy/index.js +15 -0
- package/dist/agents/policy/validator.d.ts +15 -0
- package/dist/agents/policy/validator.js +182 -0
- package/dist/agents/scanners/gitleaks.d.ts +14 -0
- package/dist/agents/scanners/gitleaks.js +155 -0
- package/dist/agents/scanners/grype.d.ts +14 -0
- package/dist/agents/scanners/grype.js +109 -0
- package/dist/agents/scanners/index.d.ts +15 -0
- package/dist/agents/scanners/index.js +27 -0
- package/dist/agents/scanners/npm-audit.d.ts +13 -0
- package/dist/agents/scanners/npm-audit.js +129 -0
- package/dist/agents/scanners/semgrep.d.ts +14 -0
- package/dist/agents/scanners/semgrep.js +131 -0
- package/dist/agents/scanners/trivy.d.ts +14 -0
- package/dist/agents/scanners/trivy.js +122 -0
- package/dist/agents/types.d.ts +137 -0
- package/dist/agents/types.js +91 -0
- package/dist/auditor/index.d.ts +3 -0
- package/dist/auditor/index.js +2 -0
- package/dist/auditor/pipeline.d.ts +19 -0
- package/dist/auditor/pipeline.js +240 -0
- package/dist/auditor/validator.d.ts +17 -0
- package/dist/auditor/validator.js +58 -0
- package/dist/aura/client.d.ts +29 -0
- package/dist/aura/client.js +125 -0
- package/dist/aura/index.d.ts +4 -0
- package/dist/aura/index.js +2 -0
- package/dist/aura/server.d.ts +45 -0
- package/dist/aura/server.js +343 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +1433 -0
- package/dist/client/index.d.ts +41 -0
- package/dist/client/index.js +170 -0
- package/dist/compliance/index.d.ts +40 -0
- package/dist/compliance/index.js +292 -0
- package/dist/database/index.d.ts +77 -0
- package/dist/database/index.js +395 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +762 -0
- package/dist/integrations/aura-scanner.d.ts +69 -0
- package/dist/integrations/aura-scanner.js +155 -0
- package/dist/integrations/aws-scanner.d.ts +63 -0
- package/dist/integrations/aws-scanner.js +624 -0
- package/dist/integrations/config.d.ts +69 -0
- package/dist/integrations/config.js +212 -0
- package/dist/integrations/github.d.ts +45 -0
- package/dist/integrations/github.js +201 -0
- package/dist/integrations/gitlab.d.ts +36 -0
- package/dist/integrations/gitlab.js +110 -0
- package/dist/integrations/index.d.ts +11 -0
- package/dist/integrations/index.js +11 -0
- package/dist/integrations/local-scanner.d.ts +146 -0
- package/dist/integrations/local-scanner.js +1654 -0
- package/dist/integrations/notifications.d.ts +99 -0
- package/dist/integrations/notifications.js +305 -0
- package/dist/integrations/scanners.d.ts +57 -0
- package/dist/integrations/scanners.js +217 -0
- package/dist/integrations/slop-scanner.d.ts +69 -0
- package/dist/integrations/slop-scanner.js +155 -0
- package/dist/integrations/webhook.d.ts +37 -0
- package/dist/integrations/webhook.js +256 -0
- package/dist/orchestrator/index.d.ts +72 -0
- package/dist/orchestrator/index.js +187 -0
- package/dist/output/index.d.ts +152 -0
- package/dist/output/index.js +399 -0
- package/dist/pipeline/index.d.ts +72 -0
- package/dist/pipeline/index.js +313 -0
- package/dist/sbom/index.d.ts +94 -0
- package/dist/sbom/index.js +298 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/input.schema.d.ts +87 -0
- package/dist/schemas/input.schema.js +44 -0
- package/dist/schemas/output.schema.d.ts +115 -0
- package/dist/schemas/output.schema.js +64 -0
- package/dist/serve-visualizer.d.ts +2 -0
- package/dist/serve-visualizer.js +78 -0
- package/dist/slop/client.d.ts +29 -0
- package/dist/slop/client.js +125 -0
- package/dist/slop/index.d.ts +4 -0
- package/dist/slop/index.js +2 -0
- package/dist/slop/server.d.ts +45 -0
- package/dist/slop/server.js +343 -0
- package/dist/types/events.d.ts +62 -0
- package/dist/types/events.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/visualizer/index.d.ts +4 -0
- package/dist/visualizer/index.js +181 -0
- package/dist/websocket/index.d.ts +88 -0
- package/dist/websocket/index.js +195 -0
- package/dist/zones/index.d.ts +7 -0
- package/dist/zones/index.js +7 -0
- package/dist/zones/manager.d.ts +101 -0
- package/dist/zones/manager.js +304 -0
- package/dist/zones/types.d.ts +78 -0
- package/dist/zones/types.js +33 -0
- package/package.json +84 -0
- package/visualizer/app.js +0 -0
- package/visualizer/index-minimal.html +1771 -0
- package/visualizer/index.html +2933 -0
- package/visualizer/landing.html +1328 -0
- package/visualizer/styles.css +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aura Protocol - Parallel Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates parallel execution of zones and manages data flow between them.
|
|
5
|
+
* This is the main entry point for running security scans using the Aura architecture.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import { zoneManager } from '../zones/manager.js';
|
|
9
|
+
import { createAllAgents } from '../agents/index.js';
|
|
10
|
+
export class ParallelOrchestrator extends EventEmitter {
|
|
11
|
+
manager;
|
|
12
|
+
agents = [];
|
|
13
|
+
initialized = false;
|
|
14
|
+
constructor(manager) {
|
|
15
|
+
super();
|
|
16
|
+
this.manager = manager || zoneManager;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the orchestrator with all agents
|
|
20
|
+
*/
|
|
21
|
+
async initialize() {
|
|
22
|
+
if (this.initialized)
|
|
23
|
+
return;
|
|
24
|
+
// Create and register all agents
|
|
25
|
+
this.agents = createAllAgents();
|
|
26
|
+
for (const agent of this.agents) {
|
|
27
|
+
this.manager.registerAgent(agent);
|
|
28
|
+
}
|
|
29
|
+
// Listen to manager events and forward them
|
|
30
|
+
this.manager.on('zone:started', (data) => this.emit('zone:started', data));
|
|
31
|
+
this.manager.on('zone:completed', (data) => this.emit('zone:completed', data));
|
|
32
|
+
this.manager.on('zone:error', (data) => this.emit('zone:error', data));
|
|
33
|
+
this.manager.on('agent:started', (data) => this.emit('agent:started', data));
|
|
34
|
+
this.manager.on('agent:completed', (data) => this.emit('agent:completed', data));
|
|
35
|
+
this.manager.on('finding:added', (data) => this.emit('finding:added', data));
|
|
36
|
+
this.initialized = true;
|
|
37
|
+
this.emit('initialized', { agentCount: this.agents.length });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Run a full security scan using Aura Protocol
|
|
41
|
+
*
|
|
42
|
+
* Execution flow:
|
|
43
|
+
* 1. Scanner Zone - Run all scanners in parallel
|
|
44
|
+
* 2. Policy Zone - Evaluate and validate findings (sequential)
|
|
45
|
+
*/
|
|
46
|
+
async scan(config) {
|
|
47
|
+
const startTime = Date.now();
|
|
48
|
+
// Ensure initialized
|
|
49
|
+
await this.initialize();
|
|
50
|
+
this.emit('scan:started', { targetPath: config.targetPath });
|
|
51
|
+
const zoneResults = new Map();
|
|
52
|
+
let allFindings = [];
|
|
53
|
+
try {
|
|
54
|
+
// Phase 1: Run Scanner Zone
|
|
55
|
+
this.emit('phase:started', { phase: 'scanner', zones: ['scanner-zone'] });
|
|
56
|
+
const scannerResult = await this.manager.executeZone('scanner-zone', config.targetPath);
|
|
57
|
+
zoneResults.set('scanner-zone', scannerResult);
|
|
58
|
+
// Collect scanner findings
|
|
59
|
+
const scannerFindings = scannerResult.findings;
|
|
60
|
+
this.emit('phase:completed', {
|
|
61
|
+
phase: 'scanner',
|
|
62
|
+
findingCount: scannerFindings.length,
|
|
63
|
+
});
|
|
64
|
+
// Phase 2: Run Policy Zone (if enabled)
|
|
65
|
+
if (config.runPolicyZone !== false) {
|
|
66
|
+
this.emit('phase:started', { phase: 'policy', zones: ['policy-zone'] });
|
|
67
|
+
// Pass scanner findings to policy zone via memory
|
|
68
|
+
const policyZone = this.manager.getZone('policy-zone');
|
|
69
|
+
if (policyZone) {
|
|
70
|
+
policyZone.memory.data.set('scanner_findings', scannerFindings);
|
|
71
|
+
}
|
|
72
|
+
const policyResult = await this.manager.executeZone('policy-zone', config.targetPath);
|
|
73
|
+
zoneResults.set('policy-zone', policyResult);
|
|
74
|
+
// Use validated findings as final results
|
|
75
|
+
const validatedFindings = policyZone?.memory.data.get('validated_findings') ||
|
|
76
|
+
policyResult.findings;
|
|
77
|
+
allFindings = validatedFindings;
|
|
78
|
+
this.emit('phase:completed', {
|
|
79
|
+
phase: 'policy',
|
|
80
|
+
findingCount: allFindings.length,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
allFindings = scannerFindings;
|
|
85
|
+
}
|
|
86
|
+
// Build summary
|
|
87
|
+
const summary = this.buildSummary(allFindings, zoneResults);
|
|
88
|
+
const result = {
|
|
89
|
+
success: true,
|
|
90
|
+
duration: Date.now() - startTime,
|
|
91
|
+
targetPath: config.targetPath,
|
|
92
|
+
zoneResults,
|
|
93
|
+
findings: allFindings,
|
|
94
|
+
summary,
|
|
95
|
+
};
|
|
96
|
+
this.emit('scan:completed', result);
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
101
|
+
this.emit('scan:error', { error: errorMsg });
|
|
102
|
+
return {
|
|
103
|
+
success: false,
|
|
104
|
+
duration: Date.now() - startTime,
|
|
105
|
+
targetPath: config.targetPath,
|
|
106
|
+
zoneResults,
|
|
107
|
+
findings: allFindings,
|
|
108
|
+
summary: this.buildSummary(allFindings, zoneResults),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Run only the scanner zone (faster, no policy evaluation)
|
|
114
|
+
*/
|
|
115
|
+
async quickScan(targetPath) {
|
|
116
|
+
return this.scan({
|
|
117
|
+
targetPath,
|
|
118
|
+
runPolicyZone: false,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Run a full scan with policy evaluation
|
|
123
|
+
*/
|
|
124
|
+
async fullScan(targetPath) {
|
|
125
|
+
return this.scan({
|
|
126
|
+
targetPath,
|
|
127
|
+
runPolicyZone: true,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get available agents
|
|
132
|
+
*/
|
|
133
|
+
async getAvailableAgents() {
|
|
134
|
+
await this.initialize();
|
|
135
|
+
const available = [];
|
|
136
|
+
for (const agent of this.agents) {
|
|
137
|
+
if (await agent.isAvailable()) {
|
|
138
|
+
available.push(agent);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return available;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get current state for visualization
|
|
145
|
+
*/
|
|
146
|
+
getState() {
|
|
147
|
+
return this.manager.exportState();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Reset all zones
|
|
151
|
+
*/
|
|
152
|
+
reset() {
|
|
153
|
+
for (const zone of this.manager.getAllZones()) {
|
|
154
|
+
this.manager.resetZone(zone.config.id);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
buildSummary(findings, zoneResults) {
|
|
158
|
+
const byType = {};
|
|
159
|
+
const bySeverity = {};
|
|
160
|
+
const byZone = {};
|
|
161
|
+
const agentsUsed = new Set();
|
|
162
|
+
for (const finding of findings) {
|
|
163
|
+
byType[finding.type] = (byType[finding.type] || 0) + 1;
|
|
164
|
+
bySeverity[finding.severity] = (bySeverity[finding.severity] || 0) + 1;
|
|
165
|
+
}
|
|
166
|
+
for (const [zoneId, result] of zoneResults) {
|
|
167
|
+
byZone[zoneId] = result.findings.length;
|
|
168
|
+
for (const agentResult of result.agentResults) {
|
|
169
|
+
if (agentResult.status === 'success') {
|
|
170
|
+
agentsUsed.add(agentResult.agentName);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
totalFindings: findings.length,
|
|
176
|
+
byType,
|
|
177
|
+
bySeverity,
|
|
178
|
+
byZone,
|
|
179
|
+
agentsUsed: Array.from(agentsUsed),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Export singleton instance
|
|
184
|
+
export const orchestrator = new ParallelOrchestrator();
|
|
185
|
+
// Export zones
|
|
186
|
+
export * from '../zones/types.js';
|
|
187
|
+
export * from '../zones/manager.js';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { LocalScanResult } from '../integrations/local-scanner.js';
|
|
2
|
+
export interface SARIFRule {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
shortDescription: {
|
|
6
|
+
text: string;
|
|
7
|
+
};
|
|
8
|
+
fullDescription?: {
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
11
|
+
helpUri?: string;
|
|
12
|
+
defaultConfiguration?: {
|
|
13
|
+
level: 'none' | 'note' | 'warning' | 'error';
|
|
14
|
+
};
|
|
15
|
+
properties?: {
|
|
16
|
+
tags?: string[];
|
|
17
|
+
precision?: string;
|
|
18
|
+
'security-severity'?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface SARIFResult {
|
|
22
|
+
ruleId: string;
|
|
23
|
+
level: 'none' | 'note' | 'warning' | 'error';
|
|
24
|
+
message: {
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
locations?: Array<{
|
|
28
|
+
physicalLocation: {
|
|
29
|
+
artifactLocation: {
|
|
30
|
+
uri: string;
|
|
31
|
+
uriBaseId?: string;
|
|
32
|
+
};
|
|
33
|
+
region?: {
|
|
34
|
+
startLine: number;
|
|
35
|
+
startColumn?: number;
|
|
36
|
+
endLine?: number;
|
|
37
|
+
endColumn?: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
fixes?: Array<{
|
|
42
|
+
description: {
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
properties?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
export interface SARIFRun {
|
|
49
|
+
tool: {
|
|
50
|
+
driver: {
|
|
51
|
+
name: string;
|
|
52
|
+
informationUri: string;
|
|
53
|
+
version: string;
|
|
54
|
+
rules: SARIFRule[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
results: SARIFResult[];
|
|
58
|
+
invocations?: Array<{
|
|
59
|
+
executionSuccessful: boolean;
|
|
60
|
+
endTimeUtc?: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
export interface SARIFReport {
|
|
64
|
+
$schema: string;
|
|
65
|
+
version: '2.1.0';
|
|
66
|
+
runs: SARIFRun[];
|
|
67
|
+
}
|
|
68
|
+
export declare function toSARIF(result: LocalScanResult, targetPath?: string): SARIFReport;
|
|
69
|
+
export declare function toJUnit(result: LocalScanResult): string;
|
|
70
|
+
export interface GitLabVulnerability {
|
|
71
|
+
id: string;
|
|
72
|
+
category: string;
|
|
73
|
+
name: string;
|
|
74
|
+
message: string;
|
|
75
|
+
description: string;
|
|
76
|
+
severity: 'Critical' | 'High' | 'Medium' | 'Low' | 'Info' | 'Unknown';
|
|
77
|
+
confidence?: 'High' | 'Medium' | 'Low' | 'Unknown';
|
|
78
|
+
scanner: {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
};
|
|
82
|
+
location: {
|
|
83
|
+
file?: string;
|
|
84
|
+
start_line?: number;
|
|
85
|
+
end_line?: number;
|
|
86
|
+
dependency?: {
|
|
87
|
+
package: {
|
|
88
|
+
name: string;
|
|
89
|
+
};
|
|
90
|
+
version: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
identifiers: Array<{
|
|
94
|
+
type: string;
|
|
95
|
+
name: string;
|
|
96
|
+
value: string;
|
|
97
|
+
url?: string;
|
|
98
|
+
}>;
|
|
99
|
+
solution?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface GitLabSecurityReport {
|
|
102
|
+
version: string;
|
|
103
|
+
vulnerabilities: GitLabVulnerability[];
|
|
104
|
+
scan: {
|
|
105
|
+
analyzer: {
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
version: string;
|
|
109
|
+
vendor: {
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
scanner: {
|
|
114
|
+
id: string;
|
|
115
|
+
name: string;
|
|
116
|
+
version: string;
|
|
117
|
+
vendor: {
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
type: string;
|
|
122
|
+
start_time: string;
|
|
123
|
+
end_time: string;
|
|
124
|
+
status: 'success' | 'failure';
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export declare function toGitLabReport(result: LocalScanResult, reportType: 'sast' | 'dependency_scanning' | 'secret_detection'): GitLabSecurityReport;
|
|
128
|
+
export interface JSONSummary {
|
|
129
|
+
scan: {
|
|
130
|
+
path: string;
|
|
131
|
+
timestamp: string;
|
|
132
|
+
duration?: number;
|
|
133
|
+
tools: string[];
|
|
134
|
+
languages: string[];
|
|
135
|
+
};
|
|
136
|
+
summary: {
|
|
137
|
+
total: number;
|
|
138
|
+
critical: number;
|
|
139
|
+
high: number;
|
|
140
|
+
medium: number;
|
|
141
|
+
low: number;
|
|
142
|
+
};
|
|
143
|
+
findings: {
|
|
144
|
+
secrets: number;
|
|
145
|
+
vulnerabilities: number;
|
|
146
|
+
sast: number;
|
|
147
|
+
iac: number;
|
|
148
|
+
dockerfile: number;
|
|
149
|
+
};
|
|
150
|
+
exitCode: number;
|
|
151
|
+
}
|
|
152
|
+
export declare function toJSONSummary(result: LocalScanResult): JSONSummary;
|