Merge da77125a74 into b717724275
This commit is contained in:
commit
c85125dd46
@ -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");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user