Skip to content

fix(install): accept user-private-group 0775 for canonical link parents - #2873

Merged
namastex888 merged 1 commit into
devfrom
fix/install-link-upg-perms
Aug 31, 2026
Merged

namastex888 merged 1 commit into
devfrom
fix/install-link-upg-perms

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

Fresh-install blocker reported 2026-08-31: curl … install.sh | bash on a stock Debian/Ubuntu box (user-private groups, umask 002) dies with CanonicalInstallLinkError: ~/.local/bin is not current-user-owned with safe permissions plus a raw Bun stack — ~/.local/bin is 0775 <user>:<user> there and assertSafeOwnedDirectoryStat rejected any group-write bit.

  • New exported classifyOwnedDirectorySafety: group-write allowed only when the dir's gid == process egid (user-private-group layout, as private as 0755); world-write, foreign-group write, wrong owner, nlink<1 stay rejected — each with an actionable remedy (chmod g-w/chmod o-w/chown) naming the actual mode/uid/gid.
  • genie install-promote prints CanonicalInstallLinkError/InstallPromoteCommandError cleanly and exits 1 — no stack trace to the operator.
  • Tests: pure verdict table (0755/0775 ok; 0775 foreign gid, 0777, uid-0 rejected) + a 0775 ~/.local(+bin) preflight integration accept; existing world-writable-ancestor rejections re-asserted on the new wording.
  • Repro: mode & 0o022 = 16 on a 0775 dir with uid and egid matching.

Gates: install-link + install-promote suites 27/27, typecheck, lint (3 pre-existing warnings), knip, complexity budget.

Workaround for affected boxes until this ships: chmod g-w ~/.local ~/.local/bin and re-run the installer.

🤖 Generated with Claude Code

https://claude.ai/code/session_013gGxGgKskzyzr1HRUB6cV3

…arents

Fresh installs on Debian/Ubuntu boxes with user-private groups
(umask 002) failed at the promote preflight: ~/.local/bin is created
0775 <user>:<user> there, and assertSafeOwnedDirectoryStat rejected any
group-write bit. New classifyOwnedDirectorySafety allows group-write
only when the directory's gid equals the process's effective gid — as
private as 0755 — while world-write, foreign-group write, and foreign
ownership stay rejected, each with an actionable message (chmod/chown
remedy) instead of the generic "safe permissions". The install-promote
command now prints those preflight errors cleanly and exits 1 instead of
escaping as a raw Bun stack trace.

Reported from a fresh linux box, 2026-08-31; reproduced with a 0775
fixture (mode & 0o022 = 16 despite uid and egid matching).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gGxGgKskzyzr1HRUB6cV3
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c0d25378-baea-471c-b118-47f52a666afd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T17:18:41.071700Z 0e2f5a9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e2f5a94d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/install-link.ts
if ((mode & 0o002) !== 0) {
return { ok: false, reason: `is world-writable (mode ${octal})`, remedy: 'run: chmod o-w <path>, then retry' };
}
if ((mode & 0o020) !== 0 && stat.gid !== identity.gid) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prove the effective group is private before accepting 0775

On systems where the user's effective group is shared, a 0775 parent has stat.gid === identity.gid even though other group members can rename or replace ~/.local/bin/genie. This condition therefore removes the previous protection and permits a local group member to substitute the executable reached through the user's PATH; matching the effective GID proves membership, not that this is a user-private group, so the relaxation must verify exclusivity or continue rejecting group-write permission.

Useful? React with 👍 / 👎.

@namastex888
namastex888 merged commit 2780f2c into dev Aug 31, 2026
19 checks passed
@namastex888
namastex888 deleted the fix/install-link-upg-perms branch August 31, 2026 17:19
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.

1 participant