Skip to content

Stop privileged copies from following a caller-controlled OMARCHY_PATH - #9317

Closed
Adolanium wants to merge 1 commit into
omacom:quattrofrom
Adolanium:privileged-source-copies
Closed

Adolanium wants to merge 1 commit into
omacom:quattrofrom
Adolanium:privileged-source-copies

Conversation

@Adolanium

@Adolanium Adolanium commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

omarchy-refresh-limine, omarchy-refresh-pacman, omarchy-toggle-hybrid-gpu, and omarchy-hibernation-setup expand $OMARCHY_PATH as the user, then sudo cp that path onto a root-owned target:

sudo cp "$OMARCHY_PATH/default/limine/limine.conf" /boot/limine.conf
sudo cp -f "$OMARCHY_PATH/default/pacman/pacman-$channel.conf" /etc/pacman.conf
sudo cp -p "$OMARCHY_PATH/default/systemd/system-sleep/force-igpu" /usr/lib/systemd/system-sleep/
sudo cp -p "$OMARCHY_PATH/default/systemd/system-sleep/keyboard-backlight" /usr/lib/systemd/system-sleep/

A caller who sets OMARCHY_PATH to a tree they can write, then types the sudo password for "refresh Limine" or "refresh pacman", installs their file as the bootloader config, the package config, or a sleep hook systemd later runs as root. omarchy-plymouth-set already refuses a user-owned source tree unless a root-owned /etc/omarchy.conf names that checkout. These copies did not.

The prompt still asks for a password. The bug is that the copy source is a path the caller chose.

What changed:

  • All four helpers copy from /usr/share/omarchy by default.
  • A linked checkout is used only when /etc/omarchy.conf is a root-owned regular file whose only line names that checkout, which is what omarchy-dev-link writes. Same rule as plymouth-set.

Tests: new test/shell.d/privileged-source-copy-test.sh. A source check pins every remaining sudo-copy. With a fake tree in OMARCHY_PATH, refresh-limine and refresh-pacman still ask sudo to copy from /usr/share/omarchy. All 3 pass. The elevation cases stub sudo, so nothing here writes /boot or /etc.

Limine, pacman, and the systemd-sleep hooks now copy from /usr/share/omarchy
unless a root-owned /etc/omarchy.conf names a linked checkout.
@Adolanium

Copy link
Copy Markdown
Contributor Author

Closing this one. I went back over it and the change does not cross a privilege boundary.

The caller who sets OMARCHY_PATH is the same wheel user who types the sudo password. That user can already sudo cp anything into /boot or /etc/pacman.conf directly. No NOPASSWD rule covers these four commands, so nothing is gained by redirecting the copy source.

There may be a case for a shared "resolve the trusted tree" helper for consistency with omarchy-plymouth-set, but that would be a refactor with one shared function and dev-link quoting handled properly, not a security fix. I will open that separately if there is interest.

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.

1 participant