This commit is contained in:
Robby 2026-01-29 02:45:11 +00:00 committed by GitHub
commit c85125dd46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -401,7 +401,8 @@ export class MemoryIndexManager {
throw new Error("path required"); throw new Error("path required");
} }
const absPath = path.resolve(this.workspaceDir, relPath); const absPath = path.resolve(this.workspaceDir, relPath);
if (!absPath.startsWith(this.workspaceDir)) { const rel = path.relative(this.workspaceDir, absPath);
if (rel.startsWith("..") || path.isAbsolute(rel)) {
throw new Error("path escapes workspace"); throw new Error("path escapes workspace");
} }
const content = await fs.readFile(absPath, "utf-8"); const content = await fs.readFile(absPath, "utf-8");