Skip to content

Fix macOS CLI symlink permissions - #19881

Closed
hbjk1030-cmyk wants to merge 1 commit into
stablyai:mainfrom
hbjk1030-cmyk:hbjk1030-cmyk/macos-cli-symlink-permissions
Closed

hbjk1030-cmyk wants to merge 1 commit into
stablyai:mainfrom
hbjk1030-cmyk:hbjk1030-cmyk/macos-cli-symlink-permissions

Conversation

@hbjk1030-cmyk

@hbjk1030-cmyk hbjk1030-cmyk commented Sep 10, 2026 •

Copy link
Copy Markdown

ELI5

Registering the Orca CLI on macOS could create a link that only root could inspect. This keeps the private transaction directories locked down while publishing the final /usr/local/bin/orca symlink with normal executable-link permissions.

What Changed

  • Create the staged launcher symlink under a scoped umask 022.
  • Keep the transaction and publication directories under the existing umask 077.
  • Assert the published symlink mode in the real macOS transaction test.

Why

The transaction-wide umask 077 also applied to the symlink itself on macOS, producing mode 0700. Non-root users could then receive EACCES from readlink and the CLI launcher could not resolve the app path.

Linked Issue

Fixes #19120

Visual Proof

N/A — no UI or interaction layout changes; this corrects filesystem permissions for CLI registration.

Testing

  • pnpm test src/main/cli/cli-command-privileged-transaction.test.ts (4/4)
  • pnpm run check:code-quality:changed
  • pnpm tc:node
  • pnpm lint
  • pnpm typecheck
  • pnpm build on macOS
  • I manually verified the installed /usr/local/bin/orca link is readable and orca status --json succeeds
  • Automated tests added/updated

The repository-wide Vitest run reports five environment-dependent failures unrelated to this change. All five reproduce on this branch's baseline checkout: one shell recipe cleanup assertion, two installed Claude structured CLI expectations, one Claude trust prompt integration, and one installed Claude path expectation. CI will provide the clean-environment full-suite result.

AI Disclosure

OpenAI Codex (GPT-5) was used to inspect, implement, test, and review the change.

Review

  • Security: transaction/quarantine directories remain 0700; only the published symlink uses 022, and foreign command replacement guards are unchanged.
  • Cross-platform: the changed transaction is macOS-only; Linux and Windows paths are untouched.
  • SSH/remote/local: this affects only local macOS CLI registration and does not change remote wire behavior.
  • Agents/integrations/mobile: no agent, provider, integration, or mobile behavior changes.
  • Performance: one scoped subshell runs only during CLI install/update, with no steady-state cost.
  • Backward compatibility: command path, target, transaction, and rollback semantics are unchanged.

Agent skill upstream boundary

  • Not applicable.

Author

X (Twitter): N/A

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Visual proof marked N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and compatibility impact considered
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build all pass locally (lint/typecheck/build pass; full-suite baseline failures documented above; CI pending)

@hbjk1030-cmyk
hbjk1030-cmyk marked this pull request as ready for review September 10, 2026 11:41
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ea0dbc3c-6960-4dc7-9523-c33a74cf5739

📥 Commits

Reviewing files that changed from the base of the PR and between f2d5711 and 3cc1100.

📒 Files selected for processing (2)
  • src/main/cli/cli-command-filesystem-transaction.ts
  • src/main/cli/cli-command-privileged-transaction.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The macOS privileged install transaction now creates the launcher symlink under umask 022. The test suite verifies that the installed symlink has mode 0o755. This prevents the published /usr/local/bin/orca symlink from inheriting restrictive permissions from the staging transaction.

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 3cc11

The macOS installer now publishes a readable CLI symlink while keeping transaction directories private, with a test covering the resulting mode. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The change fixes the reported 0700 symlink root cause and adds a 755 mode assertion. The provided change summary does not show implementation or test coverage for handling an already-unreadable symlin… Add or verify logic that treats EACCES from an existing CLI symlink as stale, then add a regression test covering replacement or status handling for an already-unreadable symlink.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the macOS CLI symlink permission fix and matches the main code change.
Description check ✅ Passed The description includes the required sections, explains the cause and solution, documents testing, records known full-suite baseline failures, and addresses scope and compatibility.
Out of Scope Changes check ✅ Passed The changes are limited to macOS privileged CLI symlink creation and its focused regression test. No unrelated product, platform, or behavior changes are shown.
Full details: Linked Issues check

Explanation

The change fixes the reported 0700 symlink root cause and adds a 755 mode assertion. The provided change summary does not show implementation or test coverage for handling an already-unreadable symlink as stale during status checks or re-registration.

  • Fix all pre-merge checks with AI

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

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Scoped umask for the published symlink — wraps the ln -s that creates the staged symlink in (umask 022; …) in buildMacPrivilegedSymlinkTransaction, so the transaction-wide umask 077 no longer yields a mode 0700 symlink on macOS (where symlinks honor umask). Transaction and publish directories stay 0700.
  • Regression assertion — the real macOS transaction test now asserts the published command path resolves via lstat to permission bits 0o755.

The fix is minimal and correct. The subshell preserves the && short-circuit (its exit status is ln's), and the parent shell's umask is unaffected after it exits, so the subsequent /bin/ln -P hard-link and directory cleanup run under the original 077. The final command path inherits the 0755 inode through the hard link. The assertion is meaningful — pre-fix the symlink was 0700 and this test would fail — and it correctly uses lstat (not stat) with a 0o777 mask to drop the file-type bits. Linux and Windows paths are untouched, and the existing toContain('ln -s') assertion still matches the parenthesized command.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @hbjk1030-cmyk for the focused umask fix and the macOS permissions regression test.

The team's fix for #19120 has now merged in #29245, covering new registrations and recovery for existing unreadable links. Closing this PR as superseded. Thank you for contributing!

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.

[Bug]: macOS CLI registration creates a 0700 /usr/local/bin/orca symlink; Settings crashes with EACCES on readlink

2 participants