Skip to content

fix(cli): reject control chars in mcp stdio command args#146

Open
hechibing wants to merge 1 commit intoCortexLM:mainfrom
hechibing:fix/mcp-args-control-chars-11213
Open

fix(cli): reject control chars in mcp stdio command args#146
hechibing wants to merge 1 commit intoCortexLM:mainfrom
hechibing:fix/mcp-args-control-chars-11213

Conversation

@hechibing
Copy link

Summary

  • reject control characters (including newline and carriage return) in �alidate_command_args
  • keep tab (\t) behavior unchanged
  • add regression tests for \n and \r inputs

Why

cortex mcp add previously accepted newline characters in stdio command args and wrote them into ~/.cortex/config.toml unescaped, which could corrupt TOML parsing.

Validation

  • cargo check -p cortex-cli
  • cargo test -p cortex-cli test_validate_command_args -- --nocapture

Related bounty report: PlatformNetwork/bounty-challenge#11213

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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