Repository navigation
fix(install): don't chown -R the shared PrivilegedHelperTools directory - #12
Open
Arpit-Khandelwal wants to merge 1 commit into
Open
Arpit-Khandelwal wants to merge 1 commit into
Arpit-Khandelwal wants to merge 1 commit into
Conversation
install-helper.sh recursively chowns the entire shared /Library/PrivilegedHelperTools directory. When another app has already installed a macOS-protected helper bundle there (e.g. ChromeRemoteDesktopHost.app, which carries a com.apple.macl attribute), chown returns "Operation not permitted" on those files. Under `set -euo pipefail` the script aborts right there — before it copies the LaunchDaemon plist and runs `launchctl bootstrap`. The helper binary and dylibs land on disk, but the daemon is never registered, so the install appears to finish while the helper stays permanently unreachable. Only chown/chmod the files this tool actually installs (the helper binary and its libtetherkit/libusb dylibs) instead of the entire shared directory. Other apps' helpers in the same directory are left untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gui/Scripts/install-helper.shrecursivelychowns the entire shared/Library/PrivilegedHelperToolsdirectory:chown -R root:wheel "${TOOLS_DIR}"That directory is shared by every app's privileged helper. If another app has already installed a macOS‑protected bundle there (e.g.
ChromeRemoteDesktopHost.app, whose files carry acom.apple.maclattribute that even root cannotchown), the recursivechownreturnsOperation not permitted. Because the script runs underset -euo pipefail, it aborts right there — before copying the LaunchDaemon plist and runninglaunchctl bootstrap.Net effect: the helper binary and dylibs land in place, but the daemon is never registered, so the install "finishes" while the helper stays permanently unreachable. Fixes #11.
Fix
Scope the ownership/permission changes to the files TetherKit actually installs — the helper binary and its
libtetherkit*/libusb-*dylibs — instead of recursively chowning the whole shared directory. Foreign helpers in the same directory are never touched, so their protection can no longer abort our install.Notes:
chmod 755 "${TOOLS_DIR}"is kept (non‑recursive) to preserve the launchd requirement that the directory not be group/other‑writable.chown -hso thelibtetherkitsymlinks are handled as links, consistent with thecp -acopy above.chmod 444findis narrowed to our own dylib names so it can't touch a foreign*.dylib.Testing
Reproduced the failure and verified the fix in isolation (no root required) by placing a user‑immutable (
chflags uchg) file inside a decoy bundle in a tempTOOLS_DIR— a faithful stand‑in for acom.apple.macl‑protected foreign helper, since both reject a real ownership change withEPERM:chown -Rfaults on the decoy → script aborts (exit 1) → plist step never reached.chowncompletes (exit 0) → plist step reached → decoy left untouched.bash -npasses on the modified script.