Seed Chromium's first-run preferences with a mode the browser can read - #9700
Open
shaynhornik wants to merge 1 commit into
Open
Seed Chromium's first-run preferences with a mode the browser can read#9700shaynhornik wants to merge 1 commit into
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
Author
|
Noting #9070, which retires this seed altogether in favour of a per-user |
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.
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