Skip to content

[SECURITY] Per-org queue quotas and fair scheduling so one tenant cannot starve the others #197

Backlog

Description

@OkiriGabriel

Problem

All orgs share one queue worker that processes incidents serially. Rate limiting (api/rate_limit.py) is keyed by client IP and path. Nothing limits how much work a single org can queue, so one tenant (or a leaked per-org webhook secret, or a noisy alert rule) can:

  • fill the queue and delay every other tenant's incidents by hours,
  • spend the platform's LLM budget when the org has no key of its own.

Proposed fix

  • Add a per-org cap on pending incidents (ORG_MAX_PENDING_INCIDENTS, e.g. 50). Over the cap, return 429 with Retry-After and record devops_agent_incidents_rejected_total{org,reason="quota"}.
  • Add a per-org rate limit on enqueue (ORG_INCIDENTS_PER_MINUTE) in addition to the per-IP limit.
  • Make the worker pick fairly across orgs (round-robin over orgs with pending work) instead of global FIFO.
  • Add a Grafana panel for queue depth per org.
  • Tests: the cap gives 429; round-robin ordering; an org at its cap doesn't block other orgs.

Files

services/incident_queue.py, api/server.py (enqueue_incident, worker loop), services/metrics.py, docs/GRAFANA_PROMETHEUS.md

Activity

  1. added
    enhancement
    security
    on Nov 25, 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

    enhancementsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions