14 lines
561 B
TypeScript
14 lines
561 B
TypeScript
/**
|
|
* Validates that a file path is safe and within the allowed base directory
|
|
* Prevents path traversal attacks via:
|
|
* - Null byte injection
|
|
* - Directory traversal sequences (../)
|
|
* - Symlink attacks
|
|
*
|
|
* @param basePath - The allowed base directory (must be absolute)
|
|
* @param relativePath - The relative path to validate
|
|
* @returns The validated absolute path
|
|
* @throws Error if path validation fails
|
|
*/
|
|
export declare function validateFilePath(basePath: string, relativePath: string): Promise<string>;
|
|
//# sourceMappingURL=path-validator.d.ts.map
|