Claude Agent SDK v0.2.158 新增 verbatim_prompts 防注入选项
v0.2.158
推荐理由
涉及 AI Agent 调用的安全性加固,建议开发者检查 prompt 来源,若存在不可信输入需开启 verbatim_prompts 以防止指令注入。
New Features
新功能
- verbatim_prompts option: Added ClaudeAgentOptions.verbatim_prompts (default False). When True, user messages are delivered to the CLI exactly as written — no @path file expansion and no slash-command dispatch. This prevents untrusted text inlined into prompts from triggering unintended file reads or command execution. Works with query(), ClaudeSDKClient.connect(), and ClaudeSDKClient.query() for both string and async-iterable prompts. Requires CLI 2.1.248+; a warning is logged on older CLIs. (#1269)
- verbatim_prompts 选项:新增 ClaudeAgentOptions.verbatim_prompts(默认 False)。当设为 True 时,用户消息将按原样传递给 CLI——不进行 @path 文件扩展,也不进行斜杠命令分发。这可以防止嵌入到提示中的不可信文本触发意外的文件读取或命令执行。适用于 query()、ClaudeSDKClient.connect() 和 ClaudeSDKClient.query(),支持字符串和异步可迭代提示。需要 CLI 2.1.248 及以上版本;在旧版 CLI 上会记录警告。(#1269)
Internal/Other Changes
内部/其他更改
- Updated bundled Claude CLI to version 2.1.280
- CI improvements: recompressed wheels and raised the PyPI pre-flight threshold (#1283)
- 将捆绑的 Claude CLI 更新至 2.1.280 版本
- CI 改进:重新压缩 wheel 包并提高 PyPI 预检阈值 (#1283)
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.158/
PyPI:https://pypi.org/project/claude-agent-sdk/0.2.158/
代码 · 1 行
pip install claude-agent-sdk==0.2.158代码 · 1 行
pip install claude-agent-sdk==0.2.158更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力