示例工程 48-project-security-auditor

48-project-security-auditor/app/fixtures/clean/paths.txt

text · 0.3 KB

// fixture: paths.ts
import path from "node:path";
export function readNote(workspace: string, relative: string): string {
  const target = path.resolve(workspace, relative);
  if (path.relative(workspace, target).startsWith("..")) {
    throw new Error("PATH_ESCAPE");
  }
  return target;
}