fix: consolidate boundary ownership and cleanup failure paths (#477)

This commit is contained in:
morluto
2026-09-08 10:59:13 +08:00
committed by GitHub
parent c490d85045
commit 2160d4fae5
138 changed files with 2220 additions and 1781 deletions
@@ -1,5 +1,6 @@
import { isAbsolute, posix, relative } from "node:path";
import { posix, relative } from "node:path";
import { isPathWithinRoot } from "./localPath.js";
import {
compareCodePoints,
type ApplicationNode,
@@ -210,8 +211,7 @@ const pathBelowRoot = (root: string, value: string): string | null => {
const remainder = relative(root, value);
if (
remainder === "" ||
remainder.startsWith("..") ||
isAbsolute(remainder) ||
!isPathWithinRoot(root, value) ||
remainder.includes("\\")
)
return null;