Skip to content

security(terminal): command approvals take the approver from the request body/WS payload (or record none) — a command's run is approved by a forgeable identity #17052

Description

@mrveiss

What

Approving a pending terminal command lets that command run. Three paths approve commands, and none of them records a trustworthy approver:

  1. api/agent_terminal.py, the approve-command route (around line 515): current_user = Depends(get_current_user) is injected but unused for attribution. service.approve_command(..., user_id=request.user_id, ...) takes the approver from the request body (TerminalApproveCommandRequest.user_id), so any authenticated caller can claim to be any user.
  2. api/websockets.py _handle_command_approval (around lines 410-435): user_id = data.get("user_id", "web_user"). The approver comes from the WebSocket message payload, with a hard-coded fallback when it's absent.
  3. api/security.py approve_command (around line 73): admin-gated at the router (check_admin_permission), but security_layer.approve_command(command_id, approved) records no approver at all.

All three reach services/command_execution_queue.approve_command(command_id, user_id, comment), which records whatever user_id it's given.

Not yet determined: whether paths 1 and 2 check that the approving user owns the session whose command is pending, or whether any authenticated user can approve another user's agent's command. Treat it as unverified until traced.

Found by the #17043 implementer (same class as #17042). Owner rules (2026-09-18, #17038): approvals are made by a human, and every decision leaves a trustworthy paper trail.

Acceptance criteria

Activity

  1. added this to the v0.9.0 milestone on Sep 18, 2026
  2. mrveiss commented on Sep 18, 2026

    @mrveiss
    OwnerAuthor

    AC5 linkage: the proposal to keep command approvals separate from #17043, sharing the human-decider predicate and the verified-approver rule, is posted on #17043 and written into api/agent_terminal_access.py's docstring. It's pending confirmation from #17043's owner.

  3. mrveiss commented on Sep 20, 2026

    @mrveiss
    OwnerAuthor

    AC verification against merged main (post #17134 security train merge)

    New module autobot-backend/api/agent_terminal_access.py centralizes this for all 3 paths:

    All 5 satisfied. Closed correctly.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions