Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

openInEditor runs the editor command through a shell

Closed
#209 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
desktop, security

Research direction

Start with src/main/files.ts:58 and read how openInEditor constructs and launches the editor command; then inspect the related Windows launcher constraint in issue #178. Add tests covering editor commands with spaces in paths and with arguments, as proposed. Done means editor commands are launched without treating the command as shell text, with the Windows .cmd case handled.

Written by the indexing model from the issue text.

Description

enhancement priority: low security severity: low

From Finding 4b of the earlier SECURITY-REVIEW.md (also noted in the Oct 7 audit), checked against the current code.

Problem

openInEditor (src/main/files.ts:58) runs spawn(\${command} "${file}"`, { shell: true }). The file path is confined to the project and filtered for quotes, line breaks and (on POSIX) $, backtick and `. But editorCommand itself is shell text, so code; <anything> runs. Changing it needs a native confirmation, so this is not exploitable without the user, but the shell string is a fragile sink at the same trust level as the terminal.

Proposal

Split editorCommand into a program and arguments (shell-style parsing), and run spawn(program, [...args, file], { shell: false }). On Windows, .cmd launchers such as code.cmd need resolving to the executable or an explicit cmd.exe /d /s /c call with quoted arguments (see #178 for the same Node.js restriction). Add tests for editor commands with spaces in paths and with arguments.

Dominant language
TypeScript
Stars
2
Forks
2
Avg merge
5h 28m
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PierrunoYT/patch

All issues in PierrunoYT/patch

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.