git-workspace-service 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -617,7 +617,13 @@ var WorkspaceService = class {
|
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
try {
|
|
620
|
-
await fs3.
|
|
620
|
+
const realPath = await fs3.realpath(workspace.path);
|
|
621
|
+
const realBase = await fs3.realpath(this.baseDir);
|
|
622
|
+
if (!realPath.startsWith(realBase + path.sep) && realPath !== realBase) {
|
|
623
|
+
this.log("error", { workspaceId, realPath, realBase }, "Workspace path resolves outside baseDir \u2014 refusing to delete");
|
|
624
|
+
} else {
|
|
625
|
+
await fs3.rm(workspace.path, { recursive: true, force: true });
|
|
626
|
+
}
|
|
621
627
|
} catch (error) {
|
|
622
628
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
623
629
|
this.log("warn", { workspaceId, error: errorMessage }, "Failed to remove workspace directory");
|