Skip to content

End reusable sudo authorization before installers and reduce update work - #14914

Closed
thebytorsnowdog wants to merge 1 commit into
omacom:quattrofrom
thebytorsnowdog:codex/os-audit-update
Closed

thebytorsnowdog wants to merge 1 commit into
omacom:quattrofrom
thebytorsnowdog:codex/os-audit-update

Conversation

@thebytorsnowdog

Copy link
Copy Markdown
Contributor

Updates currently keep reusable sudo authorization active through post-update hooks and mise installation, and the AUR picker also maintains that authorization during builds. End the trusted system-update session before those stages and apply the existing command-scoped sudo wrapper consistently, including direct AUR updates.

This also removes avoidable work and respects existing installation policy:

  • Stop and wait for the sudo keepalive, revoke authorization between stages and on exit, clear the trusted-session marker, and preserve access to the user's tools. Refuse to continue if package replacement removes the wrapper.
  • Protect both AUR entrypoints against shell startup injection, disable yay's sudo loop, and preserve cancellation, failure reporting, and cleanup.
  • Remove synchronous updatedb after AUR installation; regular scheduled indexing remains responsible for refreshing locate results.
  • Run the existing bounded cache cleanup after confirmation but before the free-space guard. Insufficient space still stops the update before snapshots or package changes; declining confirmation does no cleanup.
  • Stop forcing MISE_MINIMUM_RELEASE_AGE=0. Preserve configured policy and explicit environment overrides; migrate only exact generated wrappers, leaving customized launchers untouched.

Validation:

  • Passed test/shell.d/{update-hook-security,update-user-path,update-sequence,update-disk-space,pkg-aur-sudo-boundary,update-aur-sudo-boundary,channel-sudo-boundary,security-source-root,security-entrypoint-symlink}-test.sh using the real scripts with harmless privilege/package fixtures.
  • Passed test/shell.d/{mise-release-age,mise-wrapper-quiet-migration,mise-install,agent-account-exec,locate,update-boot-verify,update-restart-phases,channel,pacman-templates}-test.sh. Account dispatch used real offline mise; locate exercised real indexing of a temporary tree and verified neither successful nor failed AUR builds trigger indexing.
  • Shell syntax and whitespace checks passed. The lock/inhibitor suite still fails its final inhibitor-wait assertion in the PRoot environment; untouched upstream reproduces it. Native systemd validation remains required, including the stay-awake runtime-directory prerequisites.

AUR installations and privileged hooks may require separate password prompts, and newly installed files may not appear in locate until scheduled indexing runs. This limits credential reuse within these workflows; it does not sandbox installer code or prevent independently authorized concurrent activity. No complete installed-OS update or clean full-suite result is claimed.

@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable defects were established.

Summary

This PR ends reusable sudo authorization before hooks, mise installers, and AUR builds.

  • Hooks and installers start after the update ends its shared sudo session.
  • AUR installs and updates run with command-scoped sudo and no reusable ticket.
  • The update prunes its cache before checking free space.
  • Mise tools follow the configured release-age policy.

No actionable issues were established. No tests were run during this review. Thebytorsnowdog acknowledges delayed locate results, separate password prompts, and deferred native systemd validation.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Confirm update] --> B[Authorize sudo]
  B --> C[Prune package cache]
  C --> D{Enough free space?}
  D -->|No| E[Stop and revoke authorization]
  D -->|Yes| F[Snapshot, packages, migrations, service restarts]
  F --> G[Stop keepalive and revoke authorization]
  G --> H[Post-update hook]
  H --> I[Revoke authorization]
  I --> J[Update mise tools]
  J --> K[Revoke authorization]
  K --> L[Update AUR packages]
  L --> M[Revoke authorization and check boot files]
  M --> N[Release sleep inhibitor and finish]
Loading

Reviews (1) · Last reviewed commit: "End reusable sudo authorization before i..." · Reviewed by Greptile

@jandrusk

Copy link
Copy Markdown

Strong update-boundary hardening: revoke the reusable sudo timestamp before hooks / mise / AUR, stop forcing MISE_MINIMUM_RELEASE_AGE=0, drop the post-AUR updatedb, and keep the no-update sudo wrapper. Tests look thorough.

Product/UX note to flag for maintainers: AUR installs and some hooks will prompt for sudo more often than today — that’s intentional. Migration 1791640215 is unique vs quattro.

Please coordinate with other open sudo/mise boundary work (#14800, #14135) so we don’t thrash the same update path.

@sprajs

sprajs commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Additional validation for the hook/mise boundary at b22bb1bb:

I tested a local integration of this change and compared the relevant code with the PR head. The post-update hook/mise block, authorization and cleanup functions, and lock/stay-awake helpers match byte for byte.

  • Regression tests using the real entrypoints with harmless sudo stand-ins denied noninteractive probes after revocation, including a detached hook child during later stages. Hook failure handling and access to user-installed tools also passed.
  • A separate extended local version exercised the same lock/stay-awake helpers with real flock and logind in a disposable Omarchy VM. Normal completion, an injected keyring failure and TERM all released the lock and inhibitor and removed the temporary Stay Awake state. Package and configuration changes were stubbed.

These results add evidence for the shared boundary and cleanup code; they are not a test of the complete PR head. The PR’s additional AUR changes and mise release-age policy, full package transactions and interactive authentication prompts remain outside these checks.

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Closing this one; #16568 replaced it. The update now runs under a single sudo authorization on purpose, AUR and the boot check included, so it stops asking for the password again near the end. Thanks for digging into this!

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.

4 participants