Skip to content

security: bound external command execution time and output #13

Closed

Description

@abruption

Problem

runCommand() invokes tools such as lsof and ps without a timeout or output limit. A hung command or unbounded output can stall inspection indefinitely or consume excessive memory. --timeout-ms currently limits only the wait after SIGTERM.

Security and reliability impact

A local tool replacement, pathological process table, or stalled OS utility can deny service to list, inspect, or unlock. A timeout must remain uncertainty and must never be interpreted as absence or a released lock.

Required behavior

Add bounded execution for every external command:

  • explicit per-command deadline
  • bounded stdout and stderr capture
  • deterministic child termination and cleanup on timeout/overflow
  • structured timeout/output-limit errors
  • propagation to unknown or refusal at every safety decision

Keep the existing unlock termination timeout semantically separate from diagnostic subprocess limits.

Tests

Use controlled fixture commands to cover:

  • command completion within limits
  • timeout and cleanup
  • stdout and stderr overflow
  • spawn failure
  • lock/process classification remaining fail closed after command errors

Activity

  1. added
    enhancement
    on Sep 20, 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

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions