Skip to content

PTY child process inherits the daemon environment unsanitized #1521

Closed

Description

@malibio

Overview

Spawned PTY agent CLIs inherit the daemon full environment with no env_clear or allowlist, so any secrets present in the daemon environment are visible to third-party agent CLIs.

Problem Statement

The spawn is injection-safe (no shell, prompt is a single argv entry), but the child sees the whole environment. Low risk under single-user-local, but unnecessary exposure.

Proposed Solution

env_clear() then pass an explicit allowlist (HOME, PATH, TERM, and per-agent auth vars) to the spawned process.

Acceptance Criteria

  • PTY children receive an explicit environment allowlist, not the full inherited env
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • packages/agent/src/pty/session.rs (~201-207)
  • Context: ADR-032

Related Issues

  • (none)

Activity

  1. malibio commented on Jul 6, 2026

    @malibio
    CollaboratorAuthor

    Baseline — Frontend: 147 test files / 3948 tests passed (44s)

  2. self-assigned this
    on Jul 6, 2026
  3. added a commit that references this issue on Jul 6, 2026
    920e5cf
  4. malibio commented on Jul 23, 2026

    @malibio
    CollaboratorAuthor

    July 2026 review: the PTY path is now confirmed done (env_clear() + allowlist at both PTY spawn sites, tested). One spawn site remains unscrubbed — the tray UI-binary spawn at packages/daemon/src/tray.rs:284 (Command::new(path).spawn(), no env_clear()). Please extend this issue to cover that site, or close if you'd prefer it tracked separately.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions