Linux: Secrets.ts set exits 1 after a successful write because keychainRead spawns the missing macOS security binary

未关闭 适合新手
#2,997 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
bun, macos, typescript
领域
backend

调研方向

阅读 LIFEOS/TOOLS/Secrets.ts,从第 94 行附近的 keychainRead 及其在第 327 行附近从 cmdSet 发起的调用开始。在 Linux 上使用 Secrets.ts set KEY 重现问题,并检查缺少 security 二进制文件时是否被视为没有封存身份。值成功写入、现有的“not sealed”提示出现且命令以退出码 0 结束时,即为完成。

由索引模型根据 Issue 内容生成。

描述

Version

LifeOS 8.761.0 · attestation: 1 system file(s) differ from danielmiessler/[email protected] · 8 system file(s) missing:

  • skills/LifeOS/SKILL.md
What is broken

On Linux, Secrets.ts set KEY writes the value to .env correctly and then exits 1 with Executable not found in $PATH: "security". After the write, cmdSet calls keychainRead() to decide whether to reseal, and keychainRead spawns the macOS security binary through run(). Bun.spawnSync throws ENOENT when the binary does not exist, instead of returning a non-zero exit, so the throw escapes before the intended "not sealed" message is printed. A user sees a failure for a key that was in fact stored, and any script that checks the exit code treats a good write as a failed one. Related: #2536 (no non-Keychain identity store on Linux); this report is narrower: the missing binary should read as "no seal identity", not crash.

Where (file:line)

LIFEOS/TOOLS/Secrets.ts:94 (keychainRead → run → Bun.spawnSync throws ENOENT), reached from cmdSet at :327

Repro on a clean tree
1. On Linux (no `security` binary), run `printf x | LIFEOS_SECRETS_ENV=/tmp/probe.env bun ~/.claude/LIFEOS/TOOLS/Secrets.ts set PROBE_KEY`.
2. Output: `✓ set PROBE_KEY in /tmp/probe.env (mode 600; value not shown)`, then on stderr `✗ Executable not found in $PATH: "security"`, exit 1.
3. `/tmp/probe.env` does contain the new PROBE_KEY line: the write succeeded and only the reseal check crashed.
4. Workaround: `LIFEOS_SECRETS_SECURITY_BIN=false` makes `keychainRead` get a non-zero exit, and `set` ends with the expected "not sealed" note and exit 0.
Negative control

Probe: cd "$PROBEDIR" && printf x | LIFEOS_SECRETS_ENV=probe.env bun ~/.claude/LIFEOS/TOOLS/Secrets.ts set PROBE_KEY · exit 1 · captured 2026-11-28T00:21:47.487Z

Red looks like: Executable not found in $PATH: "security"

✓ set PROBE_KEY in probe.env (mode 600; value not shown)

--- stderr ---
✗ Executable not found in $PATH: "security"
Suggested fix

Make keychainRead() return null when the security binary is missing (catch the ENOENT from run(), or check Bun.which(SECURITY_BIN) first), so a machine with no Keychain reads as "no seal identity". cmdSet then prints its existing "not sealed" note and exits 0. keychainWrite (used by init) should give a clear "macOS Keychain required, see #2536" error instead of a raw ENOENT.

Environment
  • OS: CachyOS (x64)
  • Harness: claude-code
  • bun: 1.4.5 · git: 2.56.1
  • Doctor broken: none
主要语言
TypeScript
星标
20k
派生
2.5k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

danielmiessler/LifeOS 的其他 Issue

查看 danielmiessler/LifeOS 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。