Generated with the help of an LLM (Claude Code); I reviewed and tested it.

Problem/Motivation

Prompts sent through this provider can carry text from site content or visitors. The default presets left the CLI tools' own tools available: Claude Code could read files, run commands and use MCP servers, and in DDEV the relay started every tool in the user's home directory. A prompt injection could therefore read files from the developer's machine. I confirmed this: with Read available, Claude read a canary file from the working directory when asked to.

Proposed resolution

  • New presets that turn off or sandbox each tool's own tools:
    • Claude: --tools= (no tools), --strict-mcp-config, --permission-prompts none, --no-session-persistence. With attachments only --tools Read plus --add-dir for the attachment folder.
    • Codex: read-only sandbox, shell, apps, plugins, browser and web search disabled, ephemeral, no user config.
    • Gemini CLI: plan approval mode, no extensions, no MCP servers.
  • Host mode runs each tool in a new empty private directory. Relay mode needs ddev-cli-relay v1.2.0, which does the same (release).
  • ai_provider_cli_update_10002 switches tools still on the old default flags to the new ones and lists customized tools for review.
  • Status report entries: the execution mode (with a warning when a non-DDEV container is detected in auto mode), relay reachability, version and isolation, and a warning for enabled tools whose flags turn off their approvals or sandbox (--dangerously-skip-permissions, --yolo, --full-auto and so on). The settings form shows the same warnings.

Tested with live Claude calls: no file access without attachments, only the attachment folder with them, and a prompt injection through the site neither leaked the canary nor created a file.

Remaining tasks

  • Review the MR.
  • Codex behavior with the new flags is untested (expired login); Gemini CLI needs an API key now, so its flags are checked for acceptance only.

User interface changes

Two new status report entries; warnings on the settings form.

API changes

None.

Data model changes

Update hook 10002 changes the default tool flags in ai_provider_cli.settings.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aangel created an issue. See original summary.

aangel’s picture

Status: Active » Needs review

MR !8 is ready for review. The pipeline passes: phpunit, phpcs, phpstan, cspell, eslint and composer. Relay mode needs ddev-cli-relay v1.2.0, released today.