AI 编程 4.0 · 优秀 2026-11-26 · 文章

Don't Ask Again writes plaintext keys into Claude Code settings.local.json

Hacker News 新头号:Claude Code 选Yes, and don't ask again时整条 shell 原样进 .claude/settings.local.json 的 allow 规则,明文密钥随之落盘Apiiro 公开扫描:约 10.4 万份该文件副本公开可见,约 1122 份含真实密钥Boris Cherny 回应称文件本意只留本机创建时即 gitignore,正评估 secret scrubbing;评论强调暴露链是提交了带密钥的 allow 规则而非按钮本身实操:密钥走环境变量或密码管理器 CLI,全局 gitignore 并排查公开仓库误提交

打开原文回到归档

Don't Ask Again writes plaintext keys into Claude Code settings.local.json

  • ID: 7509cc71
  • 原文链接: https://news.ycombinator.com/item?id=50407882
  • 作者: HN discussion; Apiiro stats, bcherny response
  • 日期: 2026-11-26
  • 更新: N/A
  • 分类: coding
  • 来源类型: article
  • 标签: claude-code, secrets, security, settings
  • 质量评分: 4/5
  • 抓取时间: 2026-11-26T15:44:07Z

中文导读

Hacker News 新头号:Claude Code 选Yes, and don't ask again时整条 shell 原样进 .claude/settings.local.json 的 allow 规则,明文密钥随之落盘Apiiro 公开扫描:约 10.4 万份该文件副本公开可见,约 1122 份含真实密钥Boris Cherny 回应称文件本意只留本机创建时即 gitignore,正评估 secret scrubbing;评论强调暴露链是提交了带密钥的 allow 规则而非按钮本身实操:密钥走环境变量或密码管理器 CLI,全局 gitignore 并排查公开仓库误提交

为什么值得关注

Claude Code's Don't Ask Again stores whole commands with plaintext keys in settings.local.json; ~1122 public copies have keys

HN used as discovery; substance grounded in the last30days 2026-11-26 brief which hydrated the thread and named comments (Apiiro counts, u/bcherny response, mitigation advice).

关键信息

  • 标题: Don't Ask Again writes plaintext keys into Claude Code settings.local.json
  • 作者: HN discussion; Apiiro stats, bcherny response
  • 链接: https://news.ycombinator.com/item?id=50407882
  • 发布时间: 2026-11-26
  • 分类: coding
  • 关联标签: claude-code, secrets, security, settings

English Summary

Hacker News top story (~629 points, 433 comments): choosing 'Yes, and don't ask again' in Claude Code stores the entire shell command - including plaintext secrets - as an allow rule in .claude/settings.local.json. Apiiro's public scan found about 104,000 copies of that file visible on GitHub, roughly 1,122 containing real credentials. Claude Code's Boris Cherny (u/bcherny) responded that the file is intended to stay local, is gitignored at creation, and secret scrubbing is being evaluated; commenters stress the actual exposure chain is committing an allow rule that embeds a key, not the button itself. Practical response: keep secrets in environment variables or password-manager CLIs, gitignore the path globally, and audit public repos for committed copies.

Source Excerpts

last30days brief 2026-11-26 (Hermes 定时任务/last30days)

机制:选 Yes, and don't ask again 时,整条 shell(含明文密钥)会进 .claude/settings.local.json 的 allow 规则;Apiiro 在公开 GitHub 上扫到约 10.4 万份该文件副本,其中约 1122 份带真实密钥。Claude Code 团队的 Boris(u/bcherny)说文件本意只留本机、创建时会 gitignore,并在看 secret scrubbing;u/Aurornis 强调提交了带明文密钥的 allow 规则才是暴露链。实操:全局 gitignore 该路径,密钥只走环境变量或 op 一类 CLI,再搜公开仓有没有误提交。