Skip to content

fix(security): Add path allowlisting to /vscode-remote-resource endpoint#208

Merged
azmkercso merged 1 commit intoaws:1.0from
aakashmandavilli96:1.0
Apr 23, 2026
Merged

fix(security): Add path allowlisting to /vscode-remote-resource endpoint#208
azmkercso merged 1 commit intoaws:1.0from
aakashmandavilli96:1.0

Conversation

@aakashmandavilli96
Copy link
Copy Markdown
Contributor

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.0 branch. A matching PR has been created for 1.1.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aakashmandavilli96 aakashmandavilli96 requested review from a team as code owners April 23, 2026 00:29
## 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.0 branch. A matching PR has been created for 1.1.
@azmkercso azmkercso merged commit d2a813c into aws:1.0 Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants