codecrucible-synth
Version:
Production-Ready AI Development Platform with Multi-Voice Synthesis, Smithery MCP Integration, Enterprise Security, and Zero-Timeout Reliability
103 lines • 2.85 kB
TypeScript
#!/usr/bin/env node
/**
* Secure Execution Manager - SECURITY CRITICAL COMPONENT
*
* This component enforces secure code execution policies and replaces
* all unsafe direct execution with E2B sandboxed execution.
*
* CRITICAL SECURITY FIXES:
* - Blocks direct shell command execution
* - Enforces E2B sandboxing for all code execution
* - Implements comprehensive command validation
* - Removes environment variable exposure
* - Adds audit logging for security monitoring
*/
export interface SecureExecutionConfig {
enforceE2BOnly: boolean;
allowLocalExecution: boolean;
auditLog: boolean;
maxExecutionTime: number;
allowedCommands: string[];
blockedPatterns: RegExp[];
}
export interface ExecutionRequest {
command: string;
language?: string;
workingDirectory?: string;
timeout?: number;
environment?: Record<string, string>;
sessionId?: string;
}
export interface ExecutionResult {
success: boolean;
stdout?: string;
stderr?: string;
exitCode: number;
executionTime: number;
sessionId: string;
securityWarnings?: string[];
backend: 'e2b' | 'blocked' | 'error';
}
/**
* Secure Execution Manager - Enforces security policies for all code execution
*/
export declare class SecureExecutionManager {
private e2bService;
private securityValidator;
private config;
private isInitialized;
constructor(config?: Partial<SecureExecutionConfig>);
/**
* Initialize the secure execution manager
*/
initialize(): Promise<void>;
/**
* Execute code securely with comprehensive security validation
*/
executeSecurely(request: ExecutionRequest): Promise<ExecutionResult>;
/**
* Execute code via E2B sandbox
*/
private executeViaE2B;
/**
* Validate execution security
*/
private validateExecutionSecurity;
/**
* Sanitize execution request to remove potentially dangerous elements
*/
private sanitizeExecutionRequest;
/**
* Check if environment variable is safe to pass through
*/
private isSafeEnvironmentVariable;
/**
* Create a blocked execution result
*/
private createBlockedResult;
/**
* Audit log execution requests for security monitoring
*/
private auditLogExecution;
/**
* Generate a secure session ID
*/
private generateSessionId;
/**
* Get execution statistics for monitoring
*/
getStats(): {
e2bService: any;
config: SecureExecutionConfig;
isInitialized: boolean;
};
/**
* Shutdown and cleanup resources
*/
shutdown(): Promise<void>;
}
/**
* Default secure execution manager instance
*/
export declare const secureExecutionManager: SecureExecutionManager;
//# sourceMappingURL=secure-execution-manager.d.ts.map