Skip to content

hits_addend causes counter pollution across multiple descriptors in a single RateLimitRequest #1060

@austinmacrbx

Description

@austinmacrbx

When Envoy sends a RateLimitRequest containing multiple descriptors, the Rate Limit Service applies the hits_addend to every descriptor in the list. If a request matches both a granular policy (granular_user_limit) and a broad policy (broad_site_limit), and the granular policy is already OVER_LIMIT, the broad policy's counter is still incremented.

This results in counter pollution, where unauthorized/blocked traffic consumes the quota of the broad policy, potentially leading to a Denial of Service for legitimate users who share the broad quota but have not hit their own granular limits.

{
  "domain": "api_service",
  "descriptors": [
    {
      "entries": [
        { "key": "policy", "value": "broad_site_limit" }
      ]
    },
    {
      "entries": [
        { "key": "policy", "value": "granular_user_limit" },
        { "key": "user_id", "value": "user_99" }
      ]
    }
  ],
  "hits_addend": 1
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions