fix(security): Add path allowlisting to /vscode-remote-resource endpoint#208
Merged
fix(security): Add path allowlisting to /vscode-remote-resource endpoint#208
Conversation
## 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.
sachinh-amazon
approved these changes
Apr 23, 2026
aws-ajangg
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Testing
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.