Repository navigation
Seed Chromium's first-run preferences with a mode the browser can read - #9700
shaynhornik wants to merge 1 commit into
Conversation
The migration runs under the caller's umask, which sudo keeps, so a bare mkdir and tee under umask 077 left /usr/lib/chromium/initial_preferences root-only. Chromium, running as the user, could not read it and landed back on the terms-of-service dialog the seed exists to skip, while the migration exited 0 and recorded itself done. Write the directory and the seed with explicit modes, the way the SSH keepalive migration already does, and let the existing content check rewrite a seed the old write left unreadable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FTqr6ZjXfNthXT719ag7Qc
|
Noting #9070, which retires this seed altogether in favour of a per-user |
|
Reviewed at 43a2b6c, against Reproduced on a disposable Omarchy worker with real Tests on the worker. Second opinion (Codex Medium). It agreed the bug is real and the fix proportionate, though its independence is not guaranteed. It found no defect in the migration. It suggested making the test stricter: check that the destination was actually rewritten before running anything, and cover a seed whose content already matches but cannot be read. Neither changes what reaches a user. The real- Overlap. #9070 rewrites this same migration so it removes the seed instead, and the two will conflict. This migration is not in a tagged release yet, so changing it in place reaches every machine that has not run it. Waiting on the maintainer: whether this lands as the interim fix ahead of #9070. |
Problem
migrations/1787691200.sh(from #8203) writes the Chromium first-run seed withsudo mkdir -pandecho | sudo tee, with no mode.omarchy-migrateruns migrations as the user under the caller's umask, and sudo keeps it: sudoers applies the union of the caller's umask and its own 0022. Underumask 077the seed lands as-rw------- root rootinside a0700directory. Chromium, running as the user, cannot read it, the terms-of-service dialog the migration exists to skip comes back, and the migration exits 0 and records itself done. Underumask 027the file is0640, unreadable to anyone outside group root, which is the same failure. A second user's run cannot repair it either: theircatfails, and the rewrite produces the same modes.The repo already treats this as a house rule.
migrations/1786278735.shsets explicit modes for exactly this reason ("so a restrictive user umask cannot leave the root-owned drop-in unreadable to the unprivileged ssh client"), and the FIDO2 migration from #7904 repairs the samesudo mkdir -pumask union.Change
Create the directory with
install -d -m 755and the seed withinstall -m 644 -T /dev/stdin, following the keepalive migration and the upgrade command's owninstall -d -m 0755for this directory. The existing content check keeps the migration idempotent, and it now doubles as repair: on a machine the old write already hit, the user'scatfails, the seed is rewritten readable, andinstall -dputs the directory back to 755. The 3.x upgrade path writes the same seed with a bareteeand then runsomarchy-migrate, so this migration repairs that copy as well.Verification
test/shell.d/chromium-first-run-seed-migration-test.sh, in the retargeted-copy style of the sshd hardening and FIDO2 migration tests: asudostub that logs and execs, the one path literal rewritten to a scratch tree (asserted to occur exactly once), every scenario underumask 077. It checks seed content and modes on a fresh machine (644 file, 755 directory), no privilege calls on a rerun, and repair of a root-only 0700/000 leftover. Passes locally, 3 ok.quattroproduces700and600, so the test fails without the fix.migrate-wrapper,migrate-notify,sshd-hardening-migration, andsecurity-fido2-migrationtests still pass. The eight./test/shellfiles that fail on this machine fail identically on pristinequattro(host assumptions: a siblingomarchy-pkgscheckout,rg, hardware tools) and are unrelated.Written with Claude Code; I reviewed the change and ran the tests above locally.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FTqr6ZjXfNthXT719ag7Qc