@sparkleideas/security 3.0.0-alpha.22 → 3.0.0-alpha.49

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 (54) hide show
  1. package/dist/CVE-REMEDIATION.d.ts +86 -0
  2. package/dist/CVE-REMEDIATION.d.ts.map +1 -0
  3. package/dist/CVE-REMEDIATION.js +221 -0
  4. package/dist/CVE-REMEDIATION.js.map +1 -0
  5. package/dist/application/index.d.ts +7 -0
  6. package/dist/application/index.d.ts.map +1 -0
  7. package/dist/application/index.js +7 -0
  8. package/dist/application/index.js.map +1 -0
  9. package/dist/application/services/security-application-service.d.ts +71 -0
  10. package/dist/application/services/security-application-service.d.ts.map +1 -0
  11. package/dist/application/services/security-application-service.js +153 -0
  12. package/dist/application/services/security-application-service.js.map +1 -0
  13. package/dist/credential-generator.d.ts +176 -0
  14. package/dist/credential-generator.d.ts.map +1 -0
  15. package/dist/credential-generator.js +272 -0
  16. package/dist/credential-generator.js.map +1 -0
  17. package/dist/domain/entities/security-context.d.ts +68 -0
  18. package/dist/domain/entities/security-context.d.ts.map +1 -0
  19. package/dist/domain/entities/security-context.js +132 -0
  20. package/dist/domain/entities/security-context.js.map +1 -0
  21. package/dist/domain/index.d.ts +8 -0
  22. package/dist/domain/index.d.ts.map +1 -0
  23. package/dist/domain/index.js +8 -0
  24. package/dist/domain/index.js.map +1 -0
  25. package/dist/domain/services/security-domain-service.d.ts +71 -0
  26. package/dist/domain/services/security-domain-service.d.ts.map +1 -0
  27. package/dist/domain/services/security-domain-service.js +237 -0
  28. package/dist/domain/services/security-domain-service.js.map +1 -0
  29. package/dist/index.d.ts +119 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +145 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/input-validator.d.ts +338 -0
  34. package/dist/input-validator.d.ts.map +1 -0
  35. package/dist/input-validator.js +393 -0
  36. package/dist/input-validator.js.map +1 -0
  37. package/dist/password-hasher.d.ts +128 -0
  38. package/dist/password-hasher.d.ts.map +1 -0
  39. package/dist/password-hasher.js +183 -0
  40. package/dist/password-hasher.js.map +1 -0
  41. package/dist/path-validator.d.ts +148 -0
  42. package/dist/path-validator.d.ts.map +1 -0
  43. package/dist/path-validator.js +421 -0
  44. package/dist/path-validator.js.map +1 -0
  45. package/dist/safe-executor.d.ts +173 -0
  46. package/dist/safe-executor.d.ts.map +1 -0
  47. package/dist/safe-executor.js +370 -0
  48. package/dist/safe-executor.js.map +1 -0
  49. package/dist/token-generator.d.ts +224 -0
  50. package/dist/token-generator.d.ts.map +1 -0
  51. package/dist/token-generator.js +351 -0
  52. package/dist/token-generator.js.map +1 -0
  53. package/package.json +1 -1
  54. package/tsconfig.build.tsbuildinfo +1 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Security Domain Layer - Public Exports
