#5143·gsd-core

bug(workflows): ~27 workflow files splice "$ARGUMENTS" into double-quoted shell snippets, so a quote or $( in an argument runs as shell

Author: trek-eCreated Sep 30, 2026Updated Sep 30, 2026
Labelsbugneeds-triage

Pre-submission checklist

  • I have searched existing issues and this bug has not already been reported (searched "ARGUMENTS shell quoted injection workflow", all states: no results)

GSD Version

next (found while fixing #4780 on top of origin/next 48c1ef0d17)

Runtime

Multiple (specify in description)

Operating System

macOS

Node.js Version

n/a (workflow prompt text, not a Node code path)

Shell

bash / zsh

Installation Method

Updated from a previous version

What happened?

About 27 files under gsd-core/workflows/ (roughly 80 sites) interpolate the raw command arguments into a double-quoted shell position, for example echo "$ARGUMENTS" | grep ... in autonomous.md, plan-phase.md and quick.md. The runtime loader substitutes the typed text before the shell command is composed, so an argument containing ", $(...), a backtick or a newline can end the quotes and run as shell.

The same shape in commands/gsd/quick-batch.md (--text "$ARGUMENTS") was demonstrated to execute injected commands and is fixed in the #4780 PR (the text now goes through a quoted heredoc to a temp file and is read back via parse-args --stdin). No commands/ template other than quick-batch has the pattern; the workflows were left out of that PR because their runtime substitution behavior inside @-included files was not verified per runtime, and fixing them is a workflow-wide change with size-gate and emitted-attribution effects.

Counts come from the #4780 remediation pass and have not been independently re-counted.

What did you expect?

Command arguments reach shell snippets as data, never as shell syntax. Each workflow captures the arguments once through a quoted heredoc (or an equivalent non-interpolating route) and every later snippet reads that variable.

Steps to reproduce

  1. Pick a workflow that uses echo "$ARGUMENTS" | grep (for example gsd-core/workflows/quick.md).
  2. Invoke the command with an argument such as x"; touch /tmp/gsd-canary; echo ".
  3. Observe that the substituted text breaks out of the double quotes in the shell snippet, so the canary command runs.

Verify per runtime, since the substitution point differs between runtimes and between command files and @-included workflow files.

Error output / logs

No error: the injected command runs silently.

GSD Configuration

n/a

GSD State (if relevant)

n/a

Runtime settings.json (if relevant)

n/a

How often does this happen?

Every time (100% reproducible) for an argument containing an unescaped double quote, on runtimes that substitute before the shell runs.

Impact

Moderate — Feature is broken but I have a workaround (the operator typing the arguments is the local user, so this is self-inflicted injection; it matters when arguments come from pasted or untrusted text).

Workaround (if any)

Avoid quotes, $(, backticks and newlines in command arguments.

Additional context

Related: #4780 and its PR (labeled arguments block plus the quick-batch fix); ADR-4780 records this as a known limit. Any fix should coordinate with #4772, which edits 45 of the same workflow files.

Privacy Checklist

  • I have reviewed all pasted output for PII (usernames, paths, API keys) and redacted where necessary