Skip to content

Use ordinary sudo: one password for ten minutes, plain update scripts - #17000

Merged
dhh merged 3 commits into
quattrofrom
sudo-ten-minutes
Oct 31, 2026
Merged

dhh merged 3 commits into
quattrofrom
sudo-ten-minutes

Conversation

@omarchybot

@omarchybot omarchybot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Omarchy asked for the sudo password over and over. A fresh install's update asked three times at "Create system snapshot", and a dev link session asked six times. A password typed one command earlier never carried over to the next.

The cause is the command-scoped sudo boundary from OM-SEC-14 (#9469) and OM-SEC-22 (#10217). Commands cleared sudo's timestamp (sudo -k) when they started and exited, and ran privileged steps through a sudo -N wrapper that authenticates without caching. The aim was to deny code Omarchy runs as the user (hooks, AUR builds, mise installers) a warm sudo cache. That code already has easier routes to root: an AUR package's install scripts and pacman hooks run as root by design, and anything running as the user can put a sudo of its own on their PATH and wait for the next password. #16568 had already put AUR builds back under the update's authorization. Every major distribution caches sudo for the same reason.

This goes back to ordinary sudo:

  • etc/sudoers.d/omarchy-sudo-timeout sets timestamp_timeout=10, so one password covers ten minutes in the same terminal. No Omarchy command clears it or authenticates through sudo -N, and the sudo-no-update wrapper is gone.
  • omarchy-update, omarchy-refresh-pacman and omarchy-channel-set are plain Bash scripts again, as in 4.0.6. The bash -p startup check, environment scrubbing, OMARCHY_PATH source-root check and pinned PATH only guarded against code already running as the user, so they go too. Every feature added since stays: the boot check, the free-space check, the mise fallback, the update lock, regional pacman rendering, per-platform templates and dev-checkout validation. Hooks and mise inherit the caller's PATH directly.
  • omarchy update still asks once up front, with a keepalive so long downloads never outlast the authorization. It runs inside script's own pseudo-terminal, so a password typed in the calling terminal does not carry in. That is one prompt per update, as before.
  • Channel switching swaps omarchy/omarchy-dev with a direct sudo pacman -S again. The refresh before it can already have installed an older release without this tree's helpers, so the older-destination stop is no longer needed. Leaving dev drops the unlinked checkout's bin from PATH, so the packaged update runs the packaged helpers.

Two fixes that guard against other accounts stay intact, along with the security library they use:

  • omarchy-update-stay-awake (OM-SEC-12) keeps its private state and process-identity checks, so another account can't make update cleanup kill an arbitrary process. It only loses the timestamp clearing.
  • omarchy-sudo-passwordless (OM-SEC-01) keeps its grant validation and fail-closed expiry. It only loses sudo -N.

Tests that pinned the removed boundary or entry checks are gone or narrowed to stay-awake. channel-sudo-boundary-test.sh becomes channel-switch-test.sh, which keeps the coverage that wasn't about the boundary.

🤖 Generated by Opus 5.5 in Claude Code. Reviewed by Codex Medium.

Omarchy commands revoked sudo's timestamp on entry and exit and authenticated through a sudo -N wrapper, so every privileged step asked again: three prompts at "Create system snapshot", six for a dev link session. Ship timestamp_timeout=10, drop the revocation and the wrapper, and keep omarchy update's single authorization and keepalive.

Channel switching keeps its stop for a destination older than this tree, now keyed on what the next steps need: omarchy-update-pacman, and an updater that restores the caller's PATH. Releases 4.0.5 and 4.0.6 have neither.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge within its stated choice to restore ordinary sudo caching.

Summary

Restores ordinary sudo caching and simplifies the update scripts.

  • Omarchy updates keep one sudo authorization through the full update.
  • Channel changes swap packages directly before starting the destination updater.
  • Passwordless-sudo actions and OCaml cleanup use regular sudo.

omarchybot explicitly accepts that user-run hooks and tools can reuse cached sudo authorization. No new actionable issue was established.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start update] --> B[Open transcript terminal and acquire lock]
  B --> C[Confirm and authorize sudo]
  C --> D[Start authorization keepalive]
  D --> E[Snapshot and inhibit sleep]
  E --> F[Update packages and run migrations]
  F --> G[Run hooks, mise and AUR updates]
  G --> H[Check boot files]
  H --> I[Stop keepalive and release inhibitor]
  I --> J{Boot check passed?}
  J -->|Yes| K[Offer reboot]
  J -->|No| L[Report unfinished update]
