Skip to content

Read migrations and browser policies from the trusted Omarchy tree - #9351

Closed
Adolanium wants to merge 2 commits into
omacom:quattrofrom
Adolanium:migrate-browser-trusted-source
Closed

Adolanium wants to merge 2 commits into
omacom:quattrofrom
Adolanium:migrate-browser-trusted-source

Conversation

@Adolanium

Copy link
Copy Markdown
Contributor

omarchy-migrate runs every pending migration from $OMARCHY_PATH with the caller's sudo credentials a prompt away:

OMARCHY_PATH="$OMARCHY_PATH" bash -euo pipefail "$file"

omarchy-install-browser sources its policy helper from the same caller-controlled path, and the helper installs the default Firefox policy as root:

source "$OMARCHY_PATH/install/helpers/browser-policy.sh"
as_root install -m 644 -o root -g root -T "$policies" "$distribution_dir/policies.json"

A caller who points OMARCHY_PATH at a tree they can write, then types the sudo password for an update or a browser install, runs their own script as root or installs their own mandatory browser policy. The session environment is user-writable by definition, and migration markers live under ~/.local/state, so any migration can be made pending again.

omarchy-plymouth-set and the refresh helpers already refuse a user-owned source tree unless a root-owned /etc/omarchy.conf names that checkout. The update flow did not.

What changed:

  • omarchy-migrate lists and runs migrations from the trusted source root, and passes that root to each migration.
  • omarchy-install-browser sources the browser policy helper from the trusted source root.
  • browser-policy.sh installs the default policy files from the trusted source root.
  • The locate migration pins /etc/updatedb.conf instead of forwarding a caller-chosen OMARCHY_UPDATEDB_CONF_PATH into the root shell.

A linked checkout still works when /etc/omarchy.conf is a root-owned regular file whose only line names that checkout, which is what omarchy-dev-link writes. Setting OMARCHY_PATH by hand without omarchy dev link no longer moves the migration queue.

Tests: new test/shell.d/privileged-source-update-test.sh pins the trusted-tree behavior and shows a poisoned OMARCHY_PATH is ignored, with sudo stubbed so nothing touches the real system. migrate-scope and migrate-wrapper now authorize their scratch trees through a stand-in conf, the way omarchy-dev-link would. locate-test runs the pinned migration against a stand-in updatedb.conf. All pass, along with migrate-notify and bin-style.

omarchy-migrate ran every pending migration from $OMARCHY_PATH with the
caller's sudo credentials a prompt away, and omarchy-install-browser
sourced its privileged policy helper and installed the default Firefox
policy from the same caller-controlled path. A caller who points
OMARCHY_PATH at a tree they can write, then types the sudo password for
an update or a browser install, runs their own script as root.

Resolve the source tree with the same rule omarchy-plymouth-set and the
refresh helpers use: the packaged tree is always trusted, and a linked
checkout is trusted only when a root-owned /etc/omarchy.conf names it.
The migrate tests authorize their scratch trees through a stand-in conf
the same way omarchy-dev-link would.
The locate migration forwarded OMARCHY_UPDATEDB_CONF_PATH into the root
shell, so a caller could point the rewrite of locate settings at any
existing file. Pin /etc/updatedb.conf. locate.sh keeps its override for
tests, and sudo does not pass the caller's value through.
@Adolanium

Copy link
Copy Markdown
Contributor Author

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

omarchy-migrate runs as the calling user. Every root step is a fresh sudo password prompt from that same user, who already has full wheel access. Someone who can set OMARCHY_PATH in the session can set PATH too and shim sudo directly. And omarchy-dev-link treats a user-controlled OMARCHY_PATH as trusted by design.

The description also said the refresh helpers already refuse a user-owned source tree. That was wrong. Only omarchy-plymouth-set has that check.

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