Skip to content

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

Merged
danielmiessler merged 1 commit into
danielmiessler:mainfrom
qozle:fix/tab-setter-command-injection
May 20, 2026
Merged

security: replace execSync with execFileSync in tab-setter.ts#1046
danielmiessler merged 1 commit into
danielmiessler:mainfrom
qozle:fix/tab-setter-command-injection

Conversation

@qozle

@qozle qozle commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

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
@danielmiessler danielmiessler merged commit de22062 into danielmiessler:main May 20, 2026
larsboes added a commit to larsboes/PAI that referenced this pull request Jun 10, 2026
…, PULSE casing

Selective integration of upstream danielmiessler/PAI (9fb9c862fde1bb):
- security: port execSync→execFileSync in tab-setter.ts (danielmiessler#1046), incl. the
  fork's extra cmux call sites + the kitten|jq pipe → execFileSync+JSON.parse,
  and replace `command -v` with `which`. Adds KITTY_LISTEN_ON socket validation.
- security: remove Midjourney/Discord integration from Art/Media skills (6 files)
  + strip stale "Midjourney" trigger keyword from Media SKILL.md descriptions.
- fix(PULSE): "Pulse"→"PULSE" directory casing across PULSE module — real bug on
  Linux/WSL2 case-sensitive FS (live dir is PULSE; refs were "Pulse") (danielmiessler#1259/danielmiessler#1175).
- bump .pai-fork/last-synced.ref → 2fde1bb.

Skipped (verified N/A to fork): plansDirectory danielmiessler#672 (no such key), case-colliding
danielmiessler#621 (no pai-observability-server), wiki Algorithm danielmiessler#1273 (fork casing consistent),
PAI-Install danielmiessler#1267 (fork doesn't deploy PAI-Install).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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

2 participants