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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 slopsecurityadmin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,446 @@
1
+ # aurasecurity
2
+
3
+ [![npm version](https://badge.fury.io/js/aura-security.svg)](https://www.npmjs.com/package/aura-security)
4
+ [![Docker](https://img.shields.io/badge/docker-ready-blue)](https://hub.docker.com)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ **A deterministic security auditing engine with an optional AI advisory layer.**
8
+
9
+ aurasecurity can be run as a CLI, a CI step, or a long-running service. The AI does not make enforcement decisions—all security findings come from deterministic scanners (Gitleaks, Trivy, Semgrep, etc.) with reproducible results.
10
+
11
+ Built on the Aura framework, it provides automated security analysis for code repositories and AWS infrastructure with a 3D visualization control plane.
12
+
13
+ ## Features
14
+
15
+ - **Multi-Scanner Integration** - Gitleaks, Trivy, Semgrep, npm audit
16
+ - **AWS Infrastructure Scanning** - IAM, S3, EC2, Lambda, RDS security checks
17
+ - **Real-time WebSocket Updates** - Instant notifications when scans complete
18
+ - **3D Visualization** - Interactive Three.js control plane
19
+ - **Notifications** - Slack, Discord, and custom webhook integrations
20
+ - **Persistent Storage** - SQLite database for audit history
21
+ - **Docker Ready** - Full containerization with security tools included
22
+ - **CI/CD Pipeline** - GitHub Actions for automated testing and publishing
23
+
24
+ ## Table of Contents
25
+
26
+ - [Installation](#installation)
27
+ - [Quick Start](#quick-start)
28
+ - [CLI Commands](#cli-commands)
29
+ - [API Endpoints](#api-endpoints)
30
+ - [Usage Examples](#usage-examples)
31
+ - [Security Scanning Tools](#security-scanning-tools)
32
+ - [AWS Scanning](#aws-scanning)
33
+ - [Docker Deployment](#docker-deployment)
34
+ - [Environment Variables](#environment-variables)
35
+ - [3D Visualizer Features](#3d-visualizer-features)
36
+ - [Development](#development)
37
+ - [Contributing](#contributing)
38
+ - [License](#license)
39
+
40
+ ## Installation
41
+
42
+ ### Prerequisites
43
+
44
+ - **Node.js** 18.x or higher
45
+ - **npm** 8.x or higher
46
+ - **Git** (for cloning the repository)
47
+
48
+ ### Option 1: Install via npm (Recommended)
49
+
50
+ ```bash
51
+ npm install -g aura-security
52
+
53
+ # Check installed tools
54
+ aura-security doctor
55
+ ```
56
+
57
+ After installation, you can use the `aura-security` command directly:
58
+
59
+ ```bash
60
+ aura-security --help
61
+ ```
62
+
63
+ ### Option 2: Clone from GitHub
64
+
65
+ ```bash
66
+ # Step 1: Clone the repository
67
+ git clone https://github.com/aurasecurityio/aura-security.git
68
+
69
+ # Step 2: Navigate to the project directory
70
+ cd aura-security
71
+
72
+ # Step 3: Install dependencies
73
+ npm install
74
+
75
+ # Step 4: Build the TypeScript code
76
+ npm run build
77
+
78
+ # Step 5: Verify installation
79
+ npm start -- --help
80
+ ```
81
+
82
+ ### Option 3: Run with Docker
83
+
84
+ ```bash
85
+ # Using Docker Compose (recommended)
86
+ docker-compose up -d
87
+
88
+ # Or build and run manually
89
+ docker build -t aura-security .
90
+ docker run -p 3000:3000 -p 3001:3001 -p 8080:8080 aura-security
91
+ ```
92
+
93
+ ## Quick Start
94
+
95
+ ### Running the Full Stack
96
+
97
+ **Terminal 1 - Start the Aura API Server:**
98
+ ```bash
99
+ npm start
100
+ # Server starts on http://127.0.0.1:3000
101
+ # WebSocket on ws://127.0.0.1:3001
102
+ ```
103
+
104
+ **Terminal 2 - Start the 3D Visualizer:**
105
+ ```bash
106
+ npm run visualizer
107
+ # Visualizer starts on http://127.0.0.1:8080
108
+ ```
109
+
110
+ **Open your browser:**
111
+ Navigate to http://127.0.0.1:8080 to access the 3D control plane.
112
+
113
+ ### Quick Test
114
+
115
+ Run a scan on a local directory:
116
+ ```bash
117
+ # Via CLI
118
+ aura-security scan ./my-project
119
+
120
+ # Or via API
121
+ curl -X POST http://127.0.0.1:3000/tools \
122
+ -H "Content-Type: application/json" \
123
+ -d '{"tool":"scan-local","arguments":{"targetPath":"./my-project"}}'
124
+ ```
125
+
126
+ ### One-Command Development Mode
127
+
128
+ ```bash
129
+ # Start both server and visualizer together
130
+ npm run full
131
+ ```
132
+
133
+ ## CLI Commands
134
+
135
+ ```bash
136
+ # Initialize configuration
137
+ aura-security init [path]
138
+
139
+ # Scan local directory
140
+ aura-security scan <path>
141
+
142
+ # Scan AWS infrastructure
143
+ aura-security aws
144
+ aura-security aws --region us-west-2 -s iam,s3,ec2
145
+
146
+ # Start Aura server
147
+ aura-security serve
148
+
149
+ # Start 3D visualizer
150
+ aura-security visualizer
151
+ ```
152
+
153
+ ## Architecture
154
+
155
+ ```
156
+ aura-security/
157
+ ├── src/
158
+ │ ├── index.ts # Main entry + Aura server
159
+ │ ├── cli.ts # CLI commands
160
+ │ ├── serve-visualizer.ts # 3D web UI server
161
+ │ ├── auditor/ # Core audit logic
162
+ │ ├── client/ # High-level SDK
163
+ │ ├── database/ # SQLite persistence
164
+ │ ├── integrations/ # External connectors
165
+ │ │ ├── aws-scanner.ts # AWS security scanning
166
+ │ │ ├── local-scanner.ts # Local repo scanning
167
+ │ │ ├── notifications.ts # Slack/Discord/webhooks
168
+ │ │ └── ...
169
+ │ ├── websocket/ # Real-time updates
170
+ │ └── aura/ # Aura protocol impl
171
+ ├── visualizer/ # 3D Web UI (Three.js)
172
+ ├── Dockerfile # Docker build
173
+ ├── docker-compose.yml # Docker Compose
174
+ └── .github/workflows/ # CI/CD pipeline
175
+ ```
176
+
177
+ ## API Endpoints
178
+
179
+ | Endpoint | Method | Description |
180
+ |----------|--------|-------------|
181
+ | `/info` | GET | Server information |
182
+ | `/tools` | GET | List available tools |
183
+ | `/tools` | POST | Execute a tool (scan, audit) |
184
+ | `/memory` | GET | List/retrieve from memory |
185
+ | `/memory` | POST | Store data in memory |
186
+ | `/settings` | GET | Get all settings |
187
+ | `/settings` | POST | Save settings |
188
+ | `/audits` | GET | List audit history |
189
+ | `/audits/:id` | GET | Get audit details |
190
+ | `/audits/:id` | DELETE | Delete an audit |
191
+ | `/stats` | GET | Audit statistics |
192
+ | `/notifications` | GET | Notification history |
193
+ | `/notifications/test` | POST | Test notification channel |
194
+ | `/notifications/send` | POST | Send notification |
195
+
196
+ ### WebSocket
197
+
198
+ Connect to `ws://127.0.0.1:3001` for real-time updates:
199
+
200
+ ```javascript
201
+ const ws = new WebSocket('ws://127.0.0.1:3001');
202
+ ws.onmessage = (event) => {
203
+ const msg = JSON.parse(event.data);
204
+ // msg.type: 'audit_started', 'audit_completed', 'finding', 'settings_changed'
205
+ };
206
+ ```
207
+
208
+ ## Usage Examples
209
+
210
+ ### Scan Local Directory
211
+
212
+ ```bash
213
+ # Via CLI
214
+ aura-security scan ./my-project
215
+
216
+ # Via API
217
+ curl -X POST http://127.0.0.1:3000/tools \
218
+ -H "Content-Type: application/json" \
219
+ -d '{
220
+ "tool": "scan-local",
221
+ "arguments": {
222
+ "targetPath": "/path/to/project"
223
+ }
224
+ }'
225
+ ```
226
+
227
+ ### Scan AWS Infrastructure
228
+
229
+ ```bash
230
+ # Via CLI
231
+ aura-security aws --region us-east-1 -s iam,s3,ec2
232
+
233
+ # Via API (configure in Settings UI first)
234
+ curl -X POST http://127.0.0.1:3000/tools \
235
+ -H "Content-Type: application/json" \
236
+ -d '{
237
+ "tool": "scan-aws",
238
+ "arguments": {
239
+ "region": "us-east-1",
240
+ "services": ["iam", "s3", "ec2"]
241
+ }
242
+ }'
243
+ ```
244
+
245
+ ### Configure Notifications
246
+
247
+ Use the Settings panel in the 3D visualizer or via API:
248
+
249
+ ```bash
250
+ curl -X POST http://127.0.0.1:3000/settings \
251
+ -H "Content-Type: application/json" \
252
+ -d '{
253
+ "settings": {
254
+ "notifications.slack.enabled": "true",
255
+ "notifications.slack.webhookUrl": "https://hooks.slack.com/services/..."
256
+ }
257
+ }'
258
+ ```
259
+
260
+ ### Use the Client SDK
261
+
262
+ ```typescript
263
+ import { AuditClient, createPullRequestEvent } from 'aura-security';
264
+
265
+ const client = new AuditClient({
266
+ serverUrl: 'http://127.0.0.1:3000'
267
+ });
268
+
269
+ // Check server health
270
+ const healthy = await client.isHealthy();
271
+
272
+ // Run an audit
273
+ const result = await client.audit({
274
+ changeEvent: createPullRequestEvent(
275
+ 'acme/webapp',
276
+ 'abc123...',
277
+ ['src/auth/login.ts'],
278
+ '+const API_KEY = "secret";',
279
+ 'staging'
280
+ ),
281
+ evidenceBundle: { vuln_scan: 'critical: 1' },
282
+ policyContext: {
283
+ critical_assets: ['auth', 'billing'],
284
+ risk_tolerance: 'low'
285
+ }
286
+ });
287
+
288
+ console.log(result.output?.agent_state); // 'blocked', 'escalated', etc.
289
+ ```
290
+
291
+ ## Security Scanning Tools
292
+
293
+ The scanner integrates with these security tools when available:
294
+
295
+ | Tool | Purpose | Install |
296
+ |------|---------|---------|
297
+ | **gitleaks** | Secrets detection | `winget install gitleaks` |
298
+ | **trivy** | Vulnerability scanning | `winget install trivy` |
299
+ | **semgrep** | SAST analysis | `pip install semgrep` |
300
+ | **npm audit** | NPM vulnerabilities | Built into npm |
301
+
302
+ Falls back to regex patterns if tools aren't installed.
303
+
304
+ ## AWS Scanning
305
+
306
+ Scans for security misconfigurations:
307
+
308
+ - **IAM**: Overly permissive policies, unused credentials, MFA status
309
+ - **S3**: Public buckets, missing encryption, insecure ACLs
310
+ - **EC2**: Open security groups, public IPs, unencrypted volumes
311
+ - **Lambda**: Overly permissive roles, exposed environment variables
312
+ - **RDS**: Public accessibility, encryption status, backup config
313
+
314
+ ## Docker Deployment
315
+
316
+ ```bash
317
+ # Build and run with Docker Compose
318
+ docker-compose up -d
319
+
320
+ # Or build manually
321
+ docker build -t aura-security .
322
+ docker run -p 3000:3000 -p 3001:3001 -p 8080:8080 aura-security
323
+
324
+ # With AWS credentials
325
+ docker run -p 3000:3000 -p 3001:3001 -p 8080:8080 \
326
+ -e AWS_ACCESS_KEY_ID=xxx \
327
+ -e AWS_SECRET_ACCESS_KEY=xxx \
328
+ -e AWS_DEFAULT_REGION=us-east-1 \
329
+ aura-security
330
+ ```
331
+
332
+ ## Environment Variables
333
+
334
+ | Variable | Default | Description |
335
+ |----------|---------|-------------|
336
+ | `AURA_PORT` | 3000 | Aura HTTP server port |
337
+ | `WS_PORT` | 3001 | WebSocket server port |
338
+ | `VISUALIZER_PORT` | 8080 | 3D visualizer web server port |
339
+ | `AURA_BUS_URL` | - | External Aura bus URL (optional) |
340
+ | `AWS_DEFAULT_REGION` | us-east-1 | AWS region for scanning |
341
+
342
+ ## 3D Visualizer Features
343
+
344
+ The web-based 3D control plane provides:
345
+
346
+ - Real-time agent state visualization
347
+ - Interactive Three.js scene with orbit controls
348
+ - Module management (add/remove/configure)
349
+ - Audit history browser with click-to-view details
350
+ - Settings panel for AWS/Slack/Discord configuration
351
+ - Live WebSocket updates (no polling delay)
352
+ - Quick-action presets for testing
353
+
354
+ ## Development
355
+
356
+ ```bash
357
+ # Install dependencies
358
+ npm install
359
+
360
+ # Build TypeScript
361
+ npm run build
362
+
363
+ # Run in development mode
364
+ npm run dev
365
+
366
+ # Run both server and visualizer
367
+ npm run full
368
+
369
+ # Run tests
370
+ npm test
371
+ ```
372
+
373
+ ## Publishing
374
+
375
+ ```bash
376
+ # npm
377
+ npm login
378
+ npm publish --access public
379
+
380
+ # Docker Hub
381
+ docker build -t yourusername/aura-security .
382
+ docker push yourusername/aura-security
383
+ ```
384
+
385
+ ## Contributing
386
+
387
+ 1. Fork the repository
388
+ 2. Create a feature branch (`git checkout -b feature/amazing`)
389
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
390
+ 4. Push to the branch (`git push origin feature/amazing`)
391
+ 5. Open a Pull Request
392
+
393
+ ## Troubleshooting
394
+
395
+ ### Common Issues
396
+
397
+ **Port already in use:**
398
+ ```bash
399
+ # Check what's using port 3000
400
+ netstat -ano | findstr :3000 # Windows
401
+ lsof -i :3000 # macOS/Linux
402
+
403
+ # Use a different port
404
+ AURA_PORT=3001 npm start
405
+ ```
406
+
407
+ **Security tools not found:**
408
+ The scanner will fall back to regex patterns if tools aren't installed. For best results, install:
409
+ ```bash
410
+ # Windows
411
+ winget install gitleaks
412
+ winget install trivy
413
+
414
+ # macOS
415
+ brew install gitleaks
416
+ brew install trivy
417
+
418
+ # Linux
419
+ # See respective tool documentation for installation
420
+ ```
421
+
422
+ **WebSocket connection failed:**
423
+ Ensure the WebSocket server is running on port 3001. Check browser console for errors.
424
+
425
+ **Database errors:**
426
+ The SQLite database is stored in `.aura-security/auditor.db`. To reset:
427
+ ```bash
428
+ rm -rf .aura-security/
429
+ npm start # Will recreate the database
430
+ ```
431
+
432
+ ### Getting Help
433
+
434
+ - Check the [Issue Tracker](https://github.com/aurasecurityio/aura-security/issues) for known issues
435
+ - Open a new issue with your error message and environment details
436
+
437
+ ## License
438
+
439
+ MIT - See [LICENSE](LICENSE) for details.
440
+
441
+ ## Links
442
+
443
+ - [GitHub Repository](https://github.com/aurasecurityio/aura-security)
444
+ - [npm Package](https://www.npmjs.com/package/aura-security)
445
+ - [Issue Tracker](https://github.com/aurasecurityio/aura-security/issues)
446
+ - [Changelog](CHANGELOG.md)