镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Claude FMA: skip _mbsetupuser and report chown failures - #55151

Merged
allenhouchins merged 1 commit into
mainfrom
allenhouchins/claude-fma-ownership-hardening
Oct 8, 2026
Merged

allenhouchins merged 1 commit into
mainfrom
allenhouchins/claude-fma-ownership-hardening

Conversation

@allenhouchins

@allenhouchins allenhouchins commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Related issue: N/A

Checklist for submitter

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.

Testing

  • QA'd all new/changed functionality manually

Ran the ownership block with stubbed stat/defaults/id/sudo across five cases: console user, console user with chown failing, _mbsetupuser from the lastUserName fallback, a real user from the fallback, and no user. Each produced the expected command and message. bash -n passes and go test ./ee/maintained-apps/... passes. Not run on a real Mac.

AI

AI: Claude Code (claude-opus-5-5)

Summary

Applies two hardening fixes from the Wispr Flow FMA review (#54708) to the Claude FMA's install script, which uses the same ownership step (#51680):

  • Reject _mbsetupuser after the lastUserName fallback, not only when it's the console user, so the bundle is never assigned to the Setup Assistant account.
  • Only log that ownership was assigned when chown succeeds. A failure logs a message but doesn't fail the install: the app is installed correctly, and a root-owned bundle is the behavior before chown Claude.app to console user so Claude Desktop auto-updates keep working #51680.

Regenerated ee/maintained-apps/outputs/claude/darwin.json with go run ./cmd/maintained-apps --slug=claude/darwin. Only the install script ref changed; the version, queries, and uninstall script are untouched.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Claude for macOS installation ownership handling. The installer avoids assigning ownership to the system setup account and reports whether ownership was updated.
    • If ownership cannot be updated, installation continues and Claude prompts the user to resolve the issue.

Reject _mbsetupuser even when it comes from the lastUserName fallback,
and only log that ownership was assigned when chown succeeds.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 18:14
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Script Diff Results

ee/maintained-apps/outputs/claude/darwin.json

=== Install // 98321e4d -> 57886481 ===

--- /tmp/old.Ai1fY1	2026-10-08 18:15:36.314939418 +0000
+++ /tmp/new.ykbfo4	2026-10-08 18:15:36.314939418 +0000
@@ -122,9 +122,12 @@
   # last user that logged in.
   target_user=$(defaults read /Library/Preferences/com.apple.loginwindow lastUserName 2>/dev/null)
 fi
-if [[ -n "$target_user" && "$target_user" != "root" ]] && id -u "$target_user" >/dev/null 2>&1; then
-  sudo chown -R "$target_user":staff "$APPDIR/Claude.app"
-  echo "Assigned ownership of Claude.app to '$target_user' so Claude can auto-update."
+if [[ -n "$target_user" && "$target_user" != "root" && "$target_user" != "_mbsetupuser" ]] && id -u "$target_user" >/dev/null 2>&1; then
+  if sudo chown -R "$target_user":staff "$APPDIR/Claude.app"; then
+    echo "Assigned ownership of Claude.app to '$target_user' so Claude can auto-update."
+  else
+    echo "Failed to assign ownership of Claude.app to '$target_user'; Claude will prompt the user to fix ownership before it can auto-update."
+  fi
 else
   echo "No logged-in (or last logged-in) user found; Claude.app stays owned by root and Claude will prompt the user to fix ownership before it can auto-update."
 fi

=== Uninstall Script (no changes) ===

Copilot AI 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.

🟡 Changes recommended

The user-visible bug fix is missing the required changes file.

1 open finding
What changed in this PR

Hardens Claude’s macOS maintained-app installer ownership handling.

Changes:

  • Excludes _mbsetupuser after fallback user resolution.
  • Reports chown failures accurately and regenerates the manifest reference.
File Description
claude-install.sh Improves ownership validation and failure reporting.
darwin.json Embeds the regenerated installer script and hash.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@allenhouchins
allenhouchins merged commit 962099f into main Oct 8, 2026
17 of 18 checks passed
@allenhouchins
allenhouchins deleted the allenhouchins/claude-fma-ownership-hardening branch October 8, 2026 18:20

This branch was previously deployed

1 inactive deployment
Docker Hub — ea07a523 Deployed Oct 8, 2026 by allenhouchins via publish #108255
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.

3 participants