Repository navigation
[codex] OM-SEC-12: Bind update inhibitor cleanup to process identity - #9467
Merged
ErikMelton merged 39 commits intoSep 25, 2026
Merged
ErikMelton merged 39 commits into
ErikMelton merged 39 commits into
Conversation
AFOliveira
marked this pull request as draft
September 1, 2026 09:49
…view-9469-20260906
…dex/portfolio-9457-20260907
The legacy command wrote the caller's unvalidated name into both the sudoers filename and the rule. Cleanup applied the current lower-case account pattern to that suffix, so an exact legacy grant for an account such as Alice was classified as administrator policy, left active, and the machine-wide migration marker was written anyway. Match a legacy grant by its exact filename and rule relationship instead of the account policy, and cover it in the lifecycle suite through both the unit cleanup and the real migration runner. The account pattern itself stays lower-case: sudoers reads an upper-case word such as ALICE as a User_Alias reference, and ALL as every user, so such names must never reach the generated rule. Pin that with a test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Matching a legacy grant by its filename and rule relationship is not a complete fingerprint: the legacy writer took the filename from $USER but produced the rule with echo, and under BASH_ENV with xpg_echo a name such as ali\0143e yields an alice rule in a mismatched file. Preserving that as administrator policy let the migration certify success with an unrestricted grant still live until the next boot. The prefix is reserved anyway: boot cleanup and the package hook remove everything under it. Move any file the classifier does not recognize into a fresh root-only directory under /var/lib/omarchy/sudoers-quarantine/ as `policy`, with the original name stored beside it, so nothing there stays live, the administrator keeps the content, and a legacy filename already close to NAME_MAX still fits. An untrusted quarantine directory keeps the migration pending. Cover the mismatched and maximum-length legacy files in the unit cleanup and through the real migration runner. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Bring in the legacy-grant classifier fix and the reserved-prefix quarantine from omacom#9457 so this branch no longer carries a stale copy of that command. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…rough user work Three review findings on the update-hook boundary: The pre-refresh-pacman hook had been moved after the refresh transaction and, during a channel switch, deferred to the very end. That defeated the hook's purpose: custom repositories and IgnorePkg entries were not in place when the downgrade-capable -Syyuu ran. Run the hook where it used to run, after the package config is re-synced and before the transaction, but cold: revoke the timestamp, run it behind the no-update wrapper with the caller's original PATH, and revoke again before continuing. Every later privileged command authenticates with --no-update, so a detached child left by the hook has no reusable timestamp to wait for. Channel switching hands the caller's PATH to the refresh the same way the updater receives it, and no longer defers or re-runs the hook. Stay Awake was released before AUR builds, hooks and mise, so the machine could sleep during the longest part of an update. Releasing the inhibitor needs no privilege because the held command already dropped to the user, so stop it after mise and before the reboot prompt, as before. A packaged channel destination cannot be inspected before its package is installed, and a transaction can replace the running tree with a release that predates the command-scoped wrapper; from then on a bare sudo would resolve to /usr/bin/sudo and publish a timestamp, and the destination's own updater authenticates the same way. The switch used to abort only after the packages had changed, with generic rerun advice. Now it checks for the wrapper after each transaction before any further privileged step, completes what it safely can, and stops cold with instructions to run that release's update from a fresh session instead of launching it. Boundary tests pin the hook between the config copies and the transaction with a cold timestamp on both sides, the older-destination stop with its guidance and no launched updater, the new inhibitor position, and the post-update hook staying unreached on failures and signals. Docs, the manual and the sample hook describe the restored timing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Restarting the shell waited for the notification bus name to reappear before it would re-acquire a lock whose client had died. A slow or failed notification plugin then left the user stranded behind Hyprland's failsafe even though the lock service worked. Wait for the shell's core IPC, re-secure the lock immediately, and only then wait for a previously running notification service, reporting it separately if it never returns. Cover the never-returning case: the lock comes back and the restart still reports the missing service. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…robe The protected entrypoints revoked the sudo timestamp before installing their cleanup traps, so a signal or failure during that first sudo -k exited without the cleanup path. Install the traps first. The shell restart probed the notification bus name with busctl's default 25 second timeout, so an unresponsive user bus could stall the restart by that much per probe. Bound each probe to one second. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pacman continues a transaction after a failed scriptlet. Model that in the shared package-scriptlet contract: a failed pre_upgrade followed by post_upgrade must keep the removal blocker while a rule remains, a clean retry recovers, a stranded blocker with a live rule is cleaned by the next completed installation, a fresh install that cannot remove a leftover rule leaves publication refused, and the sweep does not depend on inherited glob state. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The settings package's pre-transaction hook runs this command under pacman's transaction. Its lock wait was unbounded, so a stalled grant operation could hang pacman indefinitely before AbortOnFail ever saw a result. Grant operations are short; wait at most 60 seconds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
AFOliveira
force-pushed
the
codex/om-sec-12-update-inhibitor-identity
branch
from
September 21, 2026 13:57
0240113 to
5b5ff6a
Compare
AFOliveira
marked this pull request as ready for review
September 21, 2026 13:58
Keep inhibitor state in validated private directories and verify the recorded owner, PID, start time and launch token before signaling. Authenticate the held command before detaching and drop it back to the invoking user. Serialize launch and cancellation, identify the child before publishing its state, and preserve caller-owned idle choices. Cover cross-account fallback state, process identity, cancellation, retry, and update-lock handling with isolated regressions.
AFOliveira
force-pushed
the
codex/om-sec-12-update-inhibitor-identity
branch
from
September 21, 2026 15:14
5b5ff6a to
6af052f
Compare
ErikMelton
approved these changes
Sep 25, 2026
This was referenced Sep 27, 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.
An attacker-owned fallback directory could supply another account's PID and start time to update cleanup, causing it to terminate an unrelated process (OM-SEC-12). New inhibitor launches use private, account-owned state and bind cleanup to the process owner, PID, start time and per-launch token. Terminal starts authenticate once through
sudo -N -b; graphical starts use Polkit. The held process runs as the invoking user, so stop needs no privileged authentication. Cancellation rolls back the launch and preserves an independently enabled Stay Awake setting.The first upgrade starts the previous helper before replacing it. Cleanup therefore also accepts its exact two-field record in canonical, caller-owned directories and single-link regular files that other accounts cannot write. It tightens the directory permissions and verifies the PID, start time and real UID before signaling. This handles both the older sudo monitor and the later user-owned child. Unverifiable live legacy targets retain their recovery record and fail cleanup. New token records still require mode 0600. The idle-toggle test stub now resides in the mapped command directory so PATH sanitization cannot accidentally select an installed host command.
The inhibitor work is one commit,
6af052fc, across five files. The command is 51 lines shorter than the earlier PR head0240113d; the compatibility repair adds 38 production lines to the version Erik reviewed. The branch retains the #9457/#9469 foundation and a separate merge of quattro8f324c90. The shared security helper and sudo wrapper are unchanged from #9469689771bd. Those inherited commits account for the broader PR diff; merge order remains #9457 → #9469 → #9467 → #9472/#9474.Validation: the inhibitor, update-lock, update-sequence and hook suites pass (51 groups), along with 112 CLI checks, Bash syntax and whitespace checks. Coverage includes the updater replacing the helper during its package step and reaching restart handling, legacy modes and formats, real UID versus effective UID, foreign-account state, PID reuse, unsafe links and modes, cancellation, and preserving the user's Stay Awake choice. The complete inhibitor suite also passes with the host idle-toggle command excluded. Reverting legacy cleanup, checking effective ownership instead of real UID, or removing the mapped idle stub each makes its regression check fail.
Real upgrade transitions from both previous helper versions pass in a disposable Omarchy 4.0.2 VM with actual sudo and systemd-inhibit. The new helper stops the old inhibitor without a cleanup prompt, clears update-owned idle state and leaves no reusable sudo authorization. Two ordinary terminal cycles also pass on the final candidate, with matching source and installed-command hashes. Earlier integration covered graphical approval, dismissal and cancellation through real Polkit. A legacy target genuinely owned by root remains outside unprivileged cleanup; the fix preserves its recovery record rather than adding a privileged stop path.
Daybreak's independent review of both Erik fixes at
6af052fc: PASS, with isolated focused suites and a real-UID regression mutation check. Matching runtime/settings package builds and complete update/channel/migration-queue validation remain separate release work.