Fix some vulnerabilities#32
Open
joeytwiddle wants to merge 5 commits into
Open
Conversation
Scheduler scanned every project's .claude/commands/schedule-*.md and string-concatenated YAML frontmatter values (model, max-budget-usd, allowed-tools, add-dirs, append-system-prompt) into a bash -c command. A malicious schedule file in any cloned repo gave code execution within 60 seconds of opening the project. Fix: buildScheduleCommand now returns an argv array; runScheduleCommand shell-quotes each token via a new quoteArgvForShell helper that dispatches on shell family (POSIX single-quote, PowerShell doubled-quote, cmd double-quote). Added input validation that rejects control chars in scalars and requires max-budget-usd to be numeric. Tests cover injection attempts as literal argv tokens, input-validation rejections, and a live-bash simulation of a malicious frontmatter. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
H2/H3: Apply the same argv-quoter fix to the interactive open-terminal path. worktreeName, addDirs, permissionMode, and appendSystemPrompt are now pushed into an argv array and shell-quoted per-shell before being concatenated into the -c command string. preLaunchCmd remains a raw shell snippet (by design — "e.g. aws-vault exec profile --"), but now rejects newlines to prevent hidden multi-line injection. Also removes the tempfile + $(cat '...') dance for appendSystemPrompt since the quoter handles multi-line strings directly. M4: MCP lock file now written with mode 0o600. Previously defaulted to 0o644 (world-readable), letting any local process read the auth token and issue MCP tool calls to the session. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
readFromKeychain built a shell string with $USER interpolated via execSync. Normally $USER contains only a plain username, but it can be influenced by the launcher's environment (launchctl setenv, a .plist, a wrapper script), and any shell metacharacters would be interpreted before reaching `security`. Swap to execFileSync with an argv array. `security` receives the account name and service name as direct argv tokens — no shell, no string to escape. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced May 6, 2026
ivandobskygithub
approved these changes
May 7, 2026
ymajoros
pushed a commit
to ymajoros/switchboard
that referenced
this pull request
Jun 4, 2026
…s-collection feat(stats): collect token/tool/message metrics for the stats screen
aaaronmiller
pushed a commit
to aaaronmiller/switchboard
that referenced
this pull request
Jun 4, 2026
- Path sandbox restored for read/save-file-for-panel with symlink resolution via fs.realpathSync (FULL-AUDIT #4/doctly#32 + IMPROVEMENTS B6). Allowed roots: Claude data dirs + active session project paths. Blocked reads are logged. - Restored the missing watch-session-file / unwatch-session-file IPC handlers (lost in refactor) — tails session JSONL and emits session-activity events for cross-CLI sparklines — and clean them up on PTY exit (B4: no watcher leak). - MCP openDiff now times out after 5 min so an unanswered diff can't pin the RPC open forever (B7); timeout resolves as DIFF_REJECTED + closes the tab. - set-setting validates key/shape/size (rejects non-object or >256KB) (doctly#35). - get-agent-stats returns errorMessage instead of a silent error flag (B10). https://claude.ai/code/session_012RHiNTayAUjwj9byNCwhwh
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.
Fixes a shell injection in the schedule runner plus three related issues.
Scheduler injection (high).
buildScheduleCommandstring-concatenated YAML frontmatter values from.claude/commands/schedule-*.mdinto abash -ccommand. A maliciousschedule-*.mdin a cloned repo could gain code execution within 60s of opening the project.Example payload that previously worked:
Fix.
buildScheduleCommandnow returns an argv array; a newquoteArgvForShellhelper shell-quotes each token per shell family (POSIX, PowerShell, cmd). Same treatment applied to the interactiveopen-terminalpath (worktreeName,addDirs, etc.) where the same pattern was fragile. Input validation rejects non-numericmax-budget-usdand control characters in scalar fields.Also fixed:
mode: 0o600(was world-readable with the auth token inside).claude-auth.jsswitched fromexecSync(shell) toexecFileSync(argv) so$USERis no longer interpolated into a shell string.Test plan
npm test— 11/11 pass (10 new injection tests)schedule-test.mdstill runs end-to-endstat -f %Mp%Lp ~/.claude/ide/<port>.lockreports600