scaffold-scripts
Version:
Simple CLI tool for managing and running your own scripts. Add any script, run it anywhere.
78 lines • 2.04 kB
TypeScript
export interface ValidationResult {
isValid: boolean;
errors: string[];
warnings: string[];
sanitizedScript: string;
}
export interface ValidationOptions {
strict?: boolean;
allowNetworkAccess?: boolean;
allowSystemModification?: boolean;
}
export declare class ScriptValidator {
private allowedExtensions;
private binaryExtensions;
private dangerousCommands;
private allowedCommands;
/**
* Validate and sanitize a script
*/
validate(script: string, options?: ValidationOptions): ValidationResult;
/**
* Load and validate script from file
*/
validateFromFile(filePath: string, options?: ValidationOptions): ValidationResult;
/**
* Validate file type and extension
*/
private validateFileType;
/**
* Check if buffer contains binary data
*/
private isBinaryContent;
/**
* Basic script sanitization
*/
private sanitizeScript;
/**
* Check for dangerous commands
*/
private checkDangerousCommands;
/**
* Check for network commands
*/
private checkNetworkCommands;
/**
* Check for system modifications
*/
private checkSystemModifications;
/**
* Validate script structure
*/
private validateStructure;
/**
* Improved quote validation that handles PowerShell arrays and here-strings
*/
private validateQuotes;
/**
* Remove comments and here-strings that might contain unbalanced quotes
*/
private removeCommentsAndHereStrings;
/**
* Check if script appears to be PowerShell
*/
private isPowerShellScript;
/**
* Validate PowerShell array quotes specifically
*/
private validatePowerShellArrayQuotes;
/**
* Check cross-platform compatibility
*/
private checkCrossPlatformCompatibility;
/**
* Get validation summary for display
*/
getValidationSummary(result: ValidationResult): string;
}
//# sourceMappingURL=scriptValidator.d.ts.map