fix(uninstall): harden uninstall flow and fail closed - #19
Open
dan-snelson wants to merge 2 commits into
Open
Conversation
Signed-off-by: Dan K. Snelson <24623109+dan-snelson@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Hardens the macOS scripts/uninstall.sh flow to fail closed and avoid leaving the system in an inconsistent state (e.g., bundle removed while the loginwindow authorization DB entry remains).
Changes:
- Enables strict shell behavior (
set -euo pipefail) and requires root execution up front. - Uses a temporary workspace with cleanup, validates
authorizationdb readoutput (non-empty + valid plist), and verifies removal before deleting the bundle. - Prefers the bundled teardown script with a fallback to an internal teardown path; makes bundle/receipt removal idempotent.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
fix(uninstall): harden uninstall flow and fail closed
Refactor scripts/uninstall.sh to make the uninstall path safe for
production use and resilient to partial failures.
The previous implementation could continue after a failed
security authorizationdb read, because shell redirection created thetemporary file even when the command itself failed. That made it
possible to remove the Bootstrap Buddy bundle while leaving the
authorization database entry behind, which is not a safe uninstall
outcome.
This change hardens the script by:
set -euo pipefailreturn a valid plist
attempting teardown
internal teardown path when needed
removing the bundle
system is already partially uninstalled
partial or inconsistent uninstall
The result is an uninstall flow that is safer to run from MDM or manual
recovery workflows and less likely to leave the loginwindow
authorization database in a broken state.