Skip to content

feat(browser): open unreadable local folders as administrator - #1837

Merged
l0gicgate merged 8 commits into
mainfrom
feat/1836-admin-folders
Oct 29, 2026
Merged

l0gicgate merged 8 commits into
mainfrom
feat/1836-admin-folders

Conversation

@ogarza

@ogarza ogarza commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Description

Strata can now open local folders the user can't read, such as a backup tool's root-owned folder on an external drive, through GVfs's admin:// backend, as GNOME Files does. Polkit asks for the password, and Strata itself never runs as root.

  • Marking. Folders the user can't read or enter show a lock icon (Lucide folder-lock) and are described as "Folder that requires administrator access". The background metadata fill learns this with access(2), and bound rows refresh in place in all three views.
  • Opening. Opening such a folder switches the tab to its admin:// form. That means the click that opens folders, Enter, → or the context menu's Open. Validation runs the first admin operation, so polkit prompts while the current folder is still open.
  • Refusals. GVfs reports a dismissed or refused prompt as PERMISSION_DENIED, both when mounting and on each operation. Strata treats that as "not authorized" and stays silent. It never shows its own password form for admin://.
  • Permission errors. A typed path, the sidebar, arrow-key selection and List/Icons panes now offer Open as Administrator in the dialog, column or pane. The location bar accepts admin://. The button is offered only where GIO supports the scheme, and never in the system file chooser.
  • Admin listings. They show an "Administrator" breadcrumb root and a notice that new items belong to root and deleted items skip Trash.
  • Trash. The admin backend reports access::can-trash but has no trash operation, so admin columns report Trash as unavailable up front:
    • Delete opens the local permanent-delete confirmation, which states the reason.
    • The sidebar Trash refuses drops from admin folders.
    • Copies and merges into admin folders record no Trash-based Undo.
    • A confirmed Replace overwrites a file in place, and Merge isn't offered.
  • Disabled on purpose, and documented:
    • Thumbnails. They would persist root-only images in ~/.cache/thumbnails.
    • Open and Open With. GVfs grants the admin mount only to the requesting process, and admin files have no local path. They explain this instead of launching another application.
  • Docs and translations. New docs/administrator-access.md, with the Trash, keyboard and 10xer docs and the README updated. New strings are translated into all twelve languages.

Known limitations

  • Strata can't unmount its admin mount: it is private to the process, and GVolumeMonitor and g_file_find_enclosing_mount don't see it.
  • Replacing a local file with one copied from an admin folder still reports "Safe replacement is unavailable for this source", as for other non-local sources. Keep Both works.
  • The pinned QA container has no GVfs or polkit agent, so the real prompt and admin browsing were checked by hand only.

Visual evidence

N/A: agents can't attach images. The lock icon, Administrator breadcrumb and notice are described above.

How to test

  1. Create a root-only folder on a drive you can browse:
    sudo mkdir /run/media/$USER/<drive>/backups && sudo chmod 700 /run/media/$USER/<drive>/backups.
  2. Open its parent in Strata (Columns). backups shows a lock icon.
  3. Click backups and cancel the polkit prompt.
  4. Click it again and authenticate.
  5. Select a file inside it and press Delete, then cancel.
  6. Press Enter on a file inside it.
  7. Go back to the parent, then move onto backups with ↓/↑.

Expected result:

  • Cancelling (step 3) leaves the parent folder open, and nothing else appears.
  • Authenticating (step 4) switches the tab to admin:///run/media/$USER/<drive>/backups, with an Administrator breadcrumb root and the "Browsing as administrator" notice.
  • Delete (step 5) shows the permanent-delete confirmation with "Trash isn't available when browsing as administrator.", with Cancel focused.
  • Enter on a file (step 6) explains that other applications can't open files in a folder opened as administrator.
  • Arrowing onto the folder (step 7) shows the permission error in the next column with Open as Administrator, without a prompt.

Related issue

Closes #1836

Folders the user can't read or enter show a lock icon. Opening one
switches the tab to its admin:// form, where GVfs asks polkit for
administrator access. Permission errors offer Open as Administrator in
the error dialog and on the column and pane error pages. A dismissed or
refused polkit prompt is silent. Admin listings show an Administrator
breadcrumb root and a notice that changes are made as root.

