-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Project
cortex
Description
cortex mcp add allows newline characters in stdio command arguments. These newlines are written into config.toml without escaping, which corrupts the TOML and breaks subsequent MCP operations.
Reference: cortex-cli/src/mcp_cmd/validation.rs validate_command_args only checks for null bytes, not control characters/newlines. handlers.rs writes args with only backslash/quote escaping.
Error Message
After writing config, later commands such as cortex mcp list or cortex mcp get <name> fail to parse config.toml.
Debug Logs
N/A
System Information
Bounty Version: 0.1.0
OS: Ubuntu 24.04 LTS
CPU: AMD EPYC-Genoa Processor (8 cores)
RAM: 15 GBScreenshots
No response
Steps to Reproduce
- Run:
cortex mcp add newline-test -- printf $'hello\nworld'
- Inspect
~/.cortex/config.tomland observe theargs = ["helloline is split by a literal newline. - Run:
cortex mcp list(or any command that reads the config). - Observe a TOML parse error.
Expected Behavior
Newlines in command arguments should be rejected or safely escaped so the config remains valid.
Actual Behavior
Newlines are accepted and written directly into TOML, corrupting the config.
Additional Context
This is similar to the existing newline handling issue for env values, but affects command arguments.