Skip to content

fix(security): the async process runner redacts telemetry and kills the process group on timeout #780

Closed

Description

@dan-petty

Context & Rationale

run_subprocess_async (core/process.py:345-498) has drifted from run_subprocess. It puts the first eight raw argv items into its telemetry summary (:380), where the sync path calls _sanitize_command_for_telemetry (:239), so a token passed as an argument can reach traces. On timeout it calls proc.kill() on the direct child only (:421), which can leave grandchildren such as pytest workers running.

Scope & Deliverables

  • Deliverable: the async path sanitizes the telemetry command the same way as the sync path, and a timeout kills the whole process group. Tests cover a secret-bearing argv and a child that starts its own child.
  • Constraint: none.

Strategic Alignment

Activity

  1. added
    type/security
    scope/cli
    priority/p1-high
    on Oct 1, 2026
  2. added this to the v0.2.28 milestone on Oct 1, 2026
  3. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Consolidation (2026-10-03): this item is a sub-issue of #775 (one process runner) and its first stage. P1 and v0.2.28 are unchanged, and it ships on its own schedule.

    Proposed widening, for a person to accept: the sync path's subprocess.run(timeout=) also kills only the direct child. A group kill in the async path alone would add a new divergence between the two runners. Proposed criterion:

    • Move the guarded _terminate_process_group from sandbox/host.py:58-72 into core/process.
    • Use it in both runners' timeout paths, with the child started under start_new_session=True.
    • Route both runners' telemetry through _sanitize_command_for_telemetry.

    A new session stops a terminal Ctrl-C from reaching the child. So the change either forwards SIGINT and SIGTERM to the group, or applies only on the timeout path.

  4. dan-petty-bot commented on Oct 6, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1264, merged into release/v0.2.28 as d178417.

    Context & Rationale

    run_subprocess_async in src/devops_cli/core/process.py had drifted from run_subprocess:

    1. It joined the first eight raw argv elements directly into cmd_summary without sanitization, leaking sensitive arguments or credentials into telemetry trace attributes.
    2. On timeout, it called proc.kill() solely on the direct child process without isolating the child into a dedicated session, leaving grandchild processes running as orphaned background leaks.

    4 file(s) changed.

    How it was verified

    Check runs at 1132d1f:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Analyze (actions): pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-780-async-process-runner-telemetry-redaction-and-pgid-kill.md:

    No Acceptance Criteria section.

  5. added a commit that references this issue on Oct 7, 2026
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

    priority/p1-highscope/clitype/security

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions