mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Update README and add documentation, screenshots to reflect this fork.
This commit is contained in:
1 parent
010f642922
commit
e6c529e0ee
6 files changed
+132
-28
No files matched your search
@@ -0,0 +1,35 @@
|
||||
# Design Practices
|
||||
|
||||
## Singletons
|
||||
|
||||
Singletons and other global mutable variables have been either removed entirely or completely avoided with an exception to backwards compatibility. They have no place in a well architectured framework.
|
||||
|
||||
`SPUUpdater` doesn't maintain singleton instances and can now be properly deconstructed. Note because a caller is not expected to explicitly invalidate an updater, this means that the updater needs to avoid geting into a retain cycle. Intermediate clasess were created for the update cycle and schedule timer to avoid just this.
|
||||
|
||||
One may argue that we shouldn't allow multiple live updaters running at the same bundle simutaneously, but I disagree and I think that is missing the point. It also does not account for updaters running external to the process. For example, it may be perfectly reasonable to start an update from `sparkle-cli` that defers the installation until quit, and have the application that is being updated be able to resume that installation and relaunch immediately.
|
||||
|
||||
The original `SUUpdater` may have also been created to assist plug-ins and other non-app bundles. My advice there is in order to be truely safe, you must not inject a framework like Sparkle into the host application anyway. An external tool that is bundled like `sparkle-cli` may be more appropriate to use here.
|
||||
|
||||
## Extensibility
|
||||
|
||||
This fork does not support subclassing classes internal (not exported) to Sparkle anymore. Doing so would be almost impossible to maintain into the future. Subclassing in general has been banned in this fork. Composition is prefered everywhere, even amongst the internal update drivers which were rewritten to follow a protocol oriented approach. The reason why composition is preferred is because it's easier to follow the flow of logic.
|
||||
|
||||
I hope the user driver API gives enough extensibility without someone wanting to create another fork.
|
||||
|
||||
## Delegation
|
||||
|
||||
Newer classes, other than assisting backwards compatibility, that support delegation don't pass the delegator around anymore. Doing so has some [bad consequences](https://zgcoder.net/ramblings/avoid-passing-the-delegator) and makes code hard to maintain.
|
||||
|
||||
Optional delegate methods that have return types need to be optional or have known default values for primitive types.
|
||||
|
||||
You may notice that the delegate and user driver are not accessible as properties from `SPUUpdater`. This is intentional. The methods that belong to these types aren't meaningful to any caller except from internal classes.
|
||||
|
||||
## Decoupling
|
||||
|
||||
Two software components should not directly know about each other. Preferrably they wouldn't know about each other at all, but if they must, they can use the delegation pattern with a declared protocol.
|
||||
|
||||
See `Documentation/graph-of-sparkle.png` for a graph of how the code looks like currently. This was generated via [objc_dep](https://github.com/nst/objc_dep) (great tool). Note that there are no red edges which would mean that two nodes know of each other.
|
||||
|
||||
## Attributes
|
||||
|
||||
`nonatomic` should really be used wherever possible with regards to obj-c properties (`atomic` is a bad default). `readonly` should be used wherever possible as well, which also implies that only ivar access should be used in initializers. `NS_ASSUME_NONNULL_BEGIN` and `NS_ASSUME_NONNULL_END` should be used around new headers whenever possible. AppKit prevention guards should be used for any non-UI class whenever possible.
|
||||
@@ -0,0 +1,33 @@
|
||||
# Security
|
||||
|
||||
First, some references I've found to be quite useful:
|
||||
|
||||
* WWDC 2010 video on "Creating Secure Applications" - [asciiwwdc](http://asciiwwdc.com/2010/sessions/204?q=security).
|
||||
* [EvenBetterAuthorizationExample](https://developer.apple.com/library/mac/samplecode/EvenBetterAuthorizationSample/Introduction/Intro.html) sample code by Apple for showing off privileged authorization as well as in sandboxed applications.
|
||||
* Apple's [Daemons and Agents Technote](https://developer.apple.com/library/mac/technotes/tn2083/_index.html). Outdated and before XPC existed, but insightful.
|
||||
|
||||
This fork puts a huge emphasis on splitting Sparkle into several components to achieve privilege separation.
|
||||
|
||||
* User Driver (Application; AppKit permitted)
|
||||
* Updater Scheduler (Framework)
|
||||
* XPC Services (Instead of some portions of Framework)
|
||||
* Progress Agent (Application; AppKit permitted)
|
||||
* Installer (Agent and Daemon safe)
|
||||
|
||||
These achieve privilege separation, because at least theoretically, they can all be placed into different processes from one another.
|
||||
|
||||
In practice, the user driver and updater framework will likely be in the same process, but leaving this possibility speaks well for the quality of the architecture. This is why for instance all the methods on the user driver are not assumed to be executed on the main thread, if one decided to use NSXPC to drive them.
|
||||
|
||||
For XPC Services, it's significant to understand that their purpose is not only for sandboxing. The services can be used regardless of whether an application is sandboxed or not. Besides privilege separation, they also have an impact on fault tolerance and termination.
|
||||
|
||||
XPC Services also act inside an application bundle namespace, which is one of many reasons why they aren't bundled inside the framework. We have code that detects whether or not services are available inside the main bundle. This is simpler and more efficient than attempting to create a connection and wait for a timeout. We don't have *any* checks for seeing if the "current process" is sandboxed; doing so is a rather broken behavior. The XPC Services are important, not the sandboxing.
|
||||
|
||||
I said above that XPC services are looked up in the main bundle. One may think this assumption doesn't hold for helpers or plug-ins inside applications. My response to that is they probably don't need the services, and they probably shoudn't be injecting Sparkle inside the host application anyway due to unintended conflicts and other consequences. A more appropriate approach may be to bundle a separate tool such as the sparkle command line utility.
|
||||
|
||||
When developing this fork, I still had a huge hole in the privilege separation even after supporting XPC Services and sandboxing. I fixed that by removing references to `AuthorizationExecuteWithPrivileges` and submitting a launchd agent/daemon for the installer. This is overlooked, but absolutely essential for our model to be secure.
|
||||
|
||||
When communicating to a launchd job, we've several options to use for IPC such as BSD Sockets, Mach ports, XPC (note: XPC is an IPC API and is != "XPC Services"), and file IO. The technote I linked above describes why Mach ports have user namespace issues and why BSD sockets may be preferred over them. However, now, XPC which allows you to choose which domain to look up is the simplest, best, and most modern choice. It's crucial in any event we don't have a daemon (running in system domain) try to *connect* to something in the user domain. Our launchd tasks should also be connected to rather than the other way around. As for communication via file IO, I just wouldn't go anywhere close to trusting such a model mixing in system and user running processes.
|
||||
|
||||
For sending Obj-C objects across the wire, we use `SPUSecureCoding` because Cocoa doesn't support sending objects securely out of the box unless working with XPC Services. It's very important the objects implement `NSSecureCoding` and whitelist types that are expected to be decoded, as well as whitelist types inside collections before decoding them.
|
||||
|
||||
Lastly, the installer handles extraction, validation, and installation of the update. This was the main reason why other forks were rejected from being secure. The point to be stressed anyway is that these all need to be done in the same process; they can't be handed off by some other process. This is also why removing references to `AuthorizationExecuteWithPrivileges` is crucial as well.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.9 MiB |
+64
-28
@@ -1,43 +1,77 @@
|
||||
# Sparkle [](https://travis-ci.org/sparkle-project/Sparkle) [](https://coveralls.io/github/sparkle-project/Sparkle?branch=master) [](https://github.com/Carthage/Carthage) []() <a href="https://www.maxcdn.com/?utm_source=sparkle-github&utm_medium=badge&utm_campaign=readme"><img src="https://img.shields.io/badge/sponsored%20by-MaxCDN-orange.svg" alt="sponsored by: MaxCDN"></a>
|
||||
# Sparkle-XPC-UI
|
||||
|
||||
An easy-to-use software update framework for Cocoa developers.
|
||||
A major fork to the popular Sparkle update framework that supports sandboxing, custom user interfaces, updating other bundles, and a modern secure architecture.
|
||||
|
||||
<img src="Resources/Screenshot.png" width="732" alt="Sparkle shows familiar update window with release notes">
|
||||
|
||||
## Changes since 1.5b
|
||||
This fork's current status is beta. I am no longer looking into adding or rewriting major functionality, and would like to finalize and have it be battle tested.
|
||||
|
||||
* Up-to-date with 10.11 SDK and Xcode 7. Supports macOS 10.7+.
|
||||
* Cleaned up and modernized code, using ARC and Autolayout.
|
||||
* Merged bugfixes, security fixes and some features from multiple Sparkle forks.
|
||||
* Truly automatic background updates (no UI at all) when user agreed to "Automatically download and install updates in the future."
|
||||
* Ability to mark updates as critical.
|
||||
* Progress and status notifications for the host app.
|
||||
* Name of finish_installation.app can be configured to match your app's name.
|
||||
* Upgraded and more reliable binary delta and code signing verification.
|
||||
New issues that are found should be [reported here](https://github.com/zorgiepoo/sparkle-ui-xpc-issues/issues), and internal design documents can be found in `Documentation`.
|
||||
|
||||
## Features
|
||||
# Features
|
||||
|
||||
* True self-updating—the user can choose to automatically download and install all updates.
|
||||
* Displays a detailed progress window to the user.
|
||||
* Supports authentication for installing in secure locations.
|
||||
* Supports Apple Code Signing and DSA signatures for ultra-secure updates.
|
||||
* Easy to install. Sparkle requires no code in your app, so it's trivial to upgrade or remove the framework.
|
||||
* Uses appcasts for release information. Appcasts are supported by 3rd party update-tracking programs and websites.
|
||||
* Displays release notes to the user via WebKit.
|
||||
* Sparkle doesn't bug the user until second launch for better first impressions.
|
||||
* Seamless integration—there's no mention of Sparkle; your icons and app name are used.
|
||||
* Deep delegate support to make Sparkle work exactly as you need.
|
||||
* Optionally sends system information to the server when checking for updates.
|
||||
* Supports bundles, preference panes, plugins, and other non-.app software. Can install .pkg files for more complicated products.
|
||||
* Supports branches due to minimum OS version requirements.
|
||||
## Sandboxing
|
||||
|
||||
This fork includes several XPC services that are generally optional to include in your application, but are required for sandboxed applications. See the `INSTALL` file for more detail.
|
||||
|
||||
When sandboxed, linked release notes are allowed. External references inside the linked release notes are only allowed if the host application has an incoming network entitlement. Lastly, updates can still be extracted from DMG files just as they are in the official branch.
|
||||
|
||||
## Custom User Interfaces
|
||||
|
||||
<img src="Resources/Screenshot2.png" width="350" alt="Sparkle shows a custom update window with release notes">
|
||||
|
||||
See the `SPUUserDriver` protocol and classes that implement it for how to write your own user interface. This enables extensibility of Sparkle without altering or extending internal classes.
|
||||
|
||||
Hold shift when launching the `Sparkle Test App` to try out the experimental user interface shown above (note: this custom interface requires running macOS 10.10 or later).
|
||||
|
||||
## Command Line Tool
|
||||
|
||||
<img src="Resources/Screenshot3.png" width="400" alt="Sparkle shows command line interface to installing updates">
|
||||
|
||||
The `sparkle` command line tool can be used to update any Sparkle supported bundle. `sparkle` is a great demonstration of updating other bundles, though that aspect is not limited to just this tool!
|
||||
|
||||
This utility may also be an ideal choice for plug-ins where loading a copy of Sparkle's framework into a host's application may lead to conflicts or have undesirable consequences.
|
||||
|
||||
## Modern Security
|
||||
|
||||
Not only is sandboxing supported, but launchd is now used for submitting the installer. XPC is used to communicate to the launchd job. Uses of `AuthorizationExecuteWithPrivileges`, which is neither secure or reliable, have been removed. Installation on standard user accounts has been tested heavily rather than being treated as an edge case.
|
||||
|
||||
Extraction, validation, and installation of the update are all handled by the installer. The XPC services and the installer job don't implicitly trust the other end of the connection. Signing downloads with a DSA signature is now encouraged more aggressively.
|
||||
|
||||
Usage of AppKit has been minimized greatly. No linkage of it is found in the installer daemon. All code core to Sparkle's functionality prevents it from being imported. Only user driver classes and a progress agent may use AppKit for showing UI.
|
||||
|
||||
## API Compatability
|
||||
|
||||
Despite decoupling update scheduling, UI, installation, and minimizing AppKit usage, a great deal of effort was made to maintain compatibility with older versions of Sparkle. A deprecated `SUUpdater` shim exists for maintaining runtime compatibility. Please check out `SPUStandardUpdaterController` and `SPUUpdater` instead for modern replacements.
|
||||
|
||||
Interactive package based installations have been deprecated in favor for guided package installations. As a consequence, interactive installations now have to be opted into (eg: `foo.sparkle_interactive.pkg`). A `sparkle:installationType=package` or `sparkle:installationType=interactive-package` tag is now required in the appcast enclosure item for package based installs.
|
||||
|
||||
No attempt is made to preserve compatibility with regards to subclassing Sparkle's internal classes. Doing this is not supported or maintainable anymore. Much of this desire will go away with the extensibility provided by the user driver API.
|
||||
|
||||
New Sparkle classes are now prefixed with `SPU` rather than `SU`. Older classes still use the `SU` prefix to maintain compatibility.
|
||||
|
||||
## Misc. Changes
|
||||
|
||||
* Unless overridden, Sparkle now waits 3 hours before prompting the user for updater permission, rather than waiting for a 2nd launch.
|
||||
* Updates are more instant to install once extracted. The "installing update" dialog seldomly shows up after the old application has quit.
|
||||
* The installer will attempt installing the update after extraction is finished, even if the user quits the process and doesn't relaunch the application explicitly.
|
||||
* Updates can be downloaded in the background automatically (if enabled) and be resumed by the user later, even if the user has insufficent permission to install them initially.
|
||||
* Sudden termination for silent updates isn't disabled because Sparkle doesn't listen for AppKit events anymore such as termination or power off (note the installer running as a separate process listens for termination).
|
||||
* Distributing updates without DSA signing the archives is now deprecated. Delta and package updates are now validated before extracted.
|
||||
* The old app is now removed rather than attempted to be moved into the trash for a more seemless and efficient experience.
|
||||
* Sparkle's icon in the official branch is no longer used for installation. Instead, the icon of the bundle to update is used. A 32x32 image representation of the icon is needed for the authorization dialog.
|
||||
* Sparkle doesn't log to a special file in ~/Library/ anymore due to multiple processes. Just the standard ASL API is used now.
|
||||
* The `length` attribute in the appcast enclosure item for the update should now exist and be valid.
|
||||
* Invocation of `mdimport` has been removed. The modification date of the `mdimporter` bundles are now updated after delta extractions.
|
||||
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Runtime: macOS 10.7 or greater
|
||||
* Build: Xcode 5 and 10.8 SDK or greater
|
||||
* Runtime: **macOS 10.8** or greater (this has been bumped up!)
|
||||
* Build: Not sure. I have been using Xcode 7.
|
||||
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
|
||||
|
||||
## API
|
||||
## API Visibility
|
||||
|
||||
Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default.
|
||||
If you are adding a symbol to the public API you must decorate the declaration with the `SU_EXPORT` macro (grep the source code for examples).
|
||||
@@ -48,6 +82,8 @@ If you are adding a symbol to the public API you must decorate the declaration w
|
||||
|
||||
Alternatively, build the Distribution scheme in the Xcode UI.
|
||||
|
||||
See the `INSTALL` file after building Sparkle, especially if interested in sandboxing support. The XPC services are not required for non-sandboxed applications.
|
||||
|
||||
## Project Sponsor
|
||||
|
||||
[MaxCDN](https://www.maxcdn.com/?utm_source=sparkle-github&utm_medium=link&utm_campaign=readme-footer)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 125 KiB |
Reference in new issue
Block a user