Validate planner model names and run CLI planners without tools

Open
#306 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli, security

Research direction

Read fm9/ai_settings.py and fm9/planner.py to trace where saved model names are accepted and passed to the Claude and Grok CLI commands. Add tests for save-time and call-time validation, including the listed shell characters, and tests that pin each CLI backend’s exact arguments. Done means invalid names are refused with a clear message and each CLI invocation disables tools, without changing backend selection or API backends.

Written by the indexing model from the issue text.

Description

Found while reviewing #303. These predate that PR and apply to the existing command-line planner backends (Claude CLI, Grok CLI), so they are fixed app-wide here rather than in a contributor PR.

1. The saved model name reaches the command line unchecked.
fm9/ai_settings.py stores whatever text the AI settings form sends as the model, and fm9/planner.py passes it after --model. On Windows, when shutil.which() resolves an npm-installed CLI to a .cmd wrapper, subprocess runs it through cmd.exe, where &, | and similar characters in that argument are not neutralised by shell=False. A model name such as x&calc would then run a second command. The settings route is local-only since #291, so this needs access to the machine, but it should still be closed.

Fix: validate model names on save and again before use against a strict pattern (letters, digits, ., -, _, :, /, bounded length), and refuse anything else with a clear message.

2. CLI planners are not restricted to answering.
The Claude CLI is run with -p and no tool restriction, so it may use its read-only tools (file reads, search) on the player's machine during planning. A planning request, or reference text pasted into one, could steer it to read local files into the model context. The planner only needs a text answer.

Fix: run each CLI backend with tools disabled (or the narrowest documented equivalent for that CLI), and cover each with a test that pins the exact arguments.

Acceptance

  • Model names outside the allowed pattern are refused on save and at call time, with tests including &, |, ^, %, quotes and newlines.
  • Each CLI backend's argument list includes its tool restriction, pinned by tests.
  • No change to which backend is chosen or to API-based backends.
Dominant language
Python
Stars
7
Forks
3
Avg merge
4h 26m
Merged PRs (30d)
48

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from monzta1/ToneCommand

All issues in monzta1/ToneCommand

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.