将用户内容插入单引号 Shell 命令可能造成命令注入
原文依据:3 处示例把整个 JSON 放在 Shell 单引号中,但 Skill 没有展示如何安全处理提示词或 URL 中的单引号。文档声称 CLI 不展开提示词,却忽略了 Shell 会在 CLI 收到参数之前解析引号和元字符。
若代理直接替换示例中的值,包含单引号和 Shell 语法的提示词或 URL 可能逃逸 JSON 参数,并以用户权限执行额外命令。
这是可信的命令注入风险。示例要求代理把 JSON 直接放进 Shell 的单引号参数;若用户提示词或 URL 含单引号,Shell 会在 `runcomfy` 收到内容前结束引号并解释后续字符。文档关于 CLI 不展开内容的保证并不能保护这一阶段。风险仅在代理动态拼接并执行这种命令时出现;用户可要求使用不经过 Shell 拼接的参数传递方式或安全生成输入文件。
```bashruncomfy run tongyi-mai/z-image/turbo/inpainting \ --input '{ "prompt": "Remove overhead cables; preserve rooflines and sky gradient; thin clean sky.", "image": "https://your-cdn.example/street.jpg", "mask_image": "https://your-cdn.example/cables-mask.png", "strength": 0.5, "control_scale": 0.8 }' \ --output-dir ./out```查看另外 2 个位置
- **Token storage**: `runcomfy login` writes the API token to `~/.config/runcomfy/token.json` with mode 0600. Set `RUNCOMFY_TOKEN` env var in CI / containers.- **Input boundary (shell injection)**: prompts and image / mask URLs are passed as a JSON string via `--input`. The CLI does not shell-expand prompt content. **No shell-injection surface**.- **Indirect prompt injection (third-party content)**: source image and mask URLs are **untrusted**; embedded instructions can influence the fill. Agent mitigations:```bashruncomfy run tongyi-mai/z-image/turbo/inpainting \ --input '{ "prompt": "Remove overhead cables; preserve rooflines and sky gradient; thin clean sky.", "image": "https://your-cdn.example/street.jpg", "mask_image": "https://your-cdn.example/cables-mask.png", "strength": 0.5, "control_scale": 0.8 }' \ --output-dir ./out```