UNPKG

ailock

Version:

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

59 lines 1.91 kB
/** * Unified path validation combining security, glob, and sanitization features * This is a facade that maintains backward compatibility while delegating to specialized validators */ export declare class SecurePathValidator { private readonly securityValidator; private readonly globValidator; private readonly pathSanitizer; constructor(allowedRootDirs?: string[]); /** * Validates and sanitizes a file path to prevent security vulnerabilities */ validateAndSanitizePath(inputPath: string, rootDir?: string): Promise<string>; /** * Validate path type (file or directory) */ validatePathType(filePath: string, expectedType: 'file' | 'directory'): Promise<void>; /** * Validate file access permissions */ validateFileAccess(filePath: string, mode?: number): Promise<void>; /** * Find files matching glob patterns */ findMatchingFiles(patterns: string[], options?: any): Promise<string[]>; /** * Check if a path matches any of the given patterns */ matchesPattern(filePath: string, patterns: string[]): boolean; /** * Load patterns from a gitignore-style file */ loadPatternsFromFile(filePath: string): string[]; /** * Create an ignore filter from patterns */ createIgnoreFilter(patterns: string[]): (path: string) => boolean; /** * Get allowed root directories */ getAllowedRootDirs(): string[]; /** * Parse a path into its components */ parsePath(inputPath: string): any; /** * Join path segments safely */ joinPath(...segments: string[]): string; /** * Get relative path between two paths */ getRelativePath(from: string, to: string): string; /** * Check if a path is absolute */ isAbsolutePath(inputPath: string): boolean; } //# sourceMappingURL=PathValidator.d.ts.map