Conversation
Owner
selfint
commented
Oct 31, 2025
- update all dependencies to latest versions
- update CHANGELOG.md
- update package version
Updated optional requirements and installation instructions for tree-sitter and node-gyp-build. Clarified that no tools are required for extension functionality.
| onData?.(d.toString()) | ||
| logger.log(`Building parser ${parserName}`); | ||
| const buildResult = await runCmd( | ||
| `${npm} exec --yes --loglevel silly --prefix ${parsersDir} node-gyp rebuild --target=${process.versions.electron} --dist-url=https://electronjs.org/headers --runtime=electron`, |
Check warning
Code scanning / CodeQL
Unsafe shell command constructed from library input Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
General fix:
Avoid passing any untrusted (or derived) data directly into a shell command string. Instead, use an argument array and a shell-less invocation with execFile, which does not invoke the shell and passes arguments as-is, eliminating the chance of command injection or accidental breakage due to whitespace or special characters.
Detailed fix:
- Refactor the construction and invocation of the npm/node-gyp build command in
downloadAndBuildParserso that it does not use string interpolation to produce a shell command string. - Instead, build an array of arguments and call
execFile(or its promisified version) withshell: false. - Update the
runCmdfunction so it can callexecFileinstead ofexecwhen given arguments as an array.
(Alternatively, split the function, but the cleanest way is to use argument array +execFile.) - Pass path-like variables (such as
${parsersDir}) as arguments, not as part of a single command string. - Add any required imports (e.g.,
execFilefromchild_process). - Change the code path in
downloadAndBuildParser(and the call torunCmd) to pass an array of arguments to ensure correct, injection-safe execution.
File/region/line specifics:
- Edit
src/Installer.ts:- Refactor the command creation at line 127.
- Update
runCmdto useexecFile(or to differentiate between string/array commands). - Add any required imports.
Suggested changeset
1
src/Installer.ts
Copilot is powered by AI and may make mistakes. Always verify output.
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.