Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Jerry-Terrasse
Copy link

Problem

User input prompt (command in server/claude-cli.js:spawnClaude) was parsed as additional CLI options if it began with -. For example, --print --help would trigger the help screen instead of treating --help as text, causing unexpected behavior.

Reproduction

Open any session and send --help to Claude.

589e7ecff8db53809a2f0c07a8a5d7ae

In the console output we can see:

πŸ” Final Claude command will be: claude --print --help --output-format stream-json --verbose --mcp-config /home/user/.claude.json --model sonnet

Solution

Insert -- before the user-supplied command so it is always interpreted as a positional argument:

args.push('--print');
args.push('--');
args.push(command);

Fixed final command:

πŸ” Final Claude command will be: claude --output-format stream-json --verbose --mcp-config /home/user/.claude.json --model sonnet --print -- --help

This ensures user input is treated as plain text, preventing flag injection across platforms.

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.

1 participant