Skip to content

Route pkg/platform's inlined sudo -n through the elevation model #527

Open

Description

@David-Noble-at-work

Reframed 2026-10-21 (schedule #1127, iteration 1): pkg/platform's runCommand(argv, sudo bool) and runWindowsCommand(command, elevated) go; each manager backend declares the account its commands need (root for apt, dnf, pacman, systemctl, port, system launchctl; the caller for brew and a user agent) and obtains its session through the broker's client interface (#1129), the stub in this iteration. NeedsSudo() becomes that declaration. 6.2 § Ruled, 6.1-authorization § Problem space.

pkg/platform/helpers_unix.go inlines exec.CommandContext(ctx, "sudo", "-n", "bash", "-c", command) when
a backend reports NeedsSudo(), under a TODO naming this task.

Two defects ride along, both recorded in 6.2:

  1. It bypasses pkg/process, the declared single bridge to os/exec — no narration, no dry-run, no
    result pipeline.
  2. It uses context.Background(), so cancelling a run never reaches a package install.

sudo -n also fails rather than elevates: an operator without cached credentials gets a hard failure
and no path forward — the gap a policy-governed session closes.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions