UNPKG

@felixgeelhaar/cclint

Version:

A comprehensive linter for CLAUDE.md files with multi-language code block validation

48 lines 1.73 kB
/** * Security utility for validating file paths to prevent directory traversal attacks */ export declare class PathValidator { private readonly allowedExtensions; private readonly maxPathLength; private readonly forbiddenPatterns; constructor(allowedExtensions?: string[], maxPathLength?: number); /** * Validate a file path for security issues * @param filePath The path to validate * @param basePath Optional base path to restrict access within * @returns Normalized, safe path * @throws Error if path is invalid or unsafe */ validatePath(filePath: string, basePath?: string): string; /** * Check if a file has an allowed extension * @param filePath The path to check * @returns True if extension is allowed */ hasAllowedExtension(filePath: string): boolean; /** * Validate that a path exists and is a file (not a directory) * @param filePath The path to check * @returns True if path exists and is a file */ isValidFile(filePath: string): boolean; /** * Validate that a path exists and is a directory * @param dirPath The path to check * @returns True if path exists and is a directory */ isValidDirectory(dirPath: string): boolean; /** * Get the file extension from a path * @param filePath The path to extract extension from * @returns The file extension including the dot */ private getExtension; /** * Sanitize a filename to remove potentially dangerous characters * @param filename The filename to sanitize * @returns Sanitized filename */ sanitizeFilename(filename: string): string; } //# sourceMappingURL=PathValidator.d.ts.map