Filter invalid Windows env var names before passing to child_process#2634
Merged
Filter invalid Windows env var names before passing to child_process#2634
Conversation
Agent-Logs-Url: https://github.com/dotnet/vscode-dotnet-runtime/sessions/c6da1a68-403a-478e-9be8-e96f5aae55c4 Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
…n spawning processes Agent-Logs-Url: https://github.com/dotnet/vscode-dotnet-runtime/sessions/c6da1a68-403a-478e-9be8-e96f5aae55c4 Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix installer failure due to invalid environment variable
Filter invalid Windows env var names before passing to child_process
Apr 8, 2026
Copilot stopped work on behalf of
nagilson due to an error
April 8, 2026 23:48
- Use POSIX regex /^[a-zA-Z_][a-zA-Z0-9_]*$/ instead of only filtering () to match what @vscode/sudo-prompt actually validates - Fix comments: error comes from sudo-prompt, not Node.js child_process - Add tests for hyphens, dots, spaces, digit-leading names, empty string - Revert yarn.lock platform artifact (linux-x64 back to win32-x64) - Add trailing newline to TypescriptUtilities.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
409b8d6 to
0e21ea4
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nagilson
approved these changes
Apr 9, 2026
MiYanni
approved these changes
Apr 9, 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.
Windows environment variables like
CommonProgramFiles(x86)andProgramFiles(x86)contain parentheses, which newer Node.js versions reject when passed viaoptions.envtochild_process.exec, causing SDK installs to fail withoptions.env has an invalid environment variable name: "CommonProgramFiles(x86)".Changes
TypescriptUtilities.ts: AddedisValidEnvironmentVariableName(name)andfilterEnvVars(env)— filters out env vars whose names contain parentheses (the character class Node.js rejects inoptions.env)CommandExecutor.ts: ApplyfilterEnvVars()in both code paths whereprocess.envis spread intooptions.envTypescriptUtilities.test.ts: Unit tests covering bothisValidEnvironmentVariableNameandfilterEnvVarsfor the parentheses case and standard valid namesWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
microsoft.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/vscode-dotnet-runtime/vscode-dotnet-runtime/vscode-dotnet-runtime-library/node_modules/.bin/mocha -u tdd -- dist/test/unit/DebianDistroTests.test.js dist/test/unit/DotnetConditionValidator.test.js dist/test/unit/DotnetCoreAcquisitionWorker.test.js dist/test/unit/DotnetPathFinder.test.js dist/test/unit/DotnetResolver.test.js dist/test/unit/ErrorHandler.test.js dist/test/unit/ExecutableArchitectureDetector.test.js dist/test/unit/ExistingPathResolver.test.js dist/test/unit/FileUtilities.test.js dist/test/unit/GlobalInstallerResolver.test.js dist/test/unit/InstallScriptAcquisitionWorker.test.js dist/test/unit/InstallTracker.test.js dist/test/unit/InstallationValidator.test.js dist/test/unit/IssueReporter.test.js dist/test/unit/JsonInstaller.test.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: