Skip to main content

validateFilePath

Summary

Validates that a file path is within the allowed base directory. Prevents path traversal attacks.

Signature

Parameters

basePath

Type:string The base directory that files must be within

filePath

Type:string The file path to validate

Returns

Type:string Validates that a file path is within the allowed base directory. Prevents path traversal attacks.