agentic-qe 3.8.4 → 3.8.6
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/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/cli/bundle.js +694 -694
- package/dist/cli/commands/hooks-handlers/command-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/command-hooks.js +253 -0
- package/dist/cli/commands/hooks-handlers/editing-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/editing-hooks.js +161 -0
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.d.ts +57 -0
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +263 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +52 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +223 -0
- package/dist/cli/commands/hooks-handlers/routing-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +107 -0
- package/dist/cli/commands/hooks-handlers/session-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/session-hooks.js +171 -0
- package/dist/cli/commands/hooks-handlers/stats-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/stats-hooks.js +248 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.js +152 -0
- package/dist/cli/commands/hooks.d.ts +3 -23
- package/dist/cli/commands/hooks.js +16 -1459
- package/dist/coordination/mincut/phase-executor.d.ts +27 -0
- package/dist/coordination/mincut/phase-executor.js +70 -0
- package/dist/coordination/mincut/time-crystal-analysis.d.ts +35 -0
- package/dist/coordination/mincut/time-crystal-analysis.js +237 -0
- package/dist/coordination/mincut/time-crystal-persistence.d.ts +35 -0
- package/dist/coordination/mincut/time-crystal-persistence.js +81 -0
- package/dist/coordination/mincut/time-crystal-scheduling.d.ts +34 -0
- package/dist/coordination/mincut/time-crystal-scheduling.js +213 -0
- package/dist/coordination/mincut/time-crystal-types.d.ts +278 -0
- package/dist/coordination/mincut/time-crystal-types.js +67 -0
- package/dist/coordination/mincut/time-crystal.d.ts +8 -438
- package/dist/coordination/mincut/time-crystal.js +87 -905
- package/dist/domains/base-domain-coordinator.d.ts +0 -15
- package/dist/domains/base-domain-coordinator.js +7 -5
- package/dist/domains/chaos-resilience/coordinator.d.ts +0 -4
- package/dist/domains/chaos-resilience/coordinator.js +24 -22
- package/dist/domains/chaos-resilience/services/chaos-engineer.d.ts +0 -4
- package/dist/domains/chaos-resilience/services/chaos-engineer.js +47 -45
- package/dist/domains/chaos-resilience/services/performance-profiler.d.ts +0 -4
- package/dist/domains/chaos-resilience/services/performance-profiler.js +10 -8
- package/dist/domains/code-intelligence/coordinator-consensus.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator-consensus.js +8 -6
- package/dist/domains/code-intelligence/coordinator-gnn.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator-gnn.js +8 -6
- package/dist/domains/code-intelligence/coordinator-hypergraph.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator-hypergraph.js +13 -11
- package/dist/domains/code-intelligence/coordinator.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator.js +21 -19
- package/dist/domains/code-intelligence/services/c4-model/index.d.ts +0 -3
- package/dist/domains/code-intelligence/services/c4-model/index.js +5 -3
- package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +0 -6
- package/dist/domains/code-intelligence/services/knowledge-graph.js +4 -2
- package/dist/domains/code-intelligence/services/product-factors-bridge.d.ts +0 -5
- package/dist/domains/code-intelligence/services/product-factors-bridge.js +9 -7
- package/dist/domains/contract-testing/coordinator.d.ts +0 -6
- package/dist/domains/contract-testing/coordinator.js +25 -23
- package/dist/domains/contract-testing/services/contract-validator.d.ts +0 -4
- package/dist/domains/contract-testing/services/contract-validator.js +4 -2
- package/dist/domains/contract-testing/services/schema-validator.js +1 -1
- package/dist/domains/coverage-analysis/coordinator.js +13 -11
- package/dist/domains/coverage-analysis/services/coverage-analyzer.js +4 -2
- package/dist/domains/coverage-analysis/services/gap-detector.js +3 -1
- package/dist/domains/coverage-analysis/services/hnsw-index.d.ts +0 -15
- package/dist/domains/coverage-analysis/services/hnsw-index.js +3 -1
- package/dist/domains/coverage-analysis/services/sublinear-analyzer.d.ts +0 -26
- package/dist/domains/coverage-analysis/services/sublinear-analyzer.js +3 -1
- package/dist/domains/defect-intelligence/coordinator.d.ts +1 -10
- package/dist/domains/defect-intelligence/coordinator.js +5 -3
- package/dist/domains/defect-intelligence/services/causal-root-cause-analyzer.d.ts +0 -6
- package/dist/domains/defect-intelligence/services/causal-root-cause-analyzer.js +3 -1
- package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +0 -6
- package/dist/domains/defect-intelligence/services/defect-predictor.js +5 -3
- package/dist/domains/defect-intelligence/services/pattern-learner.d.ts +0 -4
- package/dist/domains/defect-intelligence/services/pattern-learner.js +3 -1
- package/dist/domains/defect-intelligence/services/root-cause-analyzer.d.ts +0 -6
- package/dist/domains/defect-intelligence/services/root-cause-analyzer.js +3 -1
- package/dist/domains/enterprise-integration/coordinator.js +6 -4
- package/dist/domains/learning-optimization/coordinator-consensus.d.ts +0 -3
- package/dist/domains/learning-optimization/coordinator-consensus.js +8 -6
- package/dist/domains/learning-optimization/coordinator.d.ts +0 -3
- package/dist/domains/learning-optimization/coordinator.js +15 -13
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +0 -4
- package/dist/domains/learning-optimization/services/learning-coordinator.js +4 -2
- package/dist/domains/quality-assessment/coordinator-claim-verifier.d.ts +0 -3
- package/dist/domains/quality-assessment/coordinator-claim-verifier.js +6 -4
- package/dist/domains/quality-assessment/coordinator-gate-evaluation.d.ts +0 -4
- package/dist/domains/quality-assessment/coordinator-gate-evaluation.js +9 -7
- package/dist/domains/quality-assessment/coordinator-rl-integration.d.ts +0 -3
- package/dist/domains/quality-assessment/coordinator-rl-integration.js +10 -8
- package/dist/domains/quality-assessment/coordinator.d.ts +0 -15
- package/dist/domains/quality-assessment/coordinator.js +14 -12
- package/dist/domains/quality-assessment/services/deployment-advisor.d.ts +0 -10
- package/dist/domains/quality-assessment/services/deployment-advisor.js +4 -2
- package/dist/domains/quality-assessment/services/quality-analyzer.d.ts +0 -6
- package/dist/domains/quality-assessment/services/quality-analyzer.js +4 -2
- package/dist/domains/requirements-validation/coordinator.d.ts +0 -3
- package/dist/domains/requirements-validation/coordinator.js +15 -13
- package/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.d.ts +0 -5
- package/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js +15 -13
- package/dist/domains/requirements-validation/services/product-factors-assessment/product-factors-service.d.ts +0 -6
- package/dist/domains/requirements-validation/services/product-factors-assessment/product-factors-service.js +9 -7
- package/dist/domains/requirements-validation/services/requirements-validator.d.ts +0 -6
- package/dist/domains/requirements-validation/services/requirements-validator.js +4 -2
- package/dist/domains/security-compliance/coordinator.js +24 -22
- package/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +0 -21
- package/dist/domains/security-compliance/services/scanners/dast-scanner.js +4 -2
- package/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts +0 -4
- package/dist/domains/security-compliance/services/scanners/sast-scanner.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor-dast.d.ts +0 -4
- package/dist/domains/security-compliance/services/security-auditor-dast.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor-sast.d.ts +0 -3
- package/dist/domains/security-compliance/services/security-auditor-sast.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor-secrets.d.ts +0 -3
- package/dist/domains/security-compliance/services/security-auditor-secrets.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor.js +11 -9
- package/dist/domains/test-execution/coordinator.js +11 -9
- package/dist/domains/test-execution/services/auth-state-manager.d.ts +0 -3
- package/dist/domains/test-execution/services/auth-state-manager.js +4 -2
- package/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts +0 -14
- package/dist/domains/test-execution/services/e2e/e2e-coordinator.js +3 -1
- package/dist/domains/test-execution/services/flaky-detector.js +4 -2
- package/dist/domains/test-execution/services/retry-handler.js +3 -1
- package/dist/domains/test-execution/services/test-executor.js +3 -1
- package/dist/domains/test-generation/coordinator.d.ts +0 -17
- package/dist/domains/test-generation/coordinator.js +33 -31
- package/dist/domains/test-generation/pattern-injection/edge-case-injector.d.ts +0 -5
- package/dist/domains/test-generation/pattern-injection/edge-case-injector.js +3 -1
- package/dist/domains/test-generation/services/code-transform-integration.d.ts +0 -7
- package/dist/domains/test-generation/services/code-transform-integration.js +3 -1
- package/dist/domains/test-generation/services/coherence-gate-service.d.ts +0 -3
- package/dist/domains/test-generation/services/coherence-gate-service.js +3 -1
- package/dist/domains/test-generation/services/test-generator.d.ts +0 -8
- package/dist/domains/test-generation/services/test-generator.js +5 -3
- package/dist/domains/visual-accessibility/coordinator.d.ts +0 -3
- package/dist/domains/visual-accessibility/coordinator.js +14 -12
- package/dist/domains/visual-accessibility/services/accessibility-tester-browser.d.ts +0 -3
- package/dist/domains/visual-accessibility/services/accessibility-tester-browser.js +52 -50
- package/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +0 -4
- package/dist/domains/visual-accessibility/services/accessibility-tester.js +8 -6
- package/dist/domains/visual-accessibility/services/axe-core-integration.d.ts +0 -3
- package/dist/domains/visual-accessibility/services/axe-core-integration.js +20 -18
- package/dist/domains/visual-accessibility/services/browser-security-scanner.d.ts +0 -4
- package/dist/domains/visual-accessibility/services/browser-security-scanner.js +6 -4
- package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.d.ts +0 -30
- package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.js +5 -3
- package/dist/domains/visual-accessibility/services/viewport-capture.d.ts +0 -27
- package/dist/domains/visual-accessibility/services/viewport-capture.js +6 -4
- package/dist/domains/visual-accessibility/services/visual-regression.d.ts +0 -26
- package/dist/domains/visual-accessibility/services/visual-regression.js +4 -2
- package/dist/domains/visual-accessibility/services/visual-tester.d.ts +0 -4
- package/dist/domains/visual-accessibility/services/visual-tester.js +4 -2
- package/dist/governance/deterministic-gateway-integration.js +1 -1
- package/dist/learning/agent-routing.d.ts +53 -0
- package/dist/learning/agent-routing.js +142 -0
- package/dist/learning/embedding-utils.d.ts +34 -0
- package/dist/learning/embedding-utils.js +95 -0
- package/dist/learning/pattern-promotion.d.ts +63 -0
- package/dist/learning/pattern-promotion.js +187 -0
- package/dist/learning/pretrained-patterns.d.ts +14 -0
- package/dist/learning/pretrained-patterns.js +726 -0
- package/dist/learning/qe-reasoning-bank-types.d.ts +174 -0
- package/dist/learning/qe-reasoning-bank-types.js +24 -0
- package/dist/learning/qe-reasoning-bank.d.ts +9 -192
- package/dist/learning/qe-reasoning-bank.js +48 -1093
- package/dist/mcp/bundle.js +335 -335
- package/dist/mcp/security/validators/command-validator.d.ts +1 -40
- package/dist/mcp/security/validators/command-validator.js +2 -122
- package/dist/mcp/security/validators/crypto-validator.d.ts +1 -39
- package/dist/mcp/security/validators/crypto-validator.js +2 -71
- package/dist/mcp/security/validators/input-sanitizer.d.ts +1 -55
- package/dist/mcp/security/validators/input-sanitizer.js +2 -156
- package/dist/mcp/security/validators/interfaces.d.ts +1 -163
- package/dist/mcp/security/validators/interfaces.js +2 -5
- package/dist/mcp/security/validators/path-traversal-validator.d.ts +1 -49
- package/dist/mcp/security/validators/path-traversal-validator.js +2 -241
- package/dist/mcp/security/validators/regex-safety-validator.d.ts +1 -49
- package/dist/mcp/security/validators/regex-safety-validator.js +2 -182
- package/dist/mcp/security/validators/validation-orchestrator.d.ts +1 -65
- package/dist/mcp/security/validators/validation-orchestrator.js +2 -145
- package/dist/shared/io/file-reader.js +1 -1
- package/dist/shared/security/command-validator.d.ts +44 -0
- package/dist/shared/security/command-validator.js +126 -0
- package/dist/shared/security/crypto-validator.d.ts +43 -0
- package/dist/shared/security/crypto-validator.js +75 -0
- package/dist/shared/security/index.d.ts +7 -0
- package/dist/shared/security/index.js +15 -0
- package/dist/shared/security/input-sanitizer.d.ts +59 -0
- package/dist/shared/security/input-sanitizer.js +160 -0
- package/dist/shared/security/path-traversal-validator.d.ts +53 -0
- package/dist/shared/security/path-traversal-validator.js +245 -0
- package/dist/shared/security/regex-safety-validator.d.ts +53 -0
- package/dist/shared/security/regex-safety-validator.js +186 -0
- package/dist/shared/security/validation-orchestrator.d.ts +69 -0
- package/dist/shared/security/validation-orchestrator.js +149 -0
- package/dist/shared/security/validators-interfaces.d.ts +167 -0
- package/dist/shared/security/validators-interfaces.js +9 -0
- package/package.json +1 -1
|
@@ -1,41 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Agentic QE v3 - MCP Security: Command Validator
|
|
3
|
-
* Implements the Strategy Pattern for command injection prevention
|
|
4
|
-
*/
|
|
5
|
-
import { ICommandValidationStrategy, CommandValidationOptions, CommandValidationResult, RiskLevel } from './interfaces';
|
|
6
|
-
/**
|
|
7
|
-
* Allowed commands whitelist (default safe commands)
|
|
8
|
-
*/
|
|
9
|
-
export declare const DEFAULT_ALLOWED_COMMANDS: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Blocked command patterns (injection vectors)
|
|
12
|
-
*/
|
|
13
|
-
export declare const BLOCKED_COMMAND_PATTERNS: RegExp[];
|
|
14
|
-
/**
|
|
15
|
-
* Command Validator Strategy
|
|
16
|
-
* Validates and sanitizes shell commands to prevent injection attacks
|
|
17
|
-
*/
|
|
18
|
-
export declare class CommandValidator implements ICommandValidationStrategy {
|
|
19
|
-
readonly name = "command-injection";
|
|
20
|
-
private defaultAllowedCommands;
|
|
21
|
-
constructor(defaultAllowedCommands?: string[]);
|
|
22
|
-
/**
|
|
23
|
-
* Get the primary risk level this validator addresses
|
|
24
|
-
*/
|
|
25
|
-
getRiskLevel(): RiskLevel;
|
|
26
|
-
/**
|
|
27
|
-
* Validate a command (IValidationStrategy interface)
|
|
28
|
-
*/
|
|
29
|
-
validate(command: string, options?: CommandValidationOptions): CommandValidationResult;
|
|
30
|
-
/**
|
|
31
|
-
* Validate and sanitize a command
|
|
32
|
-
*/
|
|
33
|
-
validateCommand(command: string, allowedCommands?: string[]): CommandValidationResult;
|
|
34
|
-
/**
|
|
35
|
-
* Escape a string for safe shell usage
|
|
36
|
-
*/
|
|
37
|
-
escapeShellArg(arg: string): string;
|
|
38
|
-
}
|
|
39
|
-
export declare const validateCommand: (command: string, allowedCommands?: string[]) => CommandValidationResult;
|
|
40
|
-
export declare const escapeShellArg: (arg: string) => string;
|
|
1
|
+
export * from '../../../shared/security/command-validator.js';
|
|
41
2
|
//# sourceMappingURL=command-validator.d.ts.map
|
|
@@ -1,123 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Implements the Strategy Pattern for command injection prevention
|
|
4
|
-
*/
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Constants
|
|
7
|
-
// ============================================================================
|
|
8
|
-
/**
|
|
9
|
-
* Allowed commands whitelist (default safe commands)
|
|
10
|
-
*/
|
|
11
|
-
export const DEFAULT_ALLOWED_COMMANDS = [
|
|
12
|
-
'ls', 'cat', 'echo', 'grep', 'find', 'head', 'tail', 'wc',
|
|
13
|
-
'npm', 'node', 'yarn', 'pnpm',
|
|
14
|
-
'git', 'jest', 'vitest', 'playwright',
|
|
15
|
-
];
|
|
16
|
-
/**
|
|
17
|
-
* Blocked command patterns (injection vectors)
|
|
18
|
-
*/
|
|
19
|
-
export const BLOCKED_COMMAND_PATTERNS = [
|
|
20
|
-
/;/, // Command chaining with semicolon
|
|
21
|
-
/&&/, // Command chaining with AND
|
|
22
|
-
/\|\|/, // Command chaining with OR
|
|
23
|
-
/\|/, // Piping
|
|
24
|
-
/`.*`/, // Backtick command substitution
|
|
25
|
-
/\$\(.*\)/, // $() command substitution
|
|
26
|
-
/>\s*\/dev\/sd/i, // Writing to block devices
|
|
27
|
-
/>\s*\/etc\//i, // Writing to /etc
|
|
28
|
-
];
|
|
29
|
-
/**
|
|
30
|
-
* Shell metacharacters (excludes parentheses which are common in normal text)
|
|
31
|
-
*/
|
|
32
|
-
const SHELL_METACHARACTERS = /[|;&$`<>{}[\]!#*?~]/g;
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// Command Validator Implementation
|
|
35
|
-
// ============================================================================
|
|
36
|
-
/**
|
|
37
|
-
* Command Validator Strategy
|
|
38
|
-
* Validates and sanitizes shell commands to prevent injection attacks
|
|
39
|
-
*/
|
|
40
|
-
export class CommandValidator {
|
|
41
|
-
name = 'command-injection';
|
|
42
|
-
defaultAllowedCommands;
|
|
43
|
-
constructor(defaultAllowedCommands = DEFAULT_ALLOWED_COMMANDS) {
|
|
44
|
-
this.defaultAllowedCommands = defaultAllowedCommands;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get the primary risk level this validator addresses
|
|
48
|
-
*/
|
|
49
|
-
getRiskLevel() {
|
|
50
|
-
return 'critical';
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Validate a command (IValidationStrategy interface)
|
|
54
|
-
*/
|
|
55
|
-
validate(command, options = {}) {
|
|
56
|
-
const allowedCommands = options.allowedCommands ?? this.defaultAllowedCommands;
|
|
57
|
-
return this.validateCommand(command, allowedCommands);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Validate and sanitize a command
|
|
61
|
-
*/
|
|
62
|
-
validateCommand(command, allowedCommands = this.defaultAllowedCommands) {
|
|
63
|
-
const blockedPatterns = [];
|
|
64
|
-
// Check for blocked patterns
|
|
65
|
-
for (const pattern of BLOCKED_COMMAND_PATTERNS) {
|
|
66
|
-
if (pattern.test(command)) {
|
|
67
|
-
blockedPatterns.push(pattern.source);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (blockedPatterns.length > 0) {
|
|
71
|
-
return {
|
|
72
|
-
valid: false,
|
|
73
|
-
error: 'Command contains blocked patterns',
|
|
74
|
-
blockedPatterns,
|
|
75
|
-
riskLevel: 'critical',
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
// Extract base command
|
|
79
|
-
const parts = command.trim().split(/\s+/);
|
|
80
|
-
const baseCommand = parts[0].split('/').pop() || '';
|
|
81
|
-
// Check against whitelist
|
|
82
|
-
if (!allowedCommands.includes(baseCommand)) {
|
|
83
|
-
return {
|
|
84
|
-
valid: false,
|
|
85
|
-
error: `Command '${baseCommand}' is not in the allowed list`,
|
|
86
|
-
blockedPatterns: [],
|
|
87
|
-
riskLevel: 'high',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// Sanitize arguments
|
|
91
|
-
const sanitizedParts = parts.map((part, i) => {
|
|
92
|
-
if (i === 0)
|
|
93
|
-
return part;
|
|
94
|
-
// Remove shell metacharacters from arguments
|
|
95
|
-
return part.replace(SHELL_METACHARACTERS, '');
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
valid: true,
|
|
99
|
-
sanitizedCommand: sanitizedParts.join(' '),
|
|
100
|
-
blockedPatterns: [],
|
|
101
|
-
riskLevel: 'none',
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Escape a string for safe shell usage
|
|
106
|
-
*/
|
|
107
|
-
escapeShellArg(arg) {
|
|
108
|
-
// Wrap in single quotes and escape any internal single quotes
|
|
109
|
-
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// ============================================================================
|
|
113
|
-
// Standalone Functions (for backward compatibility)
|
|
114
|
-
// ============================================================================
|
|
115
|
-
const defaultValidator = new CommandValidator();
|
|
116
|
-
export const validateCommand = (command, allowedCommands) => {
|
|
117
|
-
if (allowedCommands) {
|
|
118
|
-
return defaultValidator.validateCommand(command, allowedCommands);
|
|
119
|
-
}
|
|
120
|
-
return defaultValidator.validate(command);
|
|
121
|
-
};
|
|
122
|
-
export const escapeShellArg = (arg) => defaultValidator.escapeShellArg(arg);
|
|
1
|
+
// Re-export from shared/security for backward compatibility
|
|
2
|
+
export * from '../../../shared/security/command-validator.js';
|
|
123
3
|
//# sourceMappingURL=command-validator.js.map
|
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Agentic QE v3 - MCP Security: Crypto Validator
|
|
3
|
-
* Implements the Strategy Pattern for cryptographic security operations
|
|
4
|
-
*/
|
|
5
|
-
import { ICryptoValidationStrategy, RiskLevel } from './interfaces';
|
|
6
|
-
/**
|
|
7
|
-
* Crypto Validator Strategy
|
|
8
|
-
* Provides timing-safe comparisons and secure cryptographic operations
|
|
9
|
-
*/
|
|
10
|
-
export declare class CryptoValidator implements ICryptoValidationStrategy {
|
|
11
|
-
readonly name = "crypto-security";
|
|
12
|
-
/**
|
|
13
|
-
* Get the primary risk level this validator addresses
|
|
14
|
-
*/
|
|
15
|
-
getRiskLevel(): RiskLevel;
|
|
16
|
-
/**
|
|
17
|
-
* Perform a timing-safe string comparison
|
|
18
|
-
* Prevents timing attacks by ensuring constant-time comparison
|
|
19
|
-
*/
|
|
20
|
-
timingSafeCompare(a: string, b: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Timing-safe comparison for hashed values
|
|
23
|
-
* Hashes the input value and compares against expected hash
|
|
24
|
-
*/
|
|
25
|
-
timingSafeHashCompare(value: string, expectedHash: string): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Generate a secure random token
|
|
28
|
-
* Uses cryptographically secure random bytes
|
|
29
|
-
*/
|
|
30
|
-
generateSecureToken(length?: number): string;
|
|
31
|
-
/**
|
|
32
|
-
* Hash a value securely using SHA-256
|
|
33
|
-
*/
|
|
34
|
-
secureHash(value: string, salt?: string): string;
|
|
35
|
-
}
|
|
36
|
-
export declare const timingSafeCompare: (a: string, b: string) => boolean;
|
|
37
|
-
export declare const timingSafeHashCompare: (value: string, expectedHash: string) => boolean;
|
|
38
|
-
export declare const generateSecureToken: (length?: number) => string;
|
|
39
|
-
export declare const secureHash: (value: string, salt?: string) => string;
|
|
1
|
+
export * from '../../../shared/security/crypto-validator.js';
|
|
40
2
|
//# sourceMappingURL=crypto-validator.d.ts.map
|
|
@@ -1,72 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Implements the Strategy Pattern for cryptographic security operations
|
|
4
|
-
*/
|
|
5
|
-
import { createHash, timingSafeEqual, randomBytes } from 'crypto';
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Crypto Validator Implementation
|
|
8
|
-
// ============================================================================
|
|
9
|
-
/**
|
|
10
|
-
* Crypto Validator Strategy
|
|
11
|
-
* Provides timing-safe comparisons and secure cryptographic operations
|
|
12
|
-
*/
|
|
13
|
-
export class CryptoValidator {
|
|
14
|
-
name = 'crypto-security';
|
|
15
|
-
/**
|
|
16
|
-
* Get the primary risk level this validator addresses
|
|
17
|
-
*/
|
|
18
|
-
getRiskLevel() {
|
|
19
|
-
return 'critical';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Perform a timing-safe string comparison
|
|
23
|
-
* Prevents timing attacks by ensuring constant-time comparison
|
|
24
|
-
*/
|
|
25
|
-
timingSafeCompare(a, b) {
|
|
26
|
-
// Pad shorter string to prevent length-based timing attacks
|
|
27
|
-
const maxLen = Math.max(a.length, b.length);
|
|
28
|
-
const paddedA = a.padEnd(maxLen, '\0');
|
|
29
|
-
const paddedB = b.padEnd(maxLen, '\0');
|
|
30
|
-
try {
|
|
31
|
-
return timingSafeEqual(Buffer.from(paddedA), Buffer.from(paddedB));
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Timing-safe comparison for hashed values
|
|
39
|
-
* Hashes the input value and compares against expected hash
|
|
40
|
-
*/
|
|
41
|
-
timingSafeHashCompare(value, expectedHash) {
|
|
42
|
-
const hash = createHash('sha256').update(value).digest('hex');
|
|
43
|
-
return this.timingSafeCompare(hash, expectedHash);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Generate a secure random token
|
|
47
|
-
* Uses cryptographically secure random bytes
|
|
48
|
-
*/
|
|
49
|
-
generateSecureToken(length = 32) {
|
|
50
|
-
return randomBytes(length)
|
|
51
|
-
.toString('base64')
|
|
52
|
-
.replace(/\+/g, '-')
|
|
53
|
-
.replace(/\//g, '_')
|
|
54
|
-
.replace(/=/g, '');
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Hash a value securely using SHA-256
|
|
58
|
-
*/
|
|
59
|
-
secureHash(value, salt) {
|
|
60
|
-
const data = salt ? `${salt}:${value}` : value;
|
|
61
|
-
return createHash('sha256').update(data).digest('hex');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// ============================================================================
|
|
65
|
-
// Standalone Functions (for backward compatibility)
|
|
66
|
-
// ============================================================================
|
|
67
|
-
const defaultValidator = new CryptoValidator();
|
|
68
|
-
export const timingSafeCompare = (a, b) => defaultValidator.timingSafeCompare(a, b);
|
|
69
|
-
export const timingSafeHashCompare = (value, expectedHash) => defaultValidator.timingSafeHashCompare(value, expectedHash);
|
|
70
|
-
export const generateSecureToken = (length) => defaultValidator.generateSecureToken(length);
|
|
71
|
-
export const secureHash = (value, salt) => defaultValidator.secureHash(value, salt);
|
|
1
|
+
// Re-export from shared/security for backward compatibility
|
|
2
|
+
export * from '../../../shared/security/crypto-validator.js';
|
|
72
3
|
//# sourceMappingURL=crypto-validator.js.map
|
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Agentic QE v3 - MCP Security: Input Sanitizer
|
|
3
|
-
* Implements the Strategy Pattern for input sanitization
|
|
4
|
-
*/
|
|
5
|
-
import { IInputSanitizationStrategy, SanitizationOptions, RiskLevel } from './interfaces';
|
|
6
|
-
/**
|
|
7
|
-
* HTML escape characters mapping
|
|
8
|
-
*/
|
|
9
|
-
export declare const HTML_ESCAPE_MAP: Record<string, string>;
|
|
10
|
-
/**
|
|
11
|
-
* SQL injection patterns to detect and remove
|
|
12
|
-
*/
|
|
13
|
-
export declare const SQL_INJECTION_PATTERNS: RegExp[];
|
|
14
|
-
/**
|
|
15
|
-
* Shell metacharacters (excludes parentheses which are common in normal text)
|
|
16
|
-
*/
|
|
17
|
-
export declare const SHELL_METACHARACTERS: RegExp;
|
|
18
|
-
/**
|
|
19
|
-
* Dangerous control characters that should be stripped:
|
|
20
|
-
* - Null byte (\x00): String termination attacks, filter bypass
|
|
21
|
-
* - Backspace (\x08): Log manipulation
|
|
22
|
-
* - Bell (\x07): Terminal escape attacks
|
|
23
|
-
* - Vertical tab (\x0B): Filter bypass
|
|
24
|
-
* - Form feed (\x0C): Filter bypass
|
|
25
|
-
* - Escape (\x1B): Terminal escape sequences (ANSI attacks)
|
|
26
|
-
* - Delete (\x7F): Buffer manipulation
|
|
27
|
-
*/
|
|
28
|
-
export declare const DANGEROUS_CONTROL_CHARS: RegExp;
|
|
29
|
-
/**
|
|
30
|
-
* Input Sanitizer Strategy
|
|
31
|
-
* Sanitizes user input to prevent XSS, SQL injection, and command injection
|
|
32
|
-
*/
|
|
33
|
-
export declare class InputSanitizer implements IInputSanitizationStrategy {
|
|
34
|
-
readonly name = "input-sanitization";
|
|
35
|
-
/**
|
|
36
|
-
* Get the primary risk level this sanitizer addresses
|
|
37
|
-
*/
|
|
38
|
-
getRiskLevel(): RiskLevel;
|
|
39
|
-
/**
|
|
40
|
-
* Sanitize input string with configurable options
|
|
41
|
-
*/
|
|
42
|
-
sanitize(input: string, options?: SanitizationOptions): string;
|
|
43
|
-
/**
|
|
44
|
-
* Escape HTML special characters
|
|
45
|
-
*/
|
|
46
|
-
escapeHtml(str: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* Strip HTML tags from a string
|
|
49
|
-
* Handles both complete tags and incomplete/malformed tags to prevent XSS
|
|
50
|
-
*/
|
|
51
|
-
stripHtmlTags(str: string): string;
|
|
52
|
-
}
|
|
53
|
-
export declare const sanitizeInput: (input: string, options?: SanitizationOptions) => string;
|
|
54
|
-
export declare const escapeHtml: (str: string) => string;
|
|
55
|
-
export declare const stripHtmlTags: (str: string) => string;
|
|
1
|
+
export * from '../../../shared/security/input-sanitizer.js';
|
|
56
2
|
//# sourceMappingURL=input-sanitizer.d.ts.map
|
|
@@ -1,157 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Implements the Strategy Pattern for input sanitization
|
|
4
|
-
*/
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Constants
|
|
7
|
-
// ============================================================================
|
|
8
|
-
/**
|
|
9
|
-
* HTML escape characters mapping
|
|
10
|
-
*/
|
|
11
|
-
export const HTML_ESCAPE_MAP = {
|
|
12
|
-
'&': '&',
|
|
13
|
-
'<': '<',
|
|
14
|
-
'>': '>',
|
|
15
|
-
'"': '"',
|
|
16
|
-
"'": ''',
|
|
17
|
-
'/': '/',
|
|
18
|
-
'`': '`',
|
|
19
|
-
'=': '=',
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* SQL injection patterns to detect and remove
|
|
23
|
-
*/
|
|
24
|
-
export const SQL_INJECTION_PATTERNS = [
|
|
25
|
-
/('|")\s*;\s*--/i,
|
|
26
|
-
/'\s*OR\s+'1'\s*=\s*'1/i,
|
|
27
|
-
/"\s*OR\s+"1"\s*=\s*"1/i,
|
|
28
|
-
/UNION\s+SELECT/i,
|
|
29
|
-
/INSERT\s+INTO/i,
|
|
30
|
-
/DROP\s+TABLE/i,
|
|
31
|
-
/DELETE\s+FROM/i,
|
|
32
|
-
/UPDATE\s+.*\s+SET/i,
|
|
33
|
-
/EXEC(\s+|\()sp_/i,
|
|
34
|
-
/xp_cmdshell/i,
|
|
35
|
-
];
|
|
36
|
-
/**
|
|
37
|
-
* Shell metacharacters (excludes parentheses which are common in normal text)
|
|
38
|
-
*/
|
|
39
|
-
export const SHELL_METACHARACTERS = /[|;&$`<>{}[\]!#*?~]/g;
|
|
40
|
-
/**
|
|
41
|
-
* Dangerous control characters that should be stripped:
|
|
42
|
-
* - Null byte (\x00): String termination attacks, filter bypass
|
|
43
|
-
* - Backspace (\x08): Log manipulation
|
|
44
|
-
* - Bell (\x07): Terminal escape attacks
|
|
45
|
-
* - Vertical tab (\x0B): Filter bypass
|
|
46
|
-
* - Form feed (\x0C): Filter bypass
|
|
47
|
-
* - Escape (\x1B): Terminal escape sequences (ANSI attacks)
|
|
48
|
-
* - Delete (\x7F): Buffer manipulation
|
|
49
|
-
*/
|
|
50
|
-
export const DANGEROUS_CONTROL_CHARS = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g;
|
|
51
|
-
// ============================================================================
|
|
52
|
-
// Input Sanitizer Implementation
|
|
53
|
-
// ============================================================================
|
|
54
|
-
/**
|
|
55
|
-
* Input Sanitizer Strategy
|
|
56
|
-
* Sanitizes user input to prevent XSS, SQL injection, and command injection
|
|
57
|
-
*/
|
|
58
|
-
export class InputSanitizer {
|
|
59
|
-
name = 'input-sanitization';
|
|
60
|
-
/**
|
|
61
|
-
* Get the primary risk level this sanitizer addresses
|
|
62
|
-
*/
|
|
63
|
-
getRiskLevel() {
|
|
64
|
-
return 'high';
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Sanitize input string with configurable options
|
|
68
|
-
*/
|
|
69
|
-
sanitize(input, options = {}) {
|
|
70
|
-
const { maxLength = 10000, allowedChars, stripHtml = true, stripSql = true, escapeShell = true, trim = true, stripControlChars = true, } = options;
|
|
71
|
-
let result = input;
|
|
72
|
-
// Strip dangerous control characters first (null bytes, escape sequences, etc.)
|
|
73
|
-
// This must happen early to prevent bypass of later sanitization steps
|
|
74
|
-
if (stripControlChars) {
|
|
75
|
-
result = result.replace(DANGEROUS_CONTROL_CHARS, '');
|
|
76
|
-
}
|
|
77
|
-
// Trim
|
|
78
|
-
if (trim) {
|
|
79
|
-
result = result.trim();
|
|
80
|
-
}
|
|
81
|
-
// Max length
|
|
82
|
-
if (result.length > maxLength) {
|
|
83
|
-
result = result.substring(0, maxLength);
|
|
84
|
-
}
|
|
85
|
-
// Strip HTML
|
|
86
|
-
if (stripHtml) {
|
|
87
|
-
result = this.stripHtmlTags(result);
|
|
88
|
-
}
|
|
89
|
-
// Strip SQL injection attempts
|
|
90
|
-
if (stripSql) {
|
|
91
|
-
for (const pattern of SQL_INJECTION_PATTERNS) {
|
|
92
|
-
result = result.replace(pattern, '');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// Escape shell metacharacters
|
|
96
|
-
if (escapeShell) {
|
|
97
|
-
result = result.replace(SHELL_METACHARACTERS, '');
|
|
98
|
-
}
|
|
99
|
-
// Filter to allowed characters
|
|
100
|
-
if (allowedChars) {
|
|
101
|
-
// Filter character by character to respect the provided regex
|
|
102
|
-
result = result.split('').filter(char => allowedChars.test(char)).join('');
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Escape HTML special characters
|
|
108
|
-
*/
|
|
109
|
-
escapeHtml(str) {
|
|
110
|
-
return str.replace(/[&<>"'`=/]/g, char => HTML_ESCAPE_MAP[char] || char);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Strip HTML tags from a string
|
|
114
|
-
* Handles both complete tags and incomplete/malformed tags to prevent XSS
|
|
115
|
-
*/
|
|
116
|
-
stripHtmlTags(str) {
|
|
117
|
-
// Limit input length to prevent ReDoS
|
|
118
|
-
const MAX_LENGTH = 100000;
|
|
119
|
-
if (str.length > MAX_LENGTH) {
|
|
120
|
-
str = str.slice(0, MAX_LENGTH);
|
|
121
|
-
}
|
|
122
|
-
let result = str;
|
|
123
|
-
let prevLength;
|
|
124
|
-
// Loop until no more changes (handles nested/malformed tags like <script<script>>)
|
|
125
|
-
do {
|
|
126
|
-
prevLength = result.length;
|
|
127
|
-
// Remove complete HTML tags using a non-backtracking approach
|
|
128
|
-
// Process character by character to avoid regex backtracking
|
|
129
|
-
let cleaned = '';
|
|
130
|
-
let inTag = false;
|
|
131
|
-
for (let i = 0; i < result.length; i++) {
|
|
132
|
-
const char = result[i];
|
|
133
|
-
if (char === '<') {
|
|
134
|
-
inTag = true;
|
|
135
|
-
}
|
|
136
|
-
else if (char === '>' && inTag) {
|
|
137
|
-
inTag = false;
|
|
138
|
-
}
|
|
139
|
-
else if (!inTag) {
|
|
140
|
-
cleaned += char;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
result = cleaned;
|
|
144
|
-
} while (result.length < prevLength && result.length > 0);
|
|
145
|
-
// Encode any remaining angle brackets
|
|
146
|
-
result = result.replace(/</g, '<').replace(/>/g, '>');
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// ============================================================================
|
|
151
|
-
// Standalone Functions (for backward compatibility)
|
|
152
|
-
// ============================================================================
|
|
153
|
-
const defaultSanitizer = new InputSanitizer();
|
|
154
|
-
export const sanitizeInput = (input, options) => defaultSanitizer.sanitize(input, options);
|
|
155
|
-
export const escapeHtml = (str) => defaultSanitizer.escapeHtml(str);
|
|
156
|
-
export const stripHtmlTags = (str) => defaultSanitizer.stripHtmlTags(str);
|
|
1
|
+
// Re-export from shared/security for backward compatibility
|
|
2
|
+
export * from '../../../shared/security/input-sanitizer.js';
|
|
157
3
|
//# sourceMappingURL=input-sanitizer.js.map
|
|
@@ -1,164 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Agentic QE v3 - MCP Security: Validation Strategy Interfaces
|
|
3
|
-
* Defines the Strategy Pattern interfaces for security validators
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Risk level classification for security validation
|
|
7
|
-
*/
|
|
8
|
-
export type RiskLevel = 'none' | 'low' | 'medium' | 'high' | 'critical';
|
|
9
|
-
/**
|
|
10
|
-
* Base validation result returned by all validators
|
|
11
|
-
*/
|
|
12
|
-
export interface ValidationResult {
|
|
13
|
-
valid: boolean;
|
|
14
|
-
error?: string;
|
|
15
|
-
riskLevel: RiskLevel;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Path validation result with normalized path
|
|
19
|
-
*/
|
|
20
|
-
export interface PathValidationResult extends ValidationResult {
|
|
21
|
-
normalizedPath?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Regex safety result with pattern analysis
|
|
25
|
-
*/
|
|
26
|
-
export interface RegexSafetyResult {
|
|
27
|
-
safe: boolean;
|
|
28
|
-
pattern?: string;
|
|
29
|
-
escapedPattern?: string;
|
|
30
|
-
error?: string;
|
|
31
|
-
riskyPatterns: string[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Command validation result with sanitized command
|
|
35
|
-
*/
|
|
36
|
-
export interface CommandValidationResult extends ValidationResult {
|
|
37
|
-
sanitizedCommand?: string;
|
|
38
|
-
blockedPatterns: string[];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Input sanitization options
|
|
42
|
-
*/
|
|
43
|
-
export interface SanitizationOptions {
|
|
44
|
-
maxLength?: number;
|
|
45
|
-
allowedChars?: RegExp;
|
|
46
|
-
stripHtml?: boolean;
|
|
47
|
-
stripSql?: boolean;
|
|
48
|
-
escapeShell?: boolean;
|
|
49
|
-
trim?: boolean;
|
|
50
|
-
/** Strip dangerous control characters (null bytes, escape sequences, etc.) - default: true */
|
|
51
|
-
stripControlChars?: boolean;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Path validation options
|
|
55
|
-
*/
|
|
56
|
-
export interface PathValidationOptions {
|
|
57
|
-
basePath?: string;
|
|
58
|
-
allowAbsolute?: boolean;
|
|
59
|
-
allowedExtensions?: string[];
|
|
60
|
-
deniedExtensions?: string[];
|
|
61
|
-
maxDepth?: number;
|
|
62
|
-
maxLength?: number;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Regex validation options
|
|
66
|
-
*/
|
|
67
|
-
export interface RegexValidationOptions {
|
|
68
|
-
maxLength?: number;
|
|
69
|
-
maxComplexity?: number;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Command validation options
|
|
73
|
-
*/
|
|
74
|
-
export interface CommandValidationOptions {
|
|
75
|
-
allowedCommands?: string[];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Base interface for all validation strategies
|
|
79
|
-
* Implements the Strategy Pattern for modular security validation
|
|
80
|
-
*/
|
|
81
|
-
export interface IValidationStrategy<TInput = unknown, TOptions = unknown, TResult extends ValidationResult = ValidationResult> {
|
|
82
|
-
/**
|
|
83
|
-
* Unique name identifier for this validator
|
|
84
|
-
*/
|
|
85
|
-
readonly name: string;
|
|
86
|
-
/**
|
|
87
|
-
* Validate the input according to this strategy
|
|
88
|
-
* @param input - The input to validate
|
|
89
|
-
* @param options - Optional validation options
|
|
90
|
-
* @returns The validation result
|
|
91
|
-
*/
|
|
92
|
-
validate(input: TInput, options?: TOptions): TResult;
|
|
93
|
-
/**
|
|
94
|
-
* Get the risk level this validator typically addresses
|
|
95
|
-
* @returns The primary risk level category
|
|
96
|
-
*/
|
|
97
|
-
getRiskLevel(): RiskLevel;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Path traversal validation strategy interface
|
|
101
|
-
*/
|
|
102
|
-
export interface IPathValidationStrategy extends IValidationStrategy<string, PathValidationOptions, PathValidationResult> {
|
|
103
|
-
normalizePath(path: string): string;
|
|
104
|
-
joinPaths(...paths: string[]): string;
|
|
105
|
-
joinPathsAbsolute(...paths: string[]): string;
|
|
106
|
-
getExtension(path: string): string | null;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Regex safety validation strategy interface
|
|
110
|
-
*/
|
|
111
|
-
export interface IRegexValidationStrategy extends IValidationStrategy<string, RegexValidationOptions, ValidationResult> {
|
|
112
|
-
isRegexSafe(pattern: string): RegexSafetyResult;
|
|
113
|
-
escapeRegex(str: string): string;
|
|
114
|
-
createSafeRegex(pattern: string, flags?: string, maxLength?: number): RegExp | null;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Command validation strategy interface
|
|
118
|
-
*/
|
|
119
|
-
export interface ICommandValidationStrategy extends IValidationStrategy<string, CommandValidationOptions, CommandValidationResult> {
|
|
120
|
-
escapeShellArg(arg: string): string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Input sanitization strategy interface
|
|
124
|
-
*/
|
|
125
|
-
export interface IInputSanitizationStrategy {
|
|
126
|
-
readonly name: string;
|
|
127
|
-
sanitize(input: string, options?: SanitizationOptions): string;
|
|
128
|
-
escapeHtml(str: string): string;
|
|
129
|
-
stripHtmlTags(str: string): string;
|
|
130
|
-
getRiskLevel(): RiskLevel;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Crypto validation strategy interface
|
|
134
|
-
*/
|
|
135
|
-
export interface ICryptoValidationStrategy {
|
|
136
|
-
readonly name: string;
|
|
137
|
-
timingSafeCompare(a: string, b: string): boolean;
|
|
138
|
-
timingSafeHashCompare(value: string, expectedHash: string): boolean;
|
|
139
|
-
generateSecureToken(length?: number): string;
|
|
140
|
-
secureHash(value: string, salt?: string): string;
|
|
141
|
-
getRiskLevel(): RiskLevel;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Validation orchestrator interface for coordinating multiple validators
|
|
145
|
-
*/
|
|
146
|
-
export interface IValidationOrchestrator {
|
|
147
|
-
/**
|
|
148
|
-
* Register a validation strategy
|
|
149
|
-
*/
|
|
150
|
-
registerStrategy(strategy: IValidationStrategy): void;
|
|
151
|
-
/**
|
|
152
|
-
* Get a registered strategy by name
|
|
153
|
-
*/
|
|
154
|
-
getStrategy(name: string): IValidationStrategy | undefined;
|
|
155
|
-
/**
|
|
156
|
-
* Validate using a specific strategy
|
|
157
|
-
*/
|
|
158
|
-
validateWith<TResult extends ValidationResult>(strategyName: string, input: unknown, options?: unknown): TResult;
|
|
159
|
-
/**
|
|
160
|
-
* Run all registered validators on an input
|
|
161
|
-
*/
|
|
162
|
-
validateAll(input: unknown): Map<string, ValidationResult>;
|
|
163
|
-
}
|
|
1
|
+
export * from '../../../shared/security/validators-interfaces.js';
|
|
164
2
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Defines the Strategy Pattern interfaces for security validators
|
|
4
|
-
*/
|
|
5
|
-
export {};
|
|
1
|
+
// Re-export from shared/security for backward compatibility
|
|
2
|
+
export * from '../../../shared/security/validators-interfaces.js';
|
|
6
3
|
//# sourceMappingURL=interfaces.js.map
|