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.
2 parents ef086f5 + d265ac7 commit 5cfeea3Copy full SHA for 5cfeea3
remote-workspace/src/servers/api-server/platform-api/handler.ts
@@ -21,7 +21,9 @@ function safeResolve(uri: string): string {
21
const candidate = path.resolve(SAFE_ROOT, uri);
22
23
// Check that candidate is strictly under rootPath (or equal to rootPath)
24
- if (candidate === rootPath || candidate.startsWith(rootPath + path.sep)) {
+ const rel = path.relative(rootPath, candidate);
25
+ // Allow if candidate is rootPath itself, or a subpath (not escaping via '..', not absolute)
26
+ if (rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel))) {
27
return candidate;
28
}
29
0 commit comments