Repository navigation
Ask for the sudo password once per omarchy update - #13323
Merged
Merged
Conversation
Every sudo call in omarchy update prompted, because the no-update wrapper covered the whole run on top of per-phase revokes, and stay-awake revoked the timestamp on its own entry and exit. A single update could ask four times before the snapshot finished (#13319). Authorize once, right after confirmation, starting from a revoked timestamp so the prompt always belongs to this update. A background keepalive refreshes it until the update is done. Prune, snapshot, stay-awake, keyring, system packages, migrations, orphan removal, service restarts, the post-update hook, and mise all share that authorization. AUR builds run third-party PKGBUILD code, so they move to the end and run cold: the keepalive stops, the timestamp is revoked, and yay and any bare sudo use the no-update wrapper. The timestamp is revoked again after AUR and on every exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ition Authorize by running a command instead of sudo -v. Under the default verifypw=all, -v prompts even when passwordless sudo is enabled, which would have added a prompt those users never had. Inside an update without a terminal, stay-awake now reuses the update's authorization with a non-interactive sudo instead of asking again through polkit. It falls back to polkit only if that authorization is gone. The test sudo refuses a cold non-interactive call, as the real one does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 26, 2026
This was referenced Oct 17, 2026
20 of 34 tasks
4 tasks
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.
Fixes #13319. Supersedes #13268 and #13321.
omarchy updateasked for the sudo password on nearly every privileged command. The no-update wrapper covered the whole run on top of per-phasesudo -krevokes, andomarchy-update-stay-awakerevoked on its own entry and exit. So no timestamp ever survived, and one update could prompt four times before the snapshot even finished.What changes
sudo /usr/bin/trueonce, so the prompt always belongs to this update. It runs a command rather thansudo -vbecause under the defaultverifypw=all,-vprompts even with passwordless sudo enabled. A background keepalive runssudo -n /usr/bin/trueevery minute until the update is done, so long downloads and builds never outlast the timestamp.OMARCHY_UPDATE_SUDO_SESSION=1and leaves the timestamp to the update. Without a terminal, it reuses the authorization with non-interactive sudo instead of asking again through polkit. Run standalone, it still revokes on entry and exit.sudoa PKGBUILD runs use the no-update wrapper. An AUR install can still prompt, but it never caches. The timestamp is revoked again after AUR and on every exit.Trade-off
This deliberately relaxes the #9469 boundary for migrations, the post-update hook, and mise: they can reuse the update's authorization while it is live. AUR keeps the cold, command-scoped boundary. The authorization is created fresh by the update, and it lives inside the
script(1)pty session. It is revoked before AUR and on every exit.Standalone commands that keep their own cold boundary, such as
omarchy-refresh-pacmanandomarchy-remove-dev-env ocaml, still revoke if a user's post-update hook calls them. That is left as-is.Channel switching still authorizes its own steps command by command. The update it hands off to then asks once for its own phases.
Review
Reviewed with Codex. Fixed from that review: the no-terminal polkit fallback inside an update, and a mock that let a cold
sudo -nsucceed. Also fixed: the passwordless-sudo prompt fromsudo -v. Out of scope:-ystill entering the orphan confirmation, which is an existing bug onquattro.Tests
update-hook-security: asserts onesudo -vbefore any work, plain sudo with no revokes through mise, and a revoke before AUR. After it, only-Nsudo or revokes, and a cold exit.update-sequence: new order, with AUR after hooks and mise.update-user-path/channel-sudo-boundary: the post-update hook and mise see the shared authorization; the pre-refresh hook stays cold.update-stay-awake-security: new checks that the helper leaves an update's authorization alone, still revokes standalone, and reuses sudo instead of polkit without a terminal.-ncall, as the real one does.sudoinbin/now resolves to the mock, so no test can reach the host's sudo../test/shellshows the same 4 files failing as on a cleanquattro(kernel-headers migration, kernel migration, passwordless-grant lifecycle, unowned system paths). The keepalive was also exercised on its own: it refreshed, stopped cleanly, and left no orphaned sleep.🤖 Generated with Claude Code