UNPKG

woaru

Version:

Universal Project Setup Autopilot - Analyze and automatically configure development tools for ANY programming language

37 lines 1.57 kB
/** * Secure Command Execution Utilities * Prevents Command Injection by using proper argument handling */ export interface ExecResult { stdout: string; stderr: string; exitCode: number; } /** * Sanitizes and validates a file path to prevent path traversal attacks */ export declare function sanitizeFilePath(filePath: string): string; /** * Safely executes a command with arguments using spawn instead of shell execution * This prevents command injection by treating arguments as separate parameters */ export declare function safeExecAsync(command: string, args?: string[], options?: { cwd?: string; timeout?: number; env?: NodeJS.ProcessEnv; }): Promise<ExecResult>; /** * Validates that a command is in an allowed list (whitelist approach) */ export declare function validateCommand(command: string, allowedCommands: readonly string[]): boolean; /** * Escape special characters for shell commands (only when shell is absolutely necessary) * NOTE: Prefer safeExecAsync over shell execution */ export declare function escapeShellArg(arg: string): string; /** * Common allowed commands for WOARU tools */ export declare const ALLOWED_COMMANDS: readonly ["eslint", "prettier", "tsc", "npm", "yarn", "pnpm", "python", "python3", "pip", "pip3", "black", "ruff", "mypy", "pytest", "go", "golint", "gofmt", "dotnet", "mvn", "gradle", "rustc", "cargo", "clippy", "snyk", "trivy", "gitleaks", "semgrep", "bandit", "safety"]; export type AllowedCommand = (typeof ALLOWED_COMMANDS)[number]; //# sourceMappingURL=secureExecution.d.ts.map