Commit 3e725b8
committed
fix(security): Add path allowlisting to /vscode-remote-resource endpoint
## Issue
P401260599
## Description of Changes
Add path traversal protection to the /vscode-remote-resource handler. The
endpoint previously served any file readable by the process with no path
restriction, enabling arbitrary file read via ../ traversal, URL encoding,
or direct absolute paths.
Changes:
- Import resolve from vs/base/common/path
- Resolve requested file path to canonical form before serving
- Validate resolved path against allowed directories (builtinExtensionsPath,
extensionsPath, userDataPath)
- Return 403 Forbidden for paths outside allowed roots
## Testing
- Verified patch applies cleanly via quilt (prepare-src.sh)
- All subsequent patches in sagemaker.series apply without conflict
## Screenshots/Videos
## Additional Notes
Patch is placed after validate-http-request-referer.diff in the series,
as it builds on the same handler code path.
## Backporting
This PR targets the 1.1 branch. A matching PR has been created for 1.0.1 parent 0ffc0f3 commit 3e725b8
2 files changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments