Skip to content

Support secure graphical sudo prompts for agent commands #27

Closed

Description

@ElbertePlinio

Agent plan

Goal: let privileged PickLab provisioning and agent-run commands request user approval through the desktop without exposing the sudo password.

Checklist:

  • Define Linux askpass capability detection (SUDO_ASKPASS, KDialog/Zenity, graphical session)
  • Make ProvisioningStep.privileged affect execution instead of remaining metadata-only
  • Invoke privileged commands with sudo -A and an explicit askpass environment
  • Treat cancellation, missing GUI, and headless sessions as clear actionable errors
  • Never capture, log, persist, or pipe the password through PickLab
  • Add executor tests for available, unavailable, and cancelled askpass paths
  • Document the Linux behavior and manual fallback
  • PR/review

Validation:

  • Focused executor and CLI tests
  • End-to-end Linux smoke test with a harmless sudo -A -v
  • Confirm command logs contain no credential material

Current status: Planned
Next action: design the privilege-execution contract around packages/cli/src/provision/executor.ts and ProvisioningStep.privileged.

Activity

  1. ElbertePlinio commented on Jul 12, 2026

    @ElbertePlinio
    MemberAuthor

    Pickforge integration is tracked separately in #215. Keep the privilege-execution contract compatible across both repositories.

  2. ElbertePlinio commented on Jul 23, 2026

    @ElbertePlinio
    MemberAuthor

    Shared graphical sudo (askpass) security contract — locked v1

    Shared semantics for #215 and picklab#27. Both implementations follow this contract; product-specific wiring (PickForge PTY/session backends, PickLab provisioning executor) differs only where noted.

    Scope. Linux graphical sessions only. macOS/Windows are out of scope for this release and must be documented as such, not half-supported.

    Capability detection (pre-flight, before any privileged spawn).

    • Graphical session = WAYLAND_DISPLAY or DISPLAY present in the resolved user environment.
    • Askpass helper resolution order: (1) user-set SUDO_ASKPASS if it points to an executable file; (2) first existing helper from a fixed, documented probe list (ksshaskpass, ssh-askpass, lxqt-openssh-askpass, standard distro paths). No dynamic discovery beyond that list.
    • Pickforge products never ship, generate, or install their own askpass helper. Only reference existing system helpers.
    • Detection timing: PickForge detects before spawning agent shells; PickLab detects at provisioning execution time. Failure to detect is a distinct, observable state (see failure semantics).

    Execution.

    • Privileged commands run with sudo -A and an explicit SUDO_ASKPASS in the child environment. SUDO_ASKPASS is the only environment variable the feature may inject.
    • Never sudo -S, never stdin piping, never pseudo-typing into prompts, never rewriting the user's command beyond guidance to use sudo -A.
    • Helper stdout/stderr belongs to sudo; the product must not capture, parse, store, or forward it.

    Credential boundary.

    • The password path is strictly user ↔ helper ↔ sudo. No capture, no clipboard, no persistence, no logging, no telemetry, no chat/session events, no crash reports.
    • Prompt text is treated as sensitive: it never enters stored events or reports.

    Failure semantics (all fail closed).

    • Headless or no helper → fail fast pre-flight with an actionable error naming the manual fallback (run the command in a terminal). Never fall back to interactive password capture.
    • User cancellation / auth failure at runtime → command fails with a clearly surfaced cancelled/denied state; no automatic retry loop; nothing persisted.
    • Timeout → kill the spawned process group; never attempt to answer or dismiss prompts programmatically.

    Verification (both repos).

    • Executor/process tests for: helper available, helper missing, headless session, cancellation.
    • Environment-propagation test proving only SUDO_ASKPASS is injected.
    • A redaction assertion proving logs, telemetry, and stored events contain no credential material or prompt text.
    • Linux smoke: harmless sudo -A -v success and cancellation from a product-launched flow.

    Non-goals. No polkit integration, no custom helpers, no privilege caching, no cross-platform prompts in this release.

  3. ElbertePlinio commented on Jul 23, 2026

    @ElbertePlinio
    MemberAuthor

    Orchestrator sign-off on the contract's Linux smoke requirement (raised as a P2 by the review panel — correctly insisting this be an explicit decision, not a release-note footnote): the harmless sudo -A -v success AND cancellation smoke from a product-launched flow is formally deferred to the release-candidate phase on Elberte-PC, same handling as #215 (merged via #258 with the identical deferral). This issue stays OPEN after the implementation PR merges, with the hardware smoke as its remaining checklist item. All other locked-contract verification classes (four capability states, env-propagation single-key proof, redaction assertion, cancellation classification via a real spawned stand-in, arg-array safety) are implemented and green in CI-runnable tests.

  4. ElbertePlinio commented on Jul 23, 2026

    @ElbertePlinio
    MemberAuthor

    Owner-run RC smoke passed on Elberte-PC (2026-07-23) in a graphical session on the target machine: picklab setup lab-user (installed from current main, 0.2.0@09fcd78) drove its sudo steps through the graphical askpass flow and completed successfully — owner-reported, including the prescribed cancel path behaving cleanly. The lab user is now provisioned on Elberte-PC as a side effect, which was wanted anyway.

    Closes the evidence gate on the shared locked askpass contract v1 (see #215 for the sibling closure and the residual physical-seat note).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions