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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +446 -0
  3. package/deploy/AWS-DEPLOYMENT.md +358 -0
  4. package/deploy/terraform/main.tf +362 -0
  5. package/deploy/terraform/terraform.tfvars.example +6 -0
  6. package/dist/agents/base.d.ts +44 -0
  7. package/dist/agents/base.js +96 -0
  8. package/dist/agents/index.d.ts +14 -0
  9. package/dist/agents/index.js +17 -0
  10. package/dist/agents/policy/evaluator.d.ts +15 -0
  11. package/dist/agents/policy/evaluator.js +183 -0
  12. package/dist/agents/policy/index.d.ts +12 -0
  13. package/dist/agents/policy/index.js +15 -0
  14. package/dist/agents/policy/validator.d.ts +15 -0
  15. package/dist/agents/policy/validator.js +182 -0
  16. package/dist/agents/scanners/gitleaks.d.ts +14 -0
  17. package/dist/agents/scanners/gitleaks.js +155 -0
  18. package/dist/agents/scanners/grype.d.ts +14 -0
  19. package/dist/agents/scanners/grype.js +109 -0
  20. package/dist/agents/scanners/index.d.ts +15 -0
  21. package/dist/agents/scanners/index.js +27 -0
  22. package/dist/agents/scanners/npm-audit.d.ts +13 -0
  23. package/dist/agents/scanners/npm-audit.js +129 -0
  24. package/dist/agents/scanners/semgrep.d.ts +14 -0
  25. package/dist/agents/scanners/semgrep.js +131 -0
  26. package/dist/agents/scanners/trivy.d.ts +14 -0
  27. package/dist/agents/scanners/trivy.js +122 -0
  28. package/dist/agents/types.d.ts +137 -0
  29. package/dist/agents/types.js +91 -0
  30. package/dist/auditor/index.d.ts +3 -0
  31. package/dist/auditor/index.js +2 -0
  32. package/dist/auditor/pipeline.d.ts +19 -0
  33. package/dist/auditor/pipeline.js +240 -0
  34. package/dist/auditor/validator.d.ts +17 -0
  35. package/dist/auditor/validator.js +58 -0
  36. package/dist/aura/client.d.ts +29 -0
  37. package/dist/aura/client.js +125 -0
  38. package/dist/aura/index.d.ts +4 -0
  39. package/dist/aura/index.js +2 -0
  40. package/dist/aura/server.d.ts +45 -0
  41. package/dist/aura/server.js +343 -0
  42. package/dist/cli.d.ts +17 -0
  43. package/dist/cli.js +1433 -0
  44. package/dist/client/index.d.ts +41 -0
  45. package/dist/client/index.js +170 -0
  46. package/dist/compliance/index.d.ts +40 -0
  47. package/dist/compliance/index.js +292 -0
  48. package/dist/database/index.d.ts +77 -0
  49. package/dist/database/index.js +395 -0
  50. package/dist/index.d.ts +25 -0
  51. package/dist/index.js +762 -0
  52. package/dist/integrations/aura-scanner.d.ts +69 -0
  53. package/dist/integrations/aura-scanner.js +155 -0
  54. package/dist/integrations/aws-scanner.d.ts +63 -0
  55. package/dist/integrations/aws-scanner.js +624 -0
  56. package/dist/integrations/config.d.ts +69 -0
  57. package/dist/integrations/config.js +212 -0
  58. package/dist/integrations/github.d.ts +45 -0
  59. package/dist/integrations/github.js +201 -0
  60. package/dist/integrations/gitlab.d.ts +36 -0
  61. package/dist/integrations/gitlab.js +110 -0
  62. package/dist/integrations/index.d.ts +11 -0
  63. package/dist/integrations/index.js +11 -0
  64. package/dist/integrations/local-scanner.d.ts +146 -0
  65. package/dist/integrations/local-scanner.js +1654 -0
  66. package/dist/integrations/notifications.d.ts +99 -0
  67. package/dist/integrations/notifications.js +305 -0
  68. package/dist/integrations/scanners.d.ts +57 -0
  69. package/dist/integrations/scanners.js +217 -0
  70. package/dist/integrations/slop-scanner.d.ts +69 -0
  71. package/dist/integrations/slop-scanner.js +155 -0
  72. package/dist/integrations/webhook.d.ts +37 -0
  73. package/dist/integrations/webhook.js +256 -0
  74. package/dist/orchestrator/index.d.ts +72 -0
  75. package/dist/orchestrator/index.js +187 -0
  76. package/dist/output/index.d.ts +152 -0
  77. package/dist/output/index.js +399 -0
  78. package/dist/pipeline/index.d.ts +72 -0
  79. package/dist/pipeline/index.js +313 -0
  80. package/dist/sbom/index.d.ts +94 -0
  81. package/dist/sbom/index.js +298 -0
  82. package/dist/schemas/index.d.ts +2 -0
  83. package/dist/schemas/index.js +2 -0
  84. package/dist/schemas/input.schema.d.ts +87 -0
  85. package/dist/schemas/input.schema.js +44 -0
  86. package/dist/schemas/output.schema.d.ts +115 -0
  87. package/dist/schemas/output.schema.js +64 -0
  88. package/dist/serve-visualizer.d.ts +2 -0
  89. package/dist/serve-visualizer.js +78 -0
  90. package/dist/slop/client.d.ts +29 -0
  91. package/dist/slop/client.js +125 -0
  92. package/dist/slop/index.d.ts +4 -0
  93. package/dist/slop/index.js +2 -0
  94. package/dist/slop/server.d.ts +45 -0
  95. package/dist/slop/server.js +343 -0
  96. package/dist/types/events.d.ts +62 -0
  97. package/dist/types/events.js +2 -0
  98. package/dist/types/index.d.ts +1 -0
  99. package/dist/types/index.js +1 -0
  100. package/dist/visualizer/index.d.ts +4 -0
  101. package/dist/visualizer/index.js +181 -0
  102. package/dist/websocket/index.d.ts +88 -0
  103. package/dist/websocket/index.js +195 -0
  104. package/dist/zones/index.d.ts +7 -0
  105. package/dist/zones/index.js +7 -0
  106. package/dist/zones/manager.d.ts +101 -0
  107. package/dist/zones/manager.js +304 -0
  108. package/dist/zones/types.d.ts +78 -0
  109. package/dist/zones/types.js +33 -0
  110. package/package.json +84 -0
  111. package/visualizer/app.js +0 -0
  112. package/visualizer/index-minimal.html +1771 -0
  113. package/visualizer/index.html +2933 -0
  114. package/visualizer/landing.html +1328 -0
  115. package/visualizer/styles.css +0 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Aura Protocol Scanner
