We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b02eb4 commit ce99341Copy full SHA for ce99341
remote-workspace/src/servers/api-server/platform-api/handler.ts
@@ -19,8 +19,12 @@ function safeWorkspaceResolve(uri: string): string {
19
// Resolve symlinks to their actual paths
20
const realPath = fs.existsSync(absPath) ? fs.realpathSync(absPath) : absPath;
21
22
- // Ensure it’s inside the workspace root
23
- if (!realPath.startsWith(workspaceRoot + path.sep)) {
+ // Ensure it's inside the workspace root (strict, cross-platform)
+ const rel = path.relative(workspaceRoot, realPath);
24
+ if (
25
+ rel.startsWith('..') ||
26
+ path.isAbsolute(rel)
27
+ ) {
28
throw new Error("Cannot access path outside of workspace path.");
29
}
30
0 commit comments