Refs #1836
GVfs's admin backend has no trash operation but reports can-trash, so
admin columns report Trash as unavailable up front. Delete opens the
local permanent-delete confirmation with the reason, the sidebar Trash
refuses drops from admin folders, copies and merges into them record no
Trash-based undo, a confirmed Replace overwrites a file in place, and
Merge is not offered there.

Refs #1836
Files in admin folders get no thumbnails, so root-only images never land
in the user's thumbnail cache. Open, Open With and the Open With
shortcut explain that other apps can't open them instead: GVfs grants
the admin mount only to the process that asked for it.

Refs #1836
Metadata fills patch bound rows without rebinding them, so a folder the
fill finds unreadable now swaps to the lock icon and its accessible
description in Columns, List and Icons. A click in Columns opens a
folder, so it goes through the same administrator redirect as Enter.

Refs #1836
@ogarza ogarza added the enhancement New feature or request label Oct 23, 2026
@ogarza ogarza self-assigned this Oct 23, 2026
@l0gicgate
l0gicgate marked this pull request as ready for review October 25, 2026 04:00
@l0gicgate

Copy link
Copy Markdown
Contributor

Review

Merged main (b97d8349) into the branch with a merge commit; no conflicts.

Fixed: the merge brought two new FileEntry fixtures from main (local_preview/tests/model_preview.rs from #1864 and local_preview/tests/route_preview.rs from #1842) that lacked this PR's new listable field, so cargo test --all-targets no longer compiled. Added the field in 91619bbb2. No other code changes were needed.

Reviewed the full diff against the updated main: the access(2)-based listable fill and in-place row refresh in all three views, the LoadState::Denied column state and Open as Administrator offers (dialog, column, List/Icons pane), the admin:// redirect on every open route (activate, activate_in_place, activate_focused), the PERMISSION_DENIED → not-authorized mapping for validation and mounting, the Trash policy (reach, up-front confirmation, drop refusal, undo suppression, in-place replace, no Merge), thumbnail and Open/Open With refusals, the breadcrumb root and notice, session-restore exclusion, docs and all twelve catalogs. No merge blockers found.

Tests: every test the PR adds exercises observable behaviour (error mapping, metadata marking on a 000 folder, activation routes, undo policy, URI escaping, mount-error classification, delete confirmation, restore exclusion, the QA description wait); none removed. Comments: all added comments explain GVfs/polkit constraints or non-obvious policy; none removed.

Non-blocking notes

  • Issue feat(browser): open unreadable local folders as administrator via admin:// #1836 also asks that Strata's own background work (freshness polling, count/size fills) stay off admin:// so an expired polkit grant never prompts unasked. remote_stamp already treated admin as having no outside writers before this PR, so columns with a GIO monitor are not polled, but metadata fills on visible admin rows still go through GIO. Worth a follow-up issue rather than a blocker here.
  • The real polkit prompt and admin browsing cannot run in the pinned QA container, as the description says; they remain hand-checked only.

Local verification (review worktree on the merged head)

  • cargo fmt --all --check and cargo clippy --all-targets --all-features -- -D warnings: clean.
  • ./scripts/test-headless.py (full native suite): 3557 passed, 0 failed, 11 ignored.
  • ./scripts/qa.sh --test-threads 6 (every scenario, every mode): 580 passed, 0 failed.

CI: the PR is a draft, so the pull_request runs skip every job. I dispatched the workflow by hand on this branch instead: https://github.com/lgse/strata/actions/runs/40159359925. Every job passed. The first attempt failed one QA run, return-restores-nested-scroll/icons (Alt+Up viewport restore timed out), which is unrelated to this change: it passed 4/4 times locally and on the rerun, and directories in Icons already requested a metadata fill before this PR, so the new field adds no layout work there. The checks on the PR itself stay "skipping" until the PR leaves draft.

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

Labels

enhancement New feature or request feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(browser): open unreadable local folders as administrator via admin://

3 participants