Loading

Reviews (2) · Last reviewed commit: "Make update, refresh and channel switchi..." · Reviewed by Greptile

dhh and others added 2 commits October 31, 2026 19:51
The privileged-Bash startup check, environment scrubbing, OMARCHY_PATH source-root check and pinned PATH in omarchy-update, omarchy-refresh-pacman and omarchy-channel-set only guarded against code already running as the user, the same threat the password boundary was dropped for. They return to plain Bash as in 4.0.6, with every feature since kept; hooks and mise inherit the caller's PATH directly.

The channel swap calls pacman itself again, so a refresh that installs an older release without omarchy-update-pacman cannot strand it, and the older-destination stop is no longer needed. Leaving dev drops the unlinked checkout's bin from PATH so the packaged update runs the packaged helpers.

omarchy-update-stay-awake and omarchy-sudo-passwordless keep the security library: OM-SEC-12 and OM-SEC-01 guard against other accounts, not the caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot changed the title Let one sudo password last ten minutes in a terminal Use ordinary sudo: one password for ten minutes, plain update scripts Oct 31, 2026
@dhh
dhh merged commit 56a910b into quattro Oct 31, 2026
3 checks passed
@dhh
dhh deleted the sudo-ten-minutes branch October 31, 2026 18:56
omarchybot added a commit that referenced this pull request Oct 31, 2026
Brings the branch up to quattro after #17000 (ordinary sudo) and #16302 (no migration tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchybot added a commit to Roriz/omarchy that referenced this pull request Nov 1, 2026
quattro's omacom#17000 dropped sudo revocation, so cleanup_update can no longer fail to revoke: take quattro's cleanup and drop the revoke case from the cleanup test, keeping the error and signal cases that check a failed update releases the lid lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ryanrhughes added a commit to shbernal/omarchy that referenced this pull request Nov 1, 2026
omacom#17000 dropped the sudo-no-update wrapper this branch sat next to, so the AUR step keeps quattro's plain yay call and adds the unset above it.
ryanrhughes added a commit to shbernal/omarchy that referenced this pull request Nov 1, 2026
omarchy-update keeps the caller's PATH since omacom#17000, so mise's go and GOROOT stay together there. omarchy-upgrade-to-quattro still runs the AUR step with its system-first package_path.
ryanrhughes added a commit that referenced this pull request Nov 1, 2026
* Keep mise's GOROOT out of AUR package builds

* Name the upgrade as the caller that pairs system PATH with mise's GOROOT

omarchy-update keeps the caller's PATH since #17000, so mise's go and GOROOT stay together there. omarchy-upgrade-to-quattro still runs the AUR step with its system-first package_path.

---------

Co-authored-by: Ryan Hughes <ryan@heyoodle.com>
ryanrhughes added a commit that referenced this pull request Nov 1, 2026
* Keep mise's GOROOT out of AUR package builds

* Name the upgrade as the caller that pairs system PATH with mise's GOROOT

omarchy-update keeps the caller's PATH since #17000, so mise's go and GOROOT stay together there. omarchy-upgrade-to-quattro still runs the AUR step with its system-first package_path.

---------

Co-authored-by: Ryan Hughes <ryan@heyoodle.com>
(cherry picked from commit c125859)
omarchybot added a commit to kvnloo/omarchy that referenced this pull request Nov 1, 2026
quattro dropped OMARCHY_UPDATE_USER_PATH from the script(1) re-exec (omacom#17000), so the wrapper keeps its private mktemp log without that variable, and the docs keep quattro's shortened boot-check note beside this branch's log note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchybot added a commit to Ashwinhegde19/omarchy that referenced this pull request Nov 1, 2026
omacom#17000 replaced the update's revoke-and-wrap sudo boundary with ordinary sudo and a ten-minute timestamp that no Omarchy command clears, and omacom#16568 moved AUR and the boot check inside the update's authorization. The cold-boundary wording this branch added is now wrong, so hooks.md takes quattro's paragraph, which already says hooks run inside the update's authorization. Two stale lines remain on quattro and are fixed here: the hook tree's "after privileged work" for post-update, which mise, AUR and the boot check all follow, and the manual's claim that update hooks run after Omarchy clears its sudo authorization and may prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchybot added a commit to VykosMolt/omarchy that referenced this pull request Nov 1, 2026
quattro now uses ordinary sudo (omacom#17000) and runs AUR updates under the update's one authorization (omacom#16568), and its hooks.md already describes that. Keep quattro's paragraph there and this branch's corrected post-update tree comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchybot added a commit to VykosMolt/omarchy that referenced this pull request Nov 1, 2026
Since omacom#17000 neither omarchy update nor omarchy refresh pacman clears its sudo timestamp, and AUR updates share the update's one authorization (omacom#16568), so nothing is cleared before AUR and a hook's sudo can reuse what was already asked for. It can, not does: a standalone refresh has no keepalive, so a hook that waits past the ten-minute timestamp prompts again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
namespaceMarcello added a commit to namespaceMarcello/omarchy that referenced this pull request Nov 2, 2026
omacom#17000 dropped the command-scoped sudo boundary: cleanup_update now ends
with a plain exit, and the test fixture no longer has
assert_boundary_cold. Keep the warning in cleanup_update after
end_update_authorization and Stay Awake, before the exit, and drop the
four assert_boundary_cold calls this branch had added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
namespaceMarcello added a commit to namespaceMarcello/omarchy that referenced this pull request Nov 2, 2026
omacom#17000 deleted remove-dev-env-sudo-security-test.sh, whose namespace
probe this branch gated; the other two probes and the shared helper
merge cleanly. No test added since maps ids with unshare without
calling user_namespace_available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 3, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
localrobot pushed a commit to localrobot/omarchy that referenced this pull request Nov 3, 2026
…omacom#17000)

* Let one sudo password last ten minutes in a terminal

Omarchy commands revoked sudo's timestamp on entry and exit and authenticated through a sudo -N wrapper, so every privileged step asked again: three prompts at "Create system snapshot", six for a dev link session. Ship timestamp_timeout=10, drop the revocation and the wrapper, and keep omarchy update's single authorization and keepalive.

Channel switching keeps its stop for a destination older than this tree, now keyed on what the next steps need: omarchy-update-pacman, and an updater that restores the caller's PATH. Releases 4.0.5 and 4.0.6 have neither.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>

* Make update, refresh and channel switching plain scripts again

The privileged-Bash startup check, environment scrubbing, OMARCHY_PATH source-root check and pinned PATH in omarchy-update, omarchy-refresh-pacman and omarchy-channel-set only guarded against code already running as the user, the same threat the password boundary was dropped for. They return to plain Bash as in 4.0.6, with every feature since kept; hooks and mise inherit the caller's PATH directly.

The channel swap calls pacman itself again, so a refresh that installs an older release without omarchy-update-pacman cannot strand it, and the older-destination stop is no longer needed. Leaving dev drops the unlinked checkout's bin from PATH so the packaged update runs the packaged helpers.

omarchy-update-stay-awake and omarchy-sudo-passwordless keep the security library: OM-SEC-12 and OM-SEC-01 guard against other accounts, not the caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex Medium <noreply@openai.com>
(cherry picked from commit 56a910b)
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 4, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@emirb emirb added this to the 4.5 milestone Nov 5, 2026
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 5, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 11, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 11, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 14, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GruperTal added a commit to GruperTal/omarchy that referenced this pull request Nov 19, 2026
Since omacom#17000 omarchy update is a plain script on the caller's PATH, so the
window's English and gum stand-ins reach it as they reach installs. That
changes nothing it reads: pacman was already pinned to English by
omarchy-update-system-pkgs, and an unattended update asks gum nothing. The
notes that said otherwise go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

3 participants