Skip to content

fix(launcher): create desktop-runtime-v1.json with mode 0600 on non-Linux Unix - #1004

Merged
BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
ump45nose:pr/macos-descriptor-mode
Nov 21, 2026
Merged

BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
ump45nose:pr/macos-descriptor-mode

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Purpose

desktop-runtime-v1.json carries the launcher's control port and nonce. On Linux it is already written privately, but on macOS (and other non-Linux Unix) it was created with umask defaults, typically 0644, so any local user could read the nonce.

This creates the temporary descriptor with mode(0o600) on non-Linux Unix before the atomic rename. Windows and Linux paths are unchanged.

Validation

  • Added unix_runtime_descriptor_is_created_with_private_mode (non-Linux Unix).
  • cargo test -p codexhost-launcher --bins unix_runtime_descriptor_is_created_with_private_mode passes on macOS; with the options.mode(0o600) line removed it fails (420 vs 384, i.e. 0644 vs 0600).
  • cargo fmt --check clean.

ump45nose added a commit to ump45nose/codex-host that referenced this pull request Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Summary

Summary by CodeRabbit

  • 修复
    • 非 Linux 的 Unix 系统上,运行时描述符临时文件现使用更严格的访问权限,限制为仅文件所有者可读写。

非 Linux Unix 平台创建运行时描述符临时文件时,现在显式设置 0o600 权限。新增测试检查文件权限。非 Unix 平台仍使用原有创建选项。

Changes: 描述符文件权限

Layer / File(s) Summary
设置并验证文件权限
crates/launcher/src/runtime_instance.rs
非 Linux Unix 平台创建描述符临时文件时使用 0o600 权限。测试读取文件权限并断言其为 0o600。

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai, xwilludelu

Merge Risk: Low · previous review 40b71

This change makes the runtime descriptor private (mode 0600) on non-Linux Unix, closing the default-permission exposure of the launcher nonce. A residual case remains where a non-default inheritable ACL on a macOS user's home tree could still grant other users read access. That case is unlikely and can be handled as a follow-up.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题描述了主要变更:在非 Linux Unix 平台上以 0600 权限创建 desktop-runtime-v1.json。该标题与变更集和 PR 目标一致,且指出了具体平台与权限。
Description check Passed 描述说明了问题原因:在 macOS 及其他非 Linux Unix 上,描述符文件以默认 umask(通常为 0644)创建,本地其他用户可读取 nonce。描述也说明了修改方式(在原子重命名前设置 mode(0o600))、Windows 与 Linux 路径不变,并给出了测试与验证步骤。与变更集直接相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1

crates/launcher/src/runtime_instance.rs-257-257: 1

257-257: Major · Security & Privacy · Heavy lift

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

防止继承的 ACL 暴露 nonce。

在 macOS 上,如果父目录有允许其他用户读取的可继承 ACL,临时文件会继承该 ACL。即使权限位是 0600,ACL 仍可允许其他用户读取文件;rename 后也是如此。Apple 的文档说明了 ACL 继承和访问检查顺序。(developer.apple.com)

请在写入 nonce 前确保文件位于不授予其他用户访问权限的目录中,并处理继承的 ACL。只在写入后删除 ACL 会留下暴露窗口。

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ae460a9 and 40b71da.

Files selected for processing: 1

  • crates/launcher/src/runtime_instance.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Vitest
  • GitHub Check: Check windows-latest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Web Host tests
  • GitHub Check: Check macos-26
  • GitHub Check: Static checks
Additional context used

Code guidelines: 2

CLAUDE.md — auto-discovered
AGENTS.md — auto-discovered
Path-based instructions: 2

Source excerpt: Rust owns native launch, process management, update installation, and platform integration.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • crates/launcher/src/runtime_instance.rs
Source excerpt: Follow `docs/project/领域术语表.md`; in particular, do not conflate Harness, Model, Provider, Account, or Billing Source.

CodeRabbit inference engine (AGENTS.md)

Files:

  • crates/launcher/src/runtime_instance.rs

@BytePioneer-AI
BytePioneer-AI merged commit 2dd2c0e into BytePioneer-AI:main Nov 21, 2026
@BytePioneer-AI

Copy link
Copy Markdown
Owner

感谢贡献!已帮忙合并最新 main 解决 runtime_instance.rs 与 #1019 的轻量上下文冲突并通过 cargo fmt/严格 clippy/runtime_instance 权限单测,现已合并。

ump45nose added a commit to ump45nose/codex-host that referenced this pull request Nov 27, 2026
Eleven manifest lines still carried fork copies of changes that upstream has
already released. Each one names a merged PR whose head commit is an ancestor
of v0.28.2, so the line only re-applies the pre-review copy of code that the
release tag already contains, and that duplication is what turns the manifest
replay into conflicts.

Removed lines and their merged PRs:

- thin/cursor-fast-selection (BytePioneer-AI#782)
- thin/delegation-inspect-fast-models (BytePioneer-AI#986)
- thin/delegation-catalog-parent (BytePioneer-AI#970)
- thin/settings-hide-desktop-envs (BytePioneer-AI#972)
- thin/settle-turns-after-session-fault (BytePioneer-AI#969)
- thin/external-thread-turn-recency (BytePioneer-AI#973)
- thin/claude-code-todo-tools (BytePioneer-AI#976)
- thin/reasoning-summary-parts (BytePioneer-AI#967)
- thin/shared-archived-thread-revival (BytePioneer-AI#988)
- fix/desktop-mcp-session-reap-v0.22 (BytePioneer-AI#981)
- fix/macos-descriptor-mode (BytePioneer-AI#1004)

For the two lines whose comments noted that the fork copy predated the PR's
review changes (BytePioneer-AI#969, BytePioneer-AI#976), the reviewed upstream version replaces it.

Checked with `scripts/vincent-release.sh audit` (ancestor and patch-cherry
checks) and by replaying the manifest onto v0.28.2 in a scratch worktree: these
eleven lines no longer merge, and the fifteen remaining lines are fork-only
changes that need re-cutting from the new tag.

Lines for fork-only additions are untouched: the extras documented for BytePioneer-AI#470,
BytePioneer-AI#987 and BytePioneer-AI#989 stay, and the lines for the closed PRs BytePioneer-AI#576, BytePioneer-AI#783, BytePioneer-AI#784, BytePioneer-AI#785 and
BytePioneer-AI#396 stay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants