Skip to content

fix: operator-queue endpoint leaks other users' agent approval prompts #470

Closed

Description

@vybe

Summary

The `GET /api/operator-queue` endpoint returns operator queue items (pending agent approval prompts) for all agents on the platform, regardless of whether the requesting user owns or has access to those agents. A regular authenticated user can read — and potentially respond to — approval requests belonging to other users' agents.

Context

Identified during pentest remediation (High severity, 3.1.3 Broken Access Control [User]). The pentest screenshot confirms a user querying `GET /api/operator-queue?limit=200` and receiving items from agents they do not own, including the literal shell command pending approval (`ping -c 4 8.8.8.8`).

This is blocking the Letter of Attestation (A grade) from the security vendor.

Acceptance Criteria

  • `GET /api/operator-queue` filters results to agents the requesting user owns or has been shared access to (same access model as `GET /api/agents`)
  • `GET /api/operator-queue/stats` applies the same user-scoped filter
  • `GET /api/operator-queue/agents/{name}` enforces that the requesting user has access to `{name}`
  • `GET /api/operator-queue/{id}` returns 403 if the item belongs to an agent the user cannot access
  • `POST /api/operator-queue/{id}/respond` returns 403 if the user cannot access the owning agent
  • `POST /api/operator-queue/{id}/cancel` returns 403 if the user cannot access the owning agent
  • Admin users continue to see the full queue (no regression)
  • Existing `test_operator_queue` tests pass; add test for cross-user isolation

Technical Notes

Fix lives in `src/backend/routers/operator_queue.py`. The query in `db/operator_queue.py` (or equivalent) needs a JOIN or subquery against `agent_ownership` + `agent_sharing` filtered by `current_user.id`, mirroring the pattern used in `routers/agents.py` `list_agents`. Admin bypass: `current_user.role == "admin"` skips the filter.

Related: the Operating Room UI page (`/operating-room`) also renders these items — confirm the frontend filter follows from the fixed API response rather than needing its own change.

Activity

  1. added
    priority-p1
    type-bug
    status-in-progress
    on Apr 23, 2026
  2. added
    complexity-low
    theme-security
    on Jun 3, 2026
  3. removed
    status-in-progress
    on Aug 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

    complexity-lowpriority-p1theme-securitytype-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions