/** * Filesystem access guard for MCP-tool inputs. * * The server accepts `image_path` / `output_dir` / `existing_mark_svg` from an * untrusted caller (any MCP client connected over stdio or HTTP). Without a * guard, a malicious caller could pass `../../../../etc/passwd` to read * arbitrary files, or `/etc/cron.d/foo` to write to system paths. * * Policy: a path is accepted iff its real (symlink-resolved) absolute form * is the current working directory, one of the configured output/cache dirs, * or a root explicitly listed in `P2A_ALLOWED_PATHS` (colon-separated). * * Symlinks are followed on read (via realpath). If the target escapes the * allow-list, access is denied. This also prevents TOCTOU escape-via-symlink. */ export declare class PathAccessError extends Error { readonly code = "PATH_ACCESS_DENIED"; constructor(path: string, reason: string); } export interface SafePathOptions { /** When true, the path must exist (symlink-resolved). */ mustExist?: boolean; /** Purpose hint included in error messages. */ purpose?: "read" | "write"; } export declare function safePath(input: unknown, opts?: SafePathOptions): string; /** Convenience wrapper for input paths we expect to exist (reads). */ export declare function safeReadPath(input: unknown): string; /** Convenience wrapper for output paths (create-if-missing). */ export declare function safeWritePath(input: unknown): string; /** Exposed for doctor/capabilities diagnostics. */ export declare function describeAllowedRoots(): string[]; //# sourceMappingURL=paths.d.ts.map