跳到主内容
@wquguru
精选88Claude Code(GitHub Releases)AI 编程与模型

Claude Code v2.1.309:修复沙箱绕过、MCP配置泄露及多项权限检查漏洞

v2.1.309

原文
发到 X
推荐理由

本次更新包含多个严重的安全与权限绕过漏洞(如沙箱逃逸、MCP配置泄露),直接影响代码安全与隔离性。建议开发者立即升级至v2.1.309以修补这些高危缺陷,特别是使用沙箱或MCP集成的用户。

What's changed

变更内容

  • Fixed sandboxed Bash commands on macOS and Linux running the shell's startup files outside the sandbox before each command
  • Fixed macOS sandbox denyWrite glob patterns not applying at a path's real location when the pattern's folder is reached through a symlink
  • Fixed sandboxed commands and auto-accepted edits being able to modify the MCP config file passed with --mcp-config
  • Fixed a disabled MCP server being reconnected by a later permission prompt in print and SDK sessions
  • Fixed the Bash permission check trusting a variable set by a command whose redirect can fail to open
  • Fixed Bash permission checks not prompting for some compound commands that change directory before running git when the cd is wrapped or prefixed, as they do for a plain cd
  • Fixed an Edit(path) deny rule not blocking a Bash redirect to that path in some commands that also held a subshell
  • Fixed worktree-isolated sessions accepting some locale-prefixed commands the isolation guard should refuse
  • Fixed worktree-isolated sessions on zsh accepting some arithmetic commands that the isolation guard should refuse
  • Fixed worktrees and branch checkouts that Claude Code creates so they ignore git replace refs, as its other git operations already do
  • Fixed profile store write protection not applying when the config directory is reached through a symlink
  • Fixed sessions compacting repeatedly after reading files under a very large nested CLAUDE.md; a nested CLAUDE.md over the size limit now loads only its start
  • Fixed ctrl+enter (send now) only queuing a message when pressed before the response had started, and restarting a prompt's hooks while leaving the message queued when pressed while those hooks were running
  • Fixed key-bound slash commands running in the shell from ! mode
  • Fixed ctrl+o not showing messages from other agents and sessions that are still waiting to be delivered; they now appear in full under the transcript, marked as waiting
  • Fixed long tool output previews being cut through an emoji, leaving session transcripts that jq could not parse
  • Fixed Read reporting "File does not exist" for PDF page ranges in Linux sandboxes that share the parent's /proc
  • Fixed messages from a Claude Desktop-hosted session sometimes being lost when its connection refreshed
  • Fixed features missing from Claude Code sessions in the Claude desktop app when the terminal on the same computer was signed in to a different account or organization
  • Fixed the claude remote-control status line showing HEAD as the branch for a folder that is not in a git repository
  • Fixed split-pane agent teammates not inheriting the tool deny and --tools rules given on the leader's command line
  • Fixed sessions renamed with /rename appearing to other sessions under a generated name after a VS Code window reload or a non-interactive --resume
  • Fixed the /rewind list showing "No code changes" for a turn that changed checkpointed files through /code-review --fix, a subagent or a shell command
  • Fixed /privacy-settings showing an out-of-date "Help improve our AI models" value; it now also says when the setting can't be fetched
  • Fixed feedback saying "try again later" when your organization does not accept feedback; it now shows the server's reason and where to report a bug
  • Fixed oversized /feedback reports failing instead of being resent without the transcript
  • Fixed a skill in an --add-dir folder being unreachable when another skill already held its name; it is now offered as <folder>:<name>
  • Fixed /verify and /code-review not finding a nested package's own skill when its files were changed from the shell
  • Fixed the /claude-api skill saying that ant beta:worker poll --on-work passes trace context to the command
  • Fixed the /claude-api skill's C# tracing setup missing spans from the cloud platform clients
  • Fixed the /claude-api skill saying that API spans for requests to Claude Platform on AWS can't join the caller's trace
  • Fixed hooks that run in PowerShell not blocking when the hook's program exits with code 2, and on Windows PreToolUse and PermissionRequest hooks with "shell": "powershell" failing open when Git for Windows isn't installed
  • Fixed a mod's turn.step hook that names a model by alias, such as haiku, failing every request with a model error: the alias now resolves to its model
  • Fixed plugins and skills synced from claude.ai being removed, sometimes mid-session, after a disk read error
  • Fixed artifact publishes and updates being refused for some ordinary pages, such as pages with certain minified scripts or artifacts Claude could not read first
  • Fixed Claude asking for permission on each artifact update for the rest of a turn after the conversation was compacted in that turn
  • Fixed fine-grained tool streaming staying off on Amazon Bedrock when ANTHROPIC_BEDROCK_BASE_URL is set to the default bedrock-runtime.<region>.amazonaws.com endpoint
  • Fixed the "Waiting for API response" hint flickering behind gateways that send only keepalive pings: routes off Anthropic's backend now wait 45 seconds
  • Fixed Claude notifying unrelated GitHub users by writing role names and placeholders as mentions in PRs, issues and comments
  • Linux: Fixed sandbox write denies lifting when a background command outlived the session
  • Windows: Fixed PowerShell permission checks auto-approving some Set-Location or cd commands that target the current directory and carry extra arguments; these now prompt for approval
  • macOS: Fixed the "Install Command Line Developer Tools" dialog opening each time Claude Code starts on a Mac without Xcode or the Command Line Tools
  • Self-hosted runner: Fixed --startup-timeout-min stopping a session whose first prompt, such as /code-review, was still working in a subagent; a frozen process is still stopped
  • Improved the speed of many git commands Claude Code runs for itself on Windows; on every platform, errors from those commands now show in English even when git is set to another language
  • Improved the error when a hooks module is nested too deep to load: it now names the file instead of showing a bare stack-overflow message
  • Improved disk-full handling: a Bash command cut off by a full disk now says so and names the folder to free up, and starting on a full temp volume prints a clear message, not a raw ENOSPC error
  • Improved the /claude-api skill to offer API tracing alongside SDK tracing when asked to add OpenTelemetry
  • Improved the /claude-api skill to check the live docs before saying a feature is unsupported
  • Self-hosted runner: Improved sessions that move to a new runner: Claude now sees the tool call that was interrupted, marked as outcome unknown
  • Updated the bundled dataviz skill to accept APCA as a text-contrast measure (keeping WCAG 2 ratios where AA conformance is required), add an apca(text, background) function to its palette validator scripts, and say whether a label inside a colored chart fill should be white or near-black
  • Updated the /claude-api skill: service account keys and Workload Identity Federation tokens can now manage OpenTelemetry destinations
  • Changed sed -i to get the standard Bash prompt and run as written, not a simulated file-edit preview; like other Bash edits, it is no longer restored by /rewind
  • Changed claude ultrareview to require workspace trust: it asks on a terminal, else refuses; scripts pass --trust-workspace, which takes no value (put a PR number or base branch before it), or set CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK=1
  • Changed the dangerous rm and rmdir prompt in bypass permissions mode in the Desktop app and VS Code to deny the command at once with a rewrite hint, so unattended sessions keep going
  • Changed commands the settings exclude from the sandbox to ask before writing to its write-list paths while the sandbox is enabled but cannot run; the unsandboxed fallback is refused there
  • 修复了 macOS 和 Linux 上沙盒化 Bash 命令的问题,这些问题会在每次命令执行前在沙盒外运行 shell 的启动文件
  • 修复了 macOS 沙盒 denyWrite 通配符模式在通过符号链接到达该模式的文件夹时未应用于路径实际位置的问题
  • 修复了沙盒化命令和自动接受的编辑能够修改通过 --mcp-config 传递的 MCP 配置文件的问题
  • 修复了在 print 和 SDK 会话中,被禁用的 MCP 服务器会被后续的权限提示重新连接的问题
  • 修复了 Bash 权限检查错误地信任由重定向可能无法打开的命令设置的变量的问题
  • 修复了 Bash 权限检查未对某些复合命令进行提示的问题,这些命令在运行 git 之前会更改目录(cd 被包裹或作为前缀),而它们对于普通 cd 命令是会进行提示的
  • 修复了 Edit(path) deny 规则在某些同时包含子shell的命令中未能阻止对该路径的 Bash 重定向的问题
  • 修复了工作树隔离会话接受了一些隔离守卫本应拒绝的带有 locale 前缀的命令的问题
  • 修复了 zsh 上的工作树隔离会话接受了一些隔离守卫本应拒绝的算术命令的问题
  • 修复了 Claude Code 创建的工作树和分支检出忽略 git replace refs 的问题,正如其其他 git 操作所做的那样
  • 修复了当配置目录通过符号链接到达时,配置文件存储写入保护未应用的问题
  • 修复了会话在读取非常大的嵌套 CLAUDE.md 下的文件后反复压缩的问题;现在超过大小限制的嵌套 CLAUDE.md 仅加载其开头部分
  • 修复了 ctrl+enter(立即发送)仅在响应开始之前按下时才排队消息,以及在那些钩子运行时按下时重启提示钩子但将消息保留在队列中的问题
  • 修复了从 ! 模式在 shell 中运行的按键绑定的斜杠命令的问题
  • 修复了 ctrl+o 不显示来自其他代理和会话的消息的问题,这些消息仍在等待投递;现在它们在转录下方完整显示,并标记为等待状态
  • 修复了长工具输出预览因表情符号而被截断,导致会话转录无法被 jq 解析的问题
  • 修复了 Read 在共享父级 /proc 的 Linux 沙盒中对 PDF 页面范围报告“文件不存在”的问题
  • 修复了当其与 Claude Desktop 托管的会话的连接刷新时,有时丢失消息的问题
  • 修复了当同一台计算机上的终端登录到不同的账户或组织时,Claude 桌面应用中缺少 Claude Code 会话功能的问题
  • 修复了 claude 远程控制状态栏在非 git 仓库的文件夹中显示 HEAD 作为分支的问题
  • 修复了拆分窗格代理队友未继承主节点命令行中给出的工具拒绝和 --tools 规则的问题
  • 修复了使用 /rename 重命名的会话在 VS Code 窗口重新加载或非交互式 --resume 后,对其他会话显示为生成名称的问题
  • 修复了 /rewind 列表对于通过 /code-review --fix、子代理或 shell 命令更改了检查点文件的轮次显示“无代码更改”的问题
  • 修复了 /privacy-settings 显示过时的“帮助改进我们的 AI 模型”值;现在还会显示无法获取设置时的信息
  • 修复了当组织不接受反馈时反馈提示“请稍后再试”的问题;现在会显示服务器的原因以及报告 bug 的位置
  • 修复了过大的 /feedback 报告失败而不是在不包含转录的情况下重试发送的问题
  • 修复了当另一个技能已占用其名称时,--add-dir 文件夹中的技能不可用的问题;现在以 <folder>:<name> 形式提供
  • 修复了 /verify 和 /code-review 在文件从 shell 更改时找不到嵌套包自身技能的问题
  • 修复了 /claude-api 技能声称 ant beta:worker poll --on-work 将跟踪上下文传递给命令的问题
  • 修复了 /claude-api 技能的 C# 跟踪设置缺少云平台客户端的跨度(spans)的问题
  • 修复了 /claude-api 技能声称对 AWS 上 Claude 平台的请求 API 跨度无法加入调用者跟踪的问题
  • 修复了在 PowerShell 中运行的钩子在程序以代码 2 退出时不阻塞的问题,以及在 Windows 上 PreToolUse 和 PermissionRequest 钩子在使用 "shell": "powershell" 且未安装 Git for Windows 时未能正确打开的问题
  • 修复了 mod 的 turn.step 钩子使用别名(如 haiku)命名模型时每次请求都因模型错误而失败的问题;现在别名会解析为其对应的模型
  • 修复了由于磁盘读取错误,从 claude.ai 同步的插件和技能有时在会话中途被移除的问题
  • 修复了某些普通页面(例如包含某些最小化脚本或 Claude 最初无法读取的工件的页面)的工件发布和更新被拒绝的问题
  • 修复了在对话于该轮次被压缩后,Claude 在该轮次的其余部分每次工件更新都要求权限的问题
  • 修复了当 ANTHROPIC_BEDROCK_BASE_URL 设置为默认 bedrock-runtime.<region>.amazonaws.com 端点时,Amazon Bedrock 上的细粒度工具流式传输保持关闭的问题
  • 修复了在仅发送保活 ping 的网关后方,"等待 API 响应"提示闪烁的问题:现在 Anthropic 后端的路由将等待 45 秒
  • 修复了 Claude 通过在 PR、Issue 和评论中将角色名称和占位符作为提及对象来通知不相关的 GitHub 用户的问题
  • Linux:修复了当后台命令存活时间超过会话时,沙箱写入拒绝权限未解除的问题
  • Windows:修复了 PowerShell 权限检查自动批准某些针对当前目录并带有额外参数的 Set-Location 或 cd 命令的问题;这些命令现在会提示请求批准
  • macOS:修复了在没有安装 Xcode 或命令行开发工具的 Mac 上每次启动 Claude Code 时都打开"安装命令行开发者工具"对话框的问题
  • 自托管运行器:修复了 --startup-timeout-min 停止首个提示(如 /code-review)仍在子代理中处理的会话的问题;冻结的进程仍会被停止
  • 提高了 Claude Code 在 Windows 上为自己运行的许多 git 命令的速度;在所有平台上,即使 git 设置为其他语言,这些命令的错误信息现在也显示为英文
  • 改进了 hooks 模块嵌套过深无法加载时的错误提示:现在会指明文件名,而不是显示裸栈溢出消息
  • 改进了磁盘已满的处理方式:被磁盘满截断的 Bash 命令现在会说明情况并指出需要释放空间的文件夹,而在已满的临时卷上启动时会打印清晰的提示信息,而不是原始的 ENOSPC 错误
  • 改进了 /claude-api 技能,在要求添加 OpenTelemetry 时提供 API 追踪 alongside SDK 追踪
  • 改进了 /claude-api 技能,在声称某功能不受支持之前先检查实时文档
  • 自托管运行器:改进了迁移到新运行器的会话:Claude 现在能看到被中断的工具调用,其状态标记为结果未知
  • 更新了内置的数据可视化技能以接受 APCA 作为文本对比度度量标准(在需要 AA 合规性时保留 WCAG 2 比率),为其调色板验证脚本添加了 apca(text, background) 函数,并指示彩色图表填充内的标签应为白色还是近黑色
  • 更新了 /claude-api 技能:服务账号密钥和工作负载身份联合令牌现在可以管理 OpenTelemetry 目标端点
  • 将 sed -i 更改为获取标准的 Bash 提示并按原样运行,而不是模拟的文件编辑预览;与其他 Bash 编辑一样,它不再由 /rewind 恢复
  • 将 claude ultrareview 更改为需要工作区信任:它会在终端中询问,否则拒绝;脚本通过 --trust-workspace 传递参数,该参数不接收值(在它之前放置 PR 编号或基础分支),或者设置 CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK=1
  • 在桌面应用和 VS Code 的绕过权限模式中,更改了危险的 rm 和 rmdir 提示符,使其立即拒绝命令并给出重写提示,以便无人值守会话继续运行
  • 更改了从沙箱中排除的命令的设置,使其在沙箱启用但无法运行时,在写入其写列表路径前进行询问;此时拒绝使用未沙箱化的回退方案

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件