3
+ *
4
+ * Wrapper that uses the Aura Protocol multi-agent architecture
5
+ * while maintaining backward compatibility with the existing scanner interface.
6
+ */
7
+ import { orchestrator, OrchestratorResult } from '../orchestrator/index.js';
8
+ import { ZoneFinding } from '../zones/types.js';
9
+ import type { LocalScanResult } from './local-scanner.js';
10
+ export interface AuraScanConfig {
11
+ targetPath: string;
12
+ fullScan?: boolean;
13
+ enableScannerZone?: boolean;
14
+ enablePolicyZone?: boolean;
15
+ }
16
+ export interface AuraScanResult {
17
+ legacy: LocalScanResult;
18
+ aura: {
19
+ zones: Array<{
20
+ id: string;
21
+ name: string;
22
+ type: string;
23
+ color: string;
24
+ status: string;
25
+ findingCount: number;
26
+ duration: number;
27
+ }>;
28
+ agents: Array<{
29
+ id: string;
30
+ name: string;
31
+ role: string;
32
+ status: string;
33
+ findingCount: number;
34
+ duration: number;
35
+ }>;
36
+ findings: ZoneFinding[];
37
+ summary: OrchestratorResult['summary'];
38
+ };
39
+ }
40
+ /**
41
+ * Run a security scan using the Aura Protocol architecture
42
+ */
43
+ export declare function auraScan(config: AuraScanConfig): Promise<AuraScanResult>;
44
+ /**
45
+ * Get orchestrator state for visualization
46
+ */
47
+ export declare function getAuraState(): {
48
+ zones: Array<{
49
+ id: string;
50
+ name: string;
51
+ type: string;
52
+ color: string;
53
+ status: import("../zones/types.js").ZoneStatus;
54
+ agentCount: number;
55
+ findingCount: number;
56
+ }>;
57
+ agents: Array<{
58
+ id: string;
59
+ name: string;
60
+ role: string;
61
+ zoneId: string | null;
62
+ status: string;
63
+ }>;
64
+ };
65
+ /**
66
+ * Get available agents
67
+ */
68
+ export declare function getAvailableAgents(): Promise<import("../agents/types.js").Agent[]>;
69
+ export { orchestrator };
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Aura Protocol Scanner
3
+ *
4
+ * Wrapper that uses the Aura Protocol multi-agent architecture
5
+ * while maintaining backward compatibility with the existing scanner interface.
6
+ */
7
+ import * as os from 'os';
8
+ import { orchestrator } from '../orchestrator/index.js';
9
+ /**
10
+ * Run a security scan using the Aura Protocol architecture
11
+ */
12
+ export async function auraScan(config) {
13
+ console.log('[Aura] Starting Aura Protocol scan...');
14
+ console.log(`[Aura] Target: ${config.targetPath}`);
15
+ // Run orchestrator
16
+ const result = config.fullScan !== false
17
+ ? await orchestrator.fullScan(config.targetPath)
18
+ : await orchestrator.quickScan(config.targetPath);
19
+ console.log(`[Aura] Scan complete in ${result.duration}ms`);
20
+ console.log(`[Aura] Agents used: ${result.summary.agentsUsed.join(', ')}`);
21
+ console.log(`[Aura] Total findings: ${result.summary.totalFindings}`);
22
+ // Convert to legacy format
23
+ const legacy = convertToLegacyFormat(result);
24
+ // Build Aura format with zone info
25
+ const zones = Array.from(result.zoneResults.entries()).map(([zoneId, zoneResult]) => ({
26
+ id: zoneId,
27
+ name: zoneResult.zoneName,
28
+ type: zoneResult.zoneType,
29
+ color: getZoneColor(zoneResult.zoneType),
30
+ status: zoneResult.status,
31
+ findingCount: zoneResult.findings.length,
32
+ duration: zoneResult.duration,
33
+ }));
34
+ const agents = Array.from(result.zoneResults.values()).flatMap((zoneResult) => zoneResult.agentResults.map((agentResult) => ({
35
+ id: agentResult.agentId,
36
+ name: agentResult.agentName,
37
+ role: getAgentRole(agentResult.agentId),
38
+ status: agentResult.status,
39
+ findingCount: agentResult.findings.length,
40
+ duration: agentResult.duration,
41
+ })));
42
+ return {
43
+ legacy,
44
+ aura: {
45
+ zones,
46
+ agents,
47
+ findings: result.findings,
48
+ summary: result.summary,
49
+ },
50
+ };
51
+ }
52
+ /**
53
+ * Convert orchestrator result to legacy LocalScanResult format
54
+ */
55
+ function convertToLegacyFormat(result) {
56
+ const secrets = [];
57
+ const packages = [];
58
+ const sastFindings = [];
59
+ const iacFindings = [];
60
+ for (const finding of result.findings) {
61
+ if (finding.type === 'secret') {
62
+ secrets.push({
63
+ file: finding.file || '',
64
+ line: finding.line || 0,
65
+ type: finding.title,
66
+ snippet: finding.metadata?.match || '***',
67
+ severity: finding.severity,
68
+ });
69
+ }
70
+ else if (finding.type === 'vulnerability') {
71
+ packages.push({
72
+ name: finding.metadata?.package || finding.title,
73
+ version: finding.metadata?.installedVersion || finding.metadata?.version || 'unknown',
74
+ vulnerabilities: 1,
75
+ severity: finding.severity,
76
+ vulnId: finding.metadata?.vulnerabilityId || undefined,
77
+ title: finding.title,
78
+ fixedVersion: finding.metadata?.fixedVersion || finding.metadata?.fixVersions?.[0],
79
+ });
80
+ }
81
+ else if (finding.type === 'policy_violation') {
82
+ // Map policy violations to SAST findings
83
+ sastFindings.push({
84
+ file: finding.file || '',
85
+ line: finding.line || 0,
86
+ rule: finding.title,
87
+ message: finding.description,
88
+ severity: finding.severity,
89
+ });
90
+ }
91
+ }
92
+ return {
93
+ path: result.targetPath,
94
+ timestamp: new Date().toISOString(),
95
+ secrets,
96
+ packages,
97
+ sastFindings,
98
+ iacFindings,
99
+ dockerfileFindings: [],
100
+ gitInfo: null,
101
+ envFiles: [],
102
+ systemInfo: {
103
+ platform: process.platform,
104
+ hostname: os.hostname(),
105
+ user: os.userInfo().username,
106
+ nodeVersion: process.version,
107
+ cwd: process.cwd(),
108
+ },
109
+ discoveredServices: [],
110
+ discoveredModules: [],
111
+ toolsUsed: result.summary.agentsUsed,
112
+ languagesDetected: [],
113
+ };
114
+ }
115
+ function getZoneColor(zoneType) {
116
+ switch (zoneType) {
117
+ case 'scanner':
118
+ return '#22c55e'; // Green
119
+ case 'policy':
120
+ return '#ef4444'; // Red
121
+ case 'reporting':
122
+ return '#3b82f6'; // Blue
123
+ default:
124
+ return '#888888';
125
+ }
126
+ }
127
+ function getAgentRole(agentId) {
128
+ const scannerAgents = ['gitleaks', 'trivy', 'semgrep', 'grype', 'npm-audit'];
129
+ const policyAgents = ['policy-evaluator', 'validator'];
130
+ const reporterAgents = ['sarif-reporter'];
131
+ const notifierAgents = ['slack-notifier', 'discord-notifier'];
132
+ if (scannerAgents.includes(agentId))
133
+ return 'scanner';
134
+ if (policyAgents.includes(agentId))
135
+ return 'policy';
136
+ if (reporterAgents.includes(agentId))
137
+ return 'reporter';
138
+ if (notifierAgents.includes(agentId))
139
+ return 'notifier';
140
+ return 'unknown';
141
+ }
142
+ /**
143
+ * Get orchestrator state for visualization
144
+ */
145
+ export function getAuraState() {
146
+ return orchestrator.getState();
147
+ }
148
+ /**
149
+ * Get available agents
150
+ */
151
+ export async function getAvailableAgents() {
152
+ return orchestrator.getAvailableAgents();
153
+ }
154
+ // Export orchestrator for direct access
155
+ export { orchestrator };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * AWS Security Scanner
3
+ * Scans AWS infrastructure for security issues:
4
+ * - IAM: overly permissive policies, unused credentials, MFA status
5
+ * - S3: public buckets, unencrypted buckets, versioning
6
+ * - EC2: security groups, public IPs, unencrypted volumes
7
+ * - Lambda: public functions, environment secrets
8
+ * - RDS: public instances, unencrypted databases
9
+ */
10
+ export interface AWSFinding {
11
+ service: 'iam' | 's3' | 'ec2' | 'lambda' | 'rds';
12
+ resourceType: string;
13
+ resourceId: string;
14
+ resourceArn?: string;
15
+ severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
16
+ title: string;
17
+ description: string;
18
+ remediation?: string;
19
+ metadata?: Record<string, unknown>;
20
+ }
21
+ export interface AWSScanConfig {
22
+ region?: string;
23
+ profile?: string;
24
+ services?: ('iam' | 's3' | 'ec2' | 'lambda' | 'rds')[];
25
+ skipServices?: ('iam' | 's3' | 'ec2' | 'lambda' | 'rds')[];
26
+ }
27
+ export interface AWSScanResult {
28
+ timestamp: string;
29
+ region: string;
30
+ accountId?: string;
31
+ findings: AWSFinding[];
32
+ summary: {
33
+ critical: number;
34
+ high: number;
35
+ medium: number;
36
+ low: number;
37
+ info: number;
38
+ total: number;
39
+ };
40
+ scannedServices: string[];
41
+ errors: Array<{
42
+ service: string;
43
+ error: string;
44
+ }>;
45
+ }
46
+ export declare class AWSScanner {
47
+ private region;
48
+ private iamClient;
49
+ private s3Client;
50
+ private ec2Client;
51
+ private lambdaClient;
52
+ private rdsClient;
53
+ private config;
54
+ constructor(config?: AWSScanConfig);
55
+ scan(): Promise<AWSScanResult>;
56
+ private scanIAM;
57
+ private scanS3;
58
+ private scanEC2;
59
+ private isSensitivePort;
60
+ private scanLambda;
61
+ private scanRDS;
62
+ }
63
+ export declare function scanAWS(config?: AWSScanConfig): Promise<AWSScanResult>;