Setu-TS
    Preparing search index...

    Function assertRealPathContained

    • Asserts that a target path is contained within a root by comparing canonical paths.

      This function uses the filesystem's realPath capability to resolve symlinks and compare canonical paths, preventing symlink-based traversal attacks.

      Parameters

      • fs: Pick<IFileSystem, "realPath" | "stat">

        The filesystem to use for path resolution

      • root: string

        The root directory (must be an absolute path)

      • target: string

        The target path to check (must be an absolute path)

      Returns Promise<boolean>

      True if the target is contained within the root

      If the target is not contained within the root or cannot be resolved

      0.1.0