Skip to content

security: replace execSync with execFileSync in tab-setter.ts#1046

Open
qozle wants to merge 1 commit intodanielmiessler:mainfrom
qozle:fix/tab-setter-command-injection
Open

security: replace execSync with execFileSync in tab-setter.ts#1046
qozle wants to merge 1 commit intodanielmiessler:mainfrom
qozle:fix/tab-setter-command-injection

Conversation

@qozle
Copy link
Copy Markdown

@qozle qozle commented Apr 7, 2026

Summary

  • tab-setter.ts uses execSync() with string interpolation to build kitten commands — vulnerable to command injection via KITTY_LISTEN_ON env var or tab title content
  • Replaces all execSync calls with execFileSync using array arguments (no shell spawned, no injection surface)
  • Adds socket path validation regex before use
  • Replaces jq shell pipeline in cleanupStaleStateFiles() with native JSON.parse()

What changed

Three functions updated:

  • cleanupStaleStateFiles()execSync + jq pipeline → execFileSync + JSON.parse() + socket validation
  • setTabState()execSync string interpolation → execFileSync array args
  • setPhaseTab() — same pattern

Test plan

  • Tab titles still update correctly via kitten remote control
  • Tab colors change on state transitions (working/completed/idle)
  • Stale state file cleanup still works
  • Titles with special characters (", $, backticks) render correctly without injection

Closes #1045

execSync() with string interpolation is vulnerable to command injection
via KITTY_LISTEN_ON env var or tab title content. Switches all shell
commands to execFileSync() with array args (no shell spawned), adds
socket path validation regex, and replaces the jq shell pipeline with
native JSON.parse().

Closes danielmiessler#1045
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: command injection via tab-setter.ts execSync string interpolation

1 participant