Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for running framework and CLI as root #2119

Merged
merged 12 commits into from
May 7, 2022
Merged

Conversation

zorgiepoo
Copy link
Member

@zorgiepoo zorgiepoo commented May 5, 2022

We add support for running the framework and sparkle-cli as root by ensuring we launch the installer in the system domain, and launch the updater progress tool agent in the user domain.

When running as the root user, there is also no need to attempt authorization or show a prompt. We also need to fetch the agent user name and home directory so we can pass that when running guided package installations with custom scripts.

Rather than explicitly specifying what user to "drop down" to for the agent, we infer the user from the current console / GUI login session. Launchd makes inferences here as well for using this user when we submit the launchd agent job.

Misc Checklist:

  • My change requires a documentation update on Sparkle's website repository
  • My change requires changes to generate_appcast, generate_keys, or sign_update

Only bug fixes to regressions or security fixes are being backported to the 1.x (master) branch now. If you believe your change is significant enough to backport, please also create a separate pull request against the master branch.

Testing

I tested and verified my change by using one or multiple of these methods:

  • Sparkle Test App
  • Unit Tests
  • My own app
  • Other (please specify)

Tested running sparkle-cli as sudo and without on the Test Application, without any authorization prompts.
Tested ssh'ing on my machine (from the same machine) with sudo and tested updating still works.
Tested ssh'ing from a remote machine with sudo and tested updating still works, as long as the the logged in ssh user matches the active GUI user session on the machine (if these do not match, updating will not work).
Tested running sparkle-cli as sudo and without (with interactive) on guided pkg installation.
Tested running sparkle-cli as sudo with interactive based pkg are unsupported.
Tested resuming an update to be installed (without privileges) with sparkle-cli as sudo works.

macOS version tested: 12.3 (21E230)

Several things need to be done still for this to be properly polished including:

* Changing the owner/group of the progress tool parent directory to match the $USER correctly in all cases (i.e, not assume the Updater.app is owned by the regular user)
* Passing $USER and $HOME to guided pkg installer properly
* Not hardcoding GroupName to staff or not passing it at all
The API we use to convert HTML release notes to text is from AppKit, which we should not be calling under the root user.

Ideally we would find a better alternative API for handling HTML..
--interactive needs to be passed in this case for sparkle-cli.
@zorgiepoo zorgiepoo merged commit 339e269 into 2.x May 7, 2022
@zorgiepoo zorgiepoo deleted the framework-root branch May 7, 2022 13:33
zorgiepoo added a commit that referenced this pull request Jun 13, 2022
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