3
+ *
4
+ * @module v3/security/domain
5
+ */
6
+ export { SecurityContext, type PermissionLevel, type SecurityContextProps, } from './entities/security-context.js';
7
+ export { SecurityDomainService, type ValidationResult, type ThreatDetectionResult, } from './services/security-domain-service.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Security Domain Layer - Public Exports
3
+ *
4
+ * @module v3/security/domain
5
+ */
6
+ export { SecurityContext, } from './entities/security-context.js';
7
+ export { SecurityDomainService, } from './services/security-domain-service.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,GAGhB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,qBAAqB,GAGtB,MAAM,uCAAuC,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Security Domain Service - Domain Layer
3
+ *
4
+ * Contains security logic for validation, policy enforcement, and threat detection.
5
+ *
6
+ * @module v3/security/domain/services
7
+ */
8
+ import { SecurityContext } from '../entities/security-context.js';
9
+ /**
10
+ * Validation result
11
+ */
12
+ export interface ValidationResult {
13
+ valid: boolean;
14
+ errors: string[];
15
+ warnings: string[];
16
+ sanitized?: string;
17
+ }
18
+ /**
19
+ * Threat detection result
20
+ */
21
+ export interface ThreatDetectionResult {
22
+ safe: boolean;
23
+ threats: Array<{
24
+ type: string;
25
+ severity: 'low' | 'medium' | 'high' | 'critical';
26
+ description: string;
27
+ location?: string;
28
+ }>;
29
+ }
30
+ /**
31
+ * Security Domain Service
32
+ */
33
+ export declare class SecurityDomainService {
34
+ private static readonly PATH_TRAVERSAL_PATTERNS;
35
+ private static readonly DANGEROUS_COMMANDS;
36
+ private static readonly SQL_INJECTION_PATTERNS;
37
+ private static readonly XSS_PATTERNS;
38
+ /**
39
+ * Validate a file path
40
+ */
41
+ validatePath(path: string, context: SecurityContext): ValidationResult;
42
+ /**
43
+ * Validate a command
44
+ */
45
+ validateCommand(command: string, context: SecurityContext): ValidationResult;
46
+ /**
47
+ * Validate user input
48
+ */
49
+ validateInput(input: string): ValidationResult;
50
+ /**
51
+ * Detect threats in content
52
+ */
53
+ detectThreats(content: string): ThreatDetectionResult;
54
+ /**
55
+ * Sanitize path
56
+ */
57
+ private sanitizePath;
58
+ /**
59
+ * Sanitize command
60
+ */
61
+ private sanitizeCommand;
62
+ /**
63
+ * Sanitize user input
64
+ */
65
+ private sanitizeInput;
66
+ /**
67
+ * Create security context for agent
68
+ */
69
+ createAgentContext(agentId: string, role: string, customPaths?: string[]): SecurityContext;
70
+ }
71
+ //# sourceMappingURL=security-domain-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-domain-service.d.ts","sourceRoot":"","sources":["../../../src/domain/services/security-domain-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAmB,MAAM,iCAAiC,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;QACjD,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAEhC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAQ7C;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAYxC;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAO5C;IAGF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAOlC;IAEF;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,gBAAgB;IA6BtE;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,gBAAgB;IAiC5E;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAiC9C;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB;IA0CrD;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;IACH,kBAAkB,CAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,eAAe;CAuBnB"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Security Domain Service - Domain Layer
3
+ *
4
+ * Contains security logic for validation, policy enforcement, and threat detection.
5
+ *
6
+ * @module v3/security/domain/services
7
+ */
8
+ import { SecurityContext } from '../entities/security-context.js';
9
+ /**
10
+ * Security Domain Service
11
+ */
12
+ export class SecurityDomainService {
13
+ // Dangerous patterns for path traversal
14
+ static PATH_TRAVERSAL_PATTERNS = [
15
+ /\.\./,
16
+ /~\//,
17
+ /^\/etc\//,
18
+ /^\/tmp\//,
19
+ /^\/var\/log\//,
20
+ /^C:\\Windows/i,
21
+ /^C:\\Users\\[^\\]+\\AppData/i,
22
+ ];
23
+ // Dangerous command patterns
24
+ static DANGEROUS_COMMANDS = [
25
+ /^rm\s+-rf\s+\//,
26
+ /^rm\s+-rf\s+\*/,
27
+ /^dd\s+if=/,
28
+ /^mkfs\./,
29
+ /^format\s+/i,
30
+ /^del\s+\/s\s+\/q/i,
31
+ />\s*\/dev\/sd[a-z]/,
32
+ /\|\s*bash$/,
33
+ /\|\s*sh$/,
34
+ /eval\s*\(/,
35
+ /exec\s*\(/,
36
+ ];
37
+ // SQL injection patterns
38
+ static SQL_INJECTION_PATTERNS = [
39
+ /'\s*OR\s+'1'\s*=\s*'1/i,
40
+ /'\s*OR\s+1\s*=\s*1/i,
41
+ /;\s*DROP\s+TABLE/i,
42
+ /;\s*DELETE\s+FROM/i,
43
+ /UNION\s+SELECT/i,
44
+ /--\s*$/,
45
+ ];
46
+ // XSS patterns
47
+ static XSS_PATTERNS = [
48
+ /<script[\s>]/i,
49
+ /javascript:/i,
50
+ /on\w+\s*=/i,
51
+ /<iframe/i,
52
+ /<object/i,
53
+ /<embed/i,
54
+ ];
55
+ /**
56
+ * Validate a file path
57
+ */
58
+ validatePath(path, context) {
59
+ const errors = [];
60
+ const warnings = [];
61
+ // Check path traversal
62
+ for (const pattern of SecurityDomainService.PATH_TRAVERSAL_PATTERNS) {
63
+ if (pattern.test(path)) {
64
+ errors.push(`Path traversal detected: ${pattern.source}`);
65
+ }
66
+ }
67
+ // Check context permissions
68
+ if (!context.canAccessPath(path)) {
69
+ errors.push(`Access denied to path: ${path}`);
70
+ }
71
+ // Check for suspicious paths
72
+ if (path.includes('..')) {
73
+ warnings.push('Path contains parent directory reference');
74
+ }
75
+ return {
76
+ valid: errors.length === 0,
77
+ errors,
78
+ warnings,
79
+ sanitized: this.sanitizePath(path),
80
+ };
81
+ }
82
+ /**
83
+ * Validate a command
84
+ */
85
+ validateCommand(command, context) {
86
+ const errors = [];
87
+ const warnings = [];
88
+ // Check dangerous commands
89
+ for (const pattern of SecurityDomainService.DANGEROUS_COMMANDS) {
90
+ if (pattern.test(command)) {
91
+ errors.push(`Dangerous command pattern detected: ${pattern.source}`);
92
+ }
93
+ }
94
+ // Check context permissions
95
+ if (!context.canExecuteCommand(command)) {
96
+ errors.push(`Command execution denied: ${command}`);
97
+ }
98
+ if (!context.hasPermission('execute')) {
99
+ errors.push('Execute permission required');
100
+ }
101
+ // Check for shell injection
102
+ if (/[;&|`$(){}]/.test(command)) {
103
+ warnings.push('Command contains shell metacharacters');
104
+ }
105
+ return {
106
+ valid: errors.length === 0,
107
+ errors,
108
+ warnings,
109
+ sanitized: this.sanitizeCommand(command),
110
+ };
111
+ }
112
+ /**
113
+ * Validate user input
114
+ */
115
+ validateInput(input) {
116
+ const errors = [];
117
+ const warnings = [];
118
+ // Check for SQL injection
119
+ for (const pattern of SecurityDomainService.SQL_INJECTION_PATTERNS) {
120
+ if (pattern.test(input)) {
121
+ errors.push(`SQL injection pattern detected`);
122
+ break;
123
+ }
124
+ }
125
+ // Check for XSS
126
+ for (const pattern of SecurityDomainService.XSS_PATTERNS) {
127
+ if (pattern.test(input)) {
128
+ errors.push(`XSS pattern detected`);
129
+ break;
130
+ }
131
+ }
132
+ // Check length
133
+ if (input.length > 10000) {
134
+ warnings.push('Input exceeds recommended length');
135
+ }
136
+ return {
137
+ valid: errors.length === 0,
138
+ errors,
139
+ warnings,
140
+ sanitized: this.sanitizeInput(input),
141
+ };
142
+ }
143
+ /**
144
+ * Detect threats in content
145
+ */
146
+ detectThreats(content) {
147
+ const threats = [];
148
+ // Check for various threat patterns
149
+ if (/<script/i.test(content)) {
150
+ threats.push({
151
+ type: 'xss',
152
+ severity: 'high',
153
+ description: 'Script tag detected',
154
+ });
155
+ }
156
+ if (/password\s*[:=]\s*["'][^"']+["']/i.test(content)) {
157
+ threats.push({
158
+ type: 'credential-exposure',
159
+ severity: 'critical',
160
+ description: 'Hardcoded password detected',
161
+ });
162
+ }
163
+ if (/api[_-]?key\s*[:=]\s*["'][^"']+["']/i.test(content)) {
164
+ threats.push({
165
+ type: 'credential-exposure',
166
+ severity: 'critical',
167
+ description: 'API key detected',
168
+ });
169
+ }
170
+ if (/eval\s*\(/.test(content)) {
171
+ threats.push({
172
+ type: 'code-injection',
173
+ severity: 'high',
174
+ description: 'Eval statement detected',
175
+ });
176
+ }
177
+ return {
178
+ safe: threats.length === 0,
179
+ threats,
180
+ };
181
+ }
182
+ /**
183
+ * Sanitize path
184
+ */
185
+ sanitizePath(path) {
186
+ return path
187
+ .replace(/\.\./g, '')
188
+ .replace(/\/\//g, '/')
189
+ .replace(/^~\//, '')
190
+ .trim();
191
+ }
192
+ /**
193
+ * Sanitize command
194
+ */
195
+ sanitizeCommand(command) {
196
+ return command
197
+ .replace(/[;&|`$]/g, '')
198
+ .replace(/\$\([^)]*\)/g, '')
199
+ .trim();
200
+ }
201
+ /**
202
+ * Sanitize user input
203
+ */
204
+ sanitizeInput(input) {
205
+ return input
206
+ .replace(/</g, '&lt;')
207
+ .replace(/>/g, '&gt;')
208
+ .replace(/"/g, '&quot;')
209
+ .replace(/'/g, '&#x27;')
210
+ .replace(/\//g, '&#x2F;');
211
+ }
212
+ /**
213
+ * Create security context for agent
214
+ */
215
+ createAgentContext(agentId, role, customPaths) {
216
+ // Default permissions based on role
217
+ const rolePermissions = {
218
+ 'queen-coordinator': ['read', 'write', 'execute', 'admin'],
219
+ 'security-architect': ['read', 'write', 'execute', 'admin'],
220
+ 'coder': ['read', 'write', 'execute'],
221
+ 'reviewer': ['read'],
222
+ 'tester': ['read', 'execute'],
223
+ default: ['read'],
224
+ };
225
+ const permissions = rolePermissions[role] ?? rolePermissions.default;
226
+ return SecurityContext.create({
227
+ principalId: agentId,
228
+ principalType: 'agent',
229
+ permissions,
230
+ allowedPaths: customPaths ?? ['./src', './tests', './docs'],
231
+ blockedPaths: ['/etc', '/var', '~/', '../'],
232
+ allowedCommands: ['npm', 'npx', 'node', 'git', 'vitest'],
233
+ blockedCommands: ['rm -rf /', 'dd', 'mkfs', 'format'],
234
+ });
235
+ }
236
+ }
237
+ //# sourceMappingURL=security-domain-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-domain-service.js","sourceRoot":"","sources":["../../../src/domain/services/security-domain-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAmB,MAAM,iCAAiC,CAAC;AAyBnF;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC,wCAAwC;IAChC,MAAM,CAAU,uBAAuB,GAAG;QAChD,MAAM;QACN,KAAK;QACL,UAAU;QACV,UAAU;QACV,eAAe;QACf,eAAe;QACf,8BAA8B;KAC/B,CAAC;IAEF,6BAA6B;IACrB,MAAM,CAAU,kBAAkB,GAAG;QAC3C,gBAAgB;QAChB,gBAAgB;QAChB,WAAW;QACX,SAAS;QACT,aAAa;QACb,mBAAmB;QACnB,oBAAoB;QACpB,YAAY;QACZ,UAAU;QACV,WAAW;QACX,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,CAAC,MAAM,EAAE,SAAS,CAAC;YAC7B,OAAO,EAAE,CAAC,MAAM,CAAC;SAClB,CAAC;QAEF,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC;QAErE,OAAO,eAAe,CAAC,MAAM,CAAC;YAC5B,WAAW,EAAE,OAAO;YACpB,aAAa,EAAE,OAAO;YACtB,WAAW;YACX,YAAY,EAAE,WAAW,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;YAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC;YAC3C,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;YACxD,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC;SACtD,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * V3 Security Module
3
+ *
4
+ * Comprehensive security module addressing all identified vulnerabilities:
5
+ * - CVE-2: Weak Password Hashing (password-hasher.ts)
6
+ * - CVE-3: Hardcoded Default Credentials (credential-generator.ts)
7
+ * - HIGH-1: Command Injection (safe-executor.ts)
8
+ * - HIGH-2: Path Traversal (path-validator.ts)
9
+ *
10
+ * Also provides:
11
+ * - Input validation with Zod schemas
12
+ * - Secure token generation
13
+ *
14
+ * @module v3/security
15
+ */
16
+ export { PasswordHasher, PasswordHashError, createPasswordHasher, type PasswordHasherConfig, type PasswordValidationResult, } from './password-hasher.js';
17
+ export { CredentialGenerator, CredentialGeneratorError, createCredentialGenerator, generateCredentials, type CredentialConfig, type GeneratedCredentials, type ApiKeyCredential, } from './credential-generator.js';
18
+ export { SafeExecutor, SafeExecutorError, createDevelopmentExecutor, createReadOnlyExecutor, type ExecutorConfig, type ExecutionResult, type StreamingExecutor, } from './safe-executor.js';
19
+ export { PathValidator, PathValidatorError, createProjectPathValidator, createFullProjectPathValidator, type PathValidatorConfig, type PathValidationResult, } from './path-validator.js';
20
+ export { InputValidator, sanitizeString, sanitizeHtml, sanitizePath, SafeStringSchema, IdentifierSchema, FilenameSchema, EmailSchema, PasswordSchema, UUIDSchema, HttpsUrlSchema, UrlSchema, SemverSchema, PortSchema, IPv4Schema, IPSchema, UserRoleSchema, PermissionSchema, LoginRequestSchema, CreateUserSchema, CreateApiKeySchema, AgentTypeSchema, SpawnAgentSchema, TaskInputSchema, CommandArgumentSchema, PathSchema, SecurityConfigSchema, ExecutorConfigSchema, PATTERNS, LIMITS, z, } from './input-validator.js';
21
+ export { TokenGenerator, TokenGeneratorError, createTokenGenerator, getDefaultGenerator, quickGenerate, type TokenConfig, type Token, type SignedToken, type VerificationCode, } from './token-generator.js';
22
+ import { PasswordHasher } from './password-hasher.js';
23
+ import { CredentialGenerator } from './credential-generator.js';
24
+ import { SafeExecutor } from './safe-executor.js';
25
+ import { PathValidator } from './path-validator.js';
26
+ import { TokenGenerator } from './token-generator.js';
27
+ /**
28
+ * Security module configuration
29
+ */
30
+ export interface SecurityModuleConfig {
31
+ /**
32
+ * Project root directory for path validation
33
+ */
34
+ projectRoot: string;
35
+ /**
36
+ * HMAC secret for token signing
37
+ */
38
+ hmacSecret: string;
39
+ /**
40
+ * Bcrypt rounds for password hashing
41
+ * Default: 12
42
+ */
43
+ bcryptRounds?: number;
44
+ /**
45
+ * Allowed commands for safe executor
46
+ * Default: ['git', 'npm', 'npx', 'node']
47
+ */
48
+ allowedCommands?: string[];
49
+ }
50
+ /**
51
+ * Complete security module instance
52
+ */
53
+ export interface SecurityModule {
54
+ passwordHasher: PasswordHasher;
55
+ credentialGenerator: CredentialGenerator;
56
+ safeExecutor: SafeExecutor;
57
+ pathValidator: PathValidator;
58
+ tokenGenerator: TokenGenerator;
59
+ }
60
+ /**
61
+ * Creates a complete security module with all components configured.
62
+ *
63
+ * @param config - Module configuration
64
+ * @returns Complete security module
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const security = createSecurityModule({
69
+ * projectRoot: '/workspaces/project',
70
+ * hmacSecret: process.env.HMAC_SECRET!,
71
+ * });
72
+ *
73
+ * // Hash password
74
+ * const hash = await security.passwordHasher.hash('password');
75
+ *
76
+ * // Validate path
77
+ * const result = await security.pathValidator.validate('/workspaces/project/src/file.ts');
78
+ *
79
+ * // Execute command safely
80
+ * const output = await security.safeExecutor.execute('git', ['status']);
81
+ * ```
82
+ */
83
+ export declare function createSecurityModule(config: SecurityModuleConfig): SecurityModule;
84
+ /**
85
+ * Minimum recommended bcrypt rounds for production
86
+ */
87
+ export declare const MIN_BCRYPT_ROUNDS = 12;
88
+ /**
89
+ * Maximum recommended bcrypt rounds (performance consideration)
90
+ */
91
+ export declare const MAX_BCRYPT_ROUNDS = 14;
92
+ /**
93
+ * Minimum password length
94
+ */
95
+ export declare const MIN_PASSWORD_LENGTH = 8;
96
+ /**
97
+ * Maximum password length (bcrypt limitation)
98
+ */
99
+ export declare const MAX_PASSWORD_LENGTH = 72;
100
+ /**
101
+ * Default token expiration in seconds (1 hour)
102
+ */
103
+ export declare const DEFAULT_TOKEN_EXPIRATION = 3600;
104
+ /**
105
+ * Default session expiration in seconds (24 hours)
106
+ */
107
+ export declare const DEFAULT_SESSION_EXPIRATION = 86400;
108
+ /**
109
+ * Checks security configuration for common issues.
110
+ *
111
+ * @param config - Configuration to audit
112
+ * @returns Array of security warnings
113
+ */
114
+ export declare function auditSecurityConfig(config: Partial<SecurityModuleConfig>): string[];
115
+ /**
116
+ * Security module version
117
+ */
118
+ export declare const SECURITY_MODULE_VERSION = "3.0.0-alpha.1";
119
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,wB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AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAiBjF;AAMD;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAMhD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,MAAM,EAAE,CAoBnF;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,145 @@
1
+ /**
2
+ * V3 Security Module
3
+ *
4
+ * Comprehensive security module addressing all identified vulnerabilities:
5
+ * - CVE-2: Weak Password Hashing (password-hasher.ts)
6
+ * - CVE-3: Hardcoded Default Credentials (credential-generator.ts)
7
+ * - HIGH-1: Command Injection (safe-executor.ts)
8
+ * - HIGH-2: Path Traversal (path-validator.ts)
9
+ *
10
+ * Also provides:
11
+ * - Input validation with Zod schemas
12
+ * - Secure token generation
13
+ *
14
+ * @module v3/security
15
+ */
16
+ // Password Hashing (CVE-2 Fix)
17
+ export { PasswordHasher, PasswordHashError, createPasswordHasher, } from './password-hasher.js';
18
+ // Credential Generation (CVE-3 Fix)
19
+ export { CredentialGenerator, CredentialGeneratorError, createCredentialGenerator, generateCredentials, } from './credential-generator.js';
20
+ // Safe Command Execution (HIGH-1 Fix)
21
+ export { SafeExecutor, SafeExecutorError, createDevelopmentExecutor, createReadOnlyExecutor, } from './safe-executor.js';
22
+ // Path Validation (HIGH-2 Fix)
23
+ export { PathValidator, PathValidatorError, createProjectPathValidator, createFullProjectPathValidator, } from './path-validator.js';
24
+ // Input Validation
25
+ export { InputValidator, sanitizeString, sanitizeHtml, sanitizePath,
26
+ // Base schemas
27
+ SafeStringSchema, IdentifierSchema, FilenameSchema, EmailSchema, PasswordSchema, UUIDSchema, HttpsUrlSchema, UrlSchema, SemverSchema, PortSchema, IPv4Schema, IPSchema,
28
+ // Auth schemas
29
+ UserRoleSchema, PermissionSchema, LoginRequestSchema, CreateUserSchema, CreateApiKeySchema,
30
+ // Agent & Task schemas
31
+ AgentTypeSchema, SpawnAgentSchema, TaskInputSchema,
32
+ // Command & Path schemas
33
+ CommandArgumentSchema, PathSchema,
34
+ // Config schemas
35
+ SecurityConfigSchema, ExecutorConfigSchema,
36
+ // Utilities
37
+ PATTERNS, LIMITS, z, } from './input-validator.js';
38
+ // Token Generation
39
+ export { TokenGenerator, TokenGeneratorError, createTokenGenerator, getDefaultGenerator, quickGenerate, } from './token-generator.js';
40
+ // ============================================================================
41
+ // Convenience Factory Functions
42
+ // ============================================================================
43
+ import { PasswordHasher } from './password-hasher.js';
44
+ import { CredentialGenerator } from './credential-generator.js';
45
+ import { SafeExecutor } from './safe-executor.js';
46
+ import { PathValidator } from './path-validator.js';
47
+ import { TokenGenerator } from './token-generator.js';
48
+ /**
49
+ * Creates a complete security module with all components configured.
50
+ *
51
+ * @param config - Module configuration
52
+ * @returns Complete security module
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const security = createSecurityModule({
57
+ * projectRoot: '/workspaces/project',
58
+ * hmacSecret: process.env.HMAC_SECRET!,
59
+ * });
60
+ *
61
+ * // Hash password
62
+ * const hash = await security.passwordHasher.hash('password');
63
+ *
64
+ * // Validate path
65
+ * const result = await security.pathValidator.validate('/workspaces/project/src/file.ts');
66
+ *
67
+ * // Execute command safely
68
+ * const output = await security.safeExecutor.execute('git', ['status']);
69
+ * ```
70
+ */
71
+ export function createSecurityModule(config) {
72
+ return {
73
+ passwordHasher: new PasswordHasher({
74
+ rounds: config.bcryptRounds ?? 12,
75
+ }),
76
+ credentialGenerator: new CredentialGenerator(),
77
+ safeExecutor: new SafeExecutor({
78
+ allowedCommands: config.allowedCommands ?? ['git', 'npm', 'npx', 'node'],
79
+ }),
80
+ pathValidator: new PathValidator({
81
+ allowedPrefixes: [config.projectRoot],
82
+ allowHidden: true,
83
+ }),
84
+ tokenGenerator: new TokenGenerator({
85
+ hmacSecret: config.hmacSecret,
86
+ }),
87
+ };
88
+ }
89
+ // ============================================================================
90
+ // Security Constants
91
+ // ============================================================================
92
+ /**
93
+ * Minimum recommended bcrypt rounds for production
94
+ */
95
+ export const MIN_BCRYPT_ROUNDS = 12;
96
+ /**
97
+ * Maximum recommended bcrypt rounds (performance consideration)
98
+ */
99
+ export const MAX_BCRYPT_ROUNDS = 14;
100
+ /**
101
+ * Minimum password length
102
+ */
103
+ export const MIN_PASSWORD_LENGTH = 8;
104
+ /**
105
+ * Maximum password length (bcrypt limitation)
106
+ */
107
+ export const MAX_PASSWORD_LENGTH = 72;
108
+ /**
109
+ * Default token expiration in seconds (1 hour)
110
+ */
111
+ export const DEFAULT_TOKEN_EXPIRATION = 3600;
112
+ /**
113
+ * Default session expiration in seconds (24 hours)
114
+ */
115
+ export const DEFAULT_SESSION_EXPIRATION = 86400;
116
+ // ============================================================================
117
+ // Security Audit Helper
118
+ // ============================================================================
119
+ /**
120
+ * Checks security configuration for common issues.
121
+ *
122
+ * @param config - Configuration to audit
123
+ * @returns Array of security warnings
124
+ */
125
+ export function auditSecurityConfig(config) {
126
+ const warnings = [];
127
+ if (config.bcryptRounds && config.bcryptRounds < MIN_BCRYPT_ROUNDS) {
128
+ warnings.push(`bcryptRounds (${config.bcryptRounds}) below recommended minimum (${MIN_BCRYPT_ROUNDS})`);
129
+ }
130
+ if (config.hmacSecret && config.hmacSecret.length < 32) {
131
+ warnings.push('hmacSecret should be at least 32 characters');
132
+ }
133
+ if (!config.projectRoot) {
134
+ warnings.push('projectRoot not configured - path validation may be disabled');
135
+ }
136
+ if (config.allowedCommands && config.allowedCommands.length === 0) {
137
+ warnings.push('No commands allowed - executor will reject all commands');
138
+ }
139
+ return warnings;
140
+ }
141
+ /**
142
+ * Security module version
143
+ */
144
+ export const SECURITY_MODULE_VERSION = '3.0.0-alpha.1';
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+BAA+B;AAC/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GAGrB,MAAM,sBAAsB,CAAC;AAE9B,oCAAoC;AACpC,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,GAIpB,MAAM,2BAA2B,CAAC;AAEnC,sCAAsC;AACtC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAE5B,+BAA+B;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,0BAA0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