Repository navigation
fix(codeRefs): replace exec() with execFile() to prevent command injection - #174
Conversation
…ction Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6bbadcf. Configure here.
| await config.getAliases().start(); | ||
| if (!workspace.isTrusted) { | ||
| config.getCtx().subscriptions.push(workspace.onDidGrantWorkspaceTrust(() => config.getAliases()?.start())); | ||
| } |
There was a problem hiding this comment.
Trust handler gated on version check
Medium Severity
The onDidGrantWorkspaceTrust listener is nested under codeRefsVersionCheck(), which returns false when the workspace is untrusted. That call is not awaited, so the Promise is always truthy and the listener still registers. Awaiting the check would skip this recovery and show a false version error instead.
Reviewed by Cursor Bugbot for commit 6bbadcf. Configure here.
| await config.getAliases().start(); | ||
| if (!workspace.isTrusted) { | ||
| config.getCtx().subscriptions.push(workspace.onDidGrantWorkspaceTrust(() => config.getAliases()?.start())); | ||
| } |
There was a problem hiding this comment.
Trust listener registered multiple times
Low Severity
setupComponents can run again while the workspace is still untrusted, for example after a session change or configure. Each run pushes another onDidGrantWorkspaceTrust listener. Granting trust then calls start() multiple times on the same FlagAliases instance and starts overlapping refresh intervals.
Reviewed by Cursor Bugbot for commit 6bbadcf. Configure here.
The execFile() change fully remediates the reported command injection. The Workspace Trust additions are removed because: - Declaring untrustedWorkspaces "limited" widened exposure. Without a declaration VS Code disables the extension entirely in Restricted Mode. With "limited" the whole extension (auth session, API client, flag store, sign-in flow) activated in untrusted workspaces, with only the Code References paths gated. - restrictedConfigurations was inert. VS Code only applies it to settings registered under contributes.configuration, and neither launchdarkly.project nor launchdarkly.codeRefsPath is registered. - The workspace.isTrusted guards and onDidGrantWorkspaceTrust handler are dead code without the declaration: the extension never runs in an untrusted workspace, and VS Code activates it itself when trust is granted. Also restores the unrelated CHANGELOG whitespace normalization and narrows the 6.2.2 entry to the execFile fix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>


Here is a PR description that matches what the branch now ships. I have not applied it to the PR, since that is a remote action.
Summary
Fixes a command injection vulnerability in Code References alias generation (bug bounty report).
Vector:
FlagAliases.generateCsvandFlagAliases.codeRefsVersionCheckinsrc/providers/codeRefs.tsbuilt a single command string and ran it throughchild_process.exec, which spawns a shell. The string interpolated workspace-controlled values inside double quotes:intConfig.project, fromlaunchdarkly.projectin a repo's.vscode/settings.jsondirectory, the workspace folder path (cloned folder name or a.code-workspacepath)A repository could therefore run arbitrary commands when opened, and the child process received the developer's LaunchDarkly session token via
LD_ACCESS_TOKEN. Affects Linux, macOS ($(...)) and Windows ("+&)Fix: invoke `ld-find-code-refsrgument array. No shell is
involved, so shell metacharacters in any argument are inert.