Removed Snap related code from updateService.linux.ts #69979
Merged
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.
This patch does two things. The first removes the snap update code from updateService.linux.ts.
This is because the code always creates a SnapUpdateService if the environment variables are set. This occurs in vscode/src/vs/code/electron-main/app.ts.
The second change this patch introduces is the removal of spawning processes based on $SNAP_NAME. This is because an attacker could potentially leverage the environment variables SNAP, SNAP_REVISION and SNAP_NAME to enable execution through doQuitAndInstall.
I have instead replaced $SNAP_NAME with path.basename(process.argv[0]). This should be equivalent and should just return the name of the executing process. This will preserve the original behaviour whilst remaining compatible with all the various SNAP update mechanisms. This provides better guarantees of executing vscode than some other arbitrary program.