PulseAugur
实时 05:43:54
English(EN) My claude -p Call Has a --safe-mode Flag for Isolation. It Never Isolated the Two API Keys Sitting Right Next To It.

Claude API 子进程继承了敏感环境变量,尽管有 --safe-mode

一位开发者在其项目中发现了一个使用 Claude API 的安全漏洞,其中 `--safe-mode` 标志未能阻止敏感环境变量(特别是 GitHub 和 Dev.to API 密钥)暴露给子进程。这是因为 Python 的 `subprocess.check_output` 默认会继承父进程的环境变量,而这些密钥在导入时已加载到环境中。开发者创建了一个使用伪 Claude 二进制文件的最小复现案例,以证明即使启用了 `--safe-mode`,密钥仍然可见,这表明该标志仅隔离配置发现,而不隔离环境变量继承。 AI

影响 强调了通过子进程调用集成 AI 模型时潜在的安全风险,并强调了仔细管理环境变量的必要性。

排序理由 该条目描述了工具实现中的一个特定安全缺陷(Claude API 子进程调用),而不是新版本发布或重要的行业事件。

在 dev.to — Claude Code tag 阅读 →

AI 生成摘要 · Google Gemini · 来自 1 个来源。 我们如何撰写摘要 →

Claude API 子进程继承了敏感环境变量,尽管有 --safe-mode

报道来源 [1]

  1. dev.to — Claude Code tag TIER_1 English(EN) · Enjoy Kumawat ·

    我的 claude -p 调用有一个 --safe-mode 标志用于隔离。它从未隔离过紧挨着它的两个 API 密钥。

    <p>Four days ago I fixed a real problem in this repo: a bare <code>claude -p</code> invocation from <code>git_commit.py</code> was loading this project's own <code>CLAUDE.md</code> into a one-shot commit-message completion that had no use for it — including a "MANDATORY routing r…