Skip to content

fix(portal): accept group write access on a group only the user belongs to - #1936

Merged
l0gicgate merged 5 commits into
lgse:mainfrom
pdwaldrop:fix/1921-accept-private-group-writable-install-paths
Oct 30, 2026
Merged

l0gicgate merged 5 commits into
lgse:mainfrom
pdwaldrop:fix/1921-accept-private-group-writable-install-paths

Conversation

@pdwaldrop

Copy link
Copy Markdown
Contributor

Description

On elementary OS, the installer's file manager setup failed with "The Strata executable path must not be writable by other users". secure_executable refuses any path component whose group-write bit is set. Ubuntu-based systems give every user a private group and a umask of 002, so folders such as ~/.local are 0775, owned by the user and writable by a group that only the user belongs to.

Group write access is now accepted when the path's group is described by /etc/passwd and /etc/group and nobody but the current user belongs to it: no other user has it as a primary group and no other member is listed. World write access, shared groups, and groups or users the databases do not describe are still refused, so a setup using LDAP or similar keeps today's behaviour. The check takes the group lookup as a parameter so it can be tested without depending on the machine's accounts.

The installer's failure message and the README sent users to "System file chooser", which is not a Settings row; the row is "System file manager", under Desktop integration. Both now say so, and docs/portal-file-chooser.md states the new rule.

Not changed: the file providers' trusted() check in services/file_providers.rs has the same blanket group-write rule for user-created provider folders. It is a separate feature, so I left it. I did not test on Ubuntu or elementary OS; the fix follows from the reported message, so I used "Part of" below.

Visual evidence

N/A: no UI change.

How to test

  1. On a system with a private group per user and a umask of 002, install Strata to ~/.local/bin so ~/.local and ~/.local/bin are 0775.
  2. Run strata --install-portal, or press Complete setup under Settings → General → Desktop integration → System file manager.

Expected result: setup completes. Before this change it stopped with "must not be writable by other users". Making any path component world-writable, or group-writable by a shared group, still stops it.

Covered by group_write_access_is_accepted_only_on_a_group_nobody_else_belongs_to and a_group_is_private_when_only_the_user_has_it; putting back the old rule, or letting a private group excuse world write access, fails the first. The existing rejection tests now use a fixed group answer, or a world-writable file, so they no longer depend on the account running them.

Related issue

Part of #1921

…gs to

The file manager setup refused any executable path with a group-writable
component, but Ubuntu and similar systems give each user a private group and
a umask of 002, so the user's own ~/.local folders are group-writable and
setup failed with "must not be writable by other users". Accept group write
access when the group is described by /etc/passwd and /etc/group and nobody
but the user belongs to it; world write access and shared or unknown groups
are still refused. Also name the Settings row the installer sends users to
"System file manager", as it appears in Settings.
@github-actions github-actions Bot added the fix label Oct 29, 2026
@l0gicgate

Copy link
Copy Markdown
Contributor

Review notes (/pr-review):

Merged main at 44bfeab30 into the branch (merge commit 6f2600ac6, no conflicts).

Review of the change

  • The new rule is sound: world write is always refused, group write is accepted only when /etc/passwd lists no other user with that primary group and every /etc/group entry for the gid lists nobody but the current user. Unreadable or NSS-only accounts fall back to the old refusal, so LDAP/sssd setups keep today's behaviour.
  • One tightening (47558bca1): the group lookup used any, so a gid that appears on two /etc/group lines was accepted if either line was private. It now requires every entry for that gid to be private, with a table case added to a_group_is_private_when_only_the_user_has_it. Also trimmed the doc comment to the rationale and the "undescribed group counts as shared" rule.
  • Tests: group_write_access_is_accepted_only_on_a_group_nobody_else_belongs_to, the table-driven a_group_is_private_…, and the fixed-answer rewrite of portal_activation_rejects_replaceable_executables all exercise distinct behaviour; nothing tautological to remove. Switching the udiskie rejection test to a world-writable file is the right call so it no longer depends on the account running it.
  • README, installer error text, and docs/portal-file-chooser.md now match the real Settings row (General → Desktop integration → System file manager).

Unrelated fix carried along (057d71bb4): main was failing i18n::catalog_tests::catalogs_cover_all_languages_and_preserve_interpolation because #1837 (administrator browsing) landed after #1918 (Hungarian) without the nine Hungarian strings. Main's push CI skips the test shards, so it only shows up on PRs. Added the missing hu.json and messages/hu.json entries so this PR can go green.

Local verification

  • cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings: clean.
  • Full headless cargo test --all-targets --all-features: 3664 passed, 0 failed, 11 ignored (plus 28 QA harness tests; scenarios need the container).
  • Ran the real secure_executable once against this host's /etc/passwd and /etc/group on a 0775 directory and executable owned by the user's private group: accepted; with the directory world-writable: refused. (Temporary test, not committed.)

CI on 057d71bb4 is green. No visual change, no screenshots.

# Conflicts:
#	data/locales/hu.json
#	data/locales/messages/hu.json
@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up: main moved again (#1935 landed with its own copy of the Hungarian administrator strings), which put this branch into conflict on data/locales/hu.json and data/locales/messages/hu.json.

  • Merged origin/main (fc4d2bbe8) with a merge commit, fa3b9a151. The only conflicts were two Hungarian translations that differed in wording; I kept the versions now on main, so both catalogs are byte-identical to main. No code changed.
  • Verified locally: cargo fmt --all --check and cargo clippy --all-targets --all-features -D warnings are clean; ./scripts/test-headless.py i18n:: (12 passed) and ./scripts/test-headless.py portal_setup:: (51 passed). Scoped validation only, since this merge touched nothing but the two locale files that already match main.
  • CI on fa3b9a151 passed every job (QA scenarios remain dispatch-only on PRs).

The PR is mergeable again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants