UNPKG

ailock

Version:

AI-Proof File Guard - Protect sensitive files from accidental AI modifications

63 lines 1.94 kB
export interface CommandResult { stdout: string; stderr: string; exitCode: number; command: string; args: string[]; } export interface SecureCommandOptions { timeout?: number; cwd?: string; env?: Record<string, string>; input?: string; allowedCommands?: string[]; maxOutputSize?: number; } /** * Secure command executor that prevents injection attacks and provides * comprehensive security controls for external command execution */ export declare class SecureCommandExecutor { private readonly defaultTimeout; private readonly maxOutputSize; private readonly allowedCommands; constructor(allowedCommands?: string[]); /** * Executes a command securely with argument validation and output limits */ executeCommand(command: string, args: string[], options?: SecureCommandOptions): Promise<CommandResult>; /** * Executes a command and returns only success/failure */ executeCommandSilent(command: string, args: string[], options?: SecureCommandOptions): Promise<boolean>; /** * Creates a safe shell command string for logging purposes only * DO NOT USE THIS FOR ACTUAL EXECUTION */ createSafeCommandString(command: string, args: string[]): string; /** * Validates that a command is in the allowed list */ private validateCommand; /** * Sanitizes command arguments to prevent injection */ private sanitizeArguments; /** * Creates a secure environment for command execution */ private createSecureEnvironment; /** * Adds an allowed command to the whitelist */ addAllowedCommand(command: string): void; /** * Removes a command from the whitelist */ removeAllowedCommand(command: string): void; /** * Gets the list of allowed commands */ getAllowedCommands(): string[]; } //# sourceMappingURL=CommandExecutor.d.ts.map