/** * File Organizer MCP Server v3.4.2 * Path Validator Service * * Implements 8-layer path validation for security: * 1. Type validation * 2. Expansion (env vars, ~) * 3. Character/length validation * 4. Absolute path resolution * 4.5. Security check (whitelist/blacklist) * 5. Symlink resolution * 6. Containment check * 7. Access permissions */ import fs from "fs/promises"; /** * Layer 7: Check file/directory access permissions * @param realPath - The resolved real path to check * @param options - Options for access check * @param options.requireExists - Whether the path must exist * @param options.checkWrite - Whether write permission is required * @returns Promise - Resolves to true if access is allowed, false otherwise * @throws {AccessDeniedError} When path resolution encounters circular symlinks * @throws {Error} When unexpected filesystem errors occur during access check */ export declare function checkAccess(realPath: string, options: { requireExists?: boolean; checkWrite?: boolean; }): Promise; export interface ValidatePathOptions { basePath?: string; allowedPaths?: string | string[] | null; requireExists?: boolean; checkWrite?: boolean; allowSymlinks?: boolean; } /** * Full path validation pipeline */ export declare function validatePathBase(inputPath: unknown, options?: ValidatePathOptions): Promise; /** * Validate path in STRICT mode (CWD-only access) */ export declare function validateStrictPath(inputPath: unknown): Promise; /** * Path Validator Service class for dependency injection */ export declare class PathValidatorService { private readonly basePath; private readonly allowedPaths; constructor(basePath?: string, allowedPaths?: string[]); validatePath(inputPath: unknown, options?: Omit): Promise; isPathAllowed(inputPath: string): boolean; /** * securely open a file for reading, returning a FileHandle * Mitigates TOCTOU by ensuring the file validated is the one opened */ openAndValidateFile(inputPath: string): Promise; } //# sourceMappingURL=path-validator.service.d.ts.map