Skip to content

Feature: Opt-in NixOS module for polkit root actions - #137

Merged
MemerGamer merged 2 commits into
mainfrom
linux/nix-root-module
Oct 9, 2026
Merged

MemerGamer merged 2 commits into
mainfrom
linux/nix-root-module

Conversation

@MemerGamer

Copy link
Copy Markdown
Owner

Resolved / Related Issues

Steps used to test these changes

  1. dotnet build tests/Files.Platform.Tests -warnaserror and dotnet test (1135 passed), including new NixElevationTrustTests (sticky root store accepted only with immutable root-owned entries; user-owned/writable store entries, broken or mismatched deployment manifest/policy, retained old authorization and untrusted symlink traversal all fail closed; exact store helper is previewed/invoked and an old-generation plan is refused).
  2. python3 -m unittest scripts/linux/tests/test_host_root_helper.py (4 passed).
  3. NOT verified: nix flake check / NixOS module evaluation (no nix or nix-portable available to the agent), and no NixOS VM or headless polkit run. Please run nix flake check before merging.

What changed

  • nixosModules.default with opt-in programs.linuxfiles.rootActions (default off): packaged AOT helper kept, polkit action with exact store exec.path, /etc/linuxfiles/root-actions manifest, pkexec wrapper (enablePkexecWrapper or security.wrappers.pkexec; helper is never setuid). Plain nix run/profile keeps all root actions disabled.
  • Trust: /run/wrappers/bin and /run/current-system/sw/bin searched first; every symlink hop and target must be root-owned; only /nix/store itself (root, sticky, not other-writable) is exempt from the writable check, entries below must be root-owned and not user/group/other writable. Existing checks kept. An installed manifest is authoritative (no fallback to /usr/lib after a broken generation).
  • scripts/linux/install-host-root-helper.py (explicit sha256, literal argv, never alters Flatpak/AppImage sandbox) plus README/packaging.md.

Residual risks

  • /nix/store is group-writable by nixbld; members of that group (build users) are trusted by this exception. Single-user/user-owned stores are rejected (root actions off).
  • Checks are lstat-then-use (TOCTOU) on a root-controlled tree; store entries are immutable, but a root-compromised host is out of scope.
  • The alpha2 release pin predates manifest discovery; root file operations need the next native release.
  • AppImage/Flatpak still show no root actions even with the host helper installed; the script only provisions the host.
  • Module/flake evaluation untested (see above).

🤖 Generated with Claude Code

MemerGamer and others added 2 commits October 9, 2026 17:53
Co-Authored-By: GPT-6.1-sol (OpenAI Codex) <noreply@openai.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016FAtbHHLQSiJiYcw2vnKiq
Co-Authored-By: GPT-6.1-sol (OpenAI Codex) <noreply@openai.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016FAtbHHLQSiJiYcw2vnKiq
@MemerGamer
MemerGamer merged commit 91744c8 into main Oct 9, 2026
3 checks passed
@MemerGamer
MemerGamer deleted the linux/nix-root-module branch October 9, 2026 20:42
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.

Feature: Root actions in the Nix flake and other packages

1 participant