Rate limiting

From RedHatProductSecurity/prodsec-skills · View interactive version

Rate limiting is an AI agent skill from the GitHub repository RedHatProductSecurity/prodsec-skills. Enforce rate limiting at the API gateway to protect AI models from extraction attacks. Use when designing, building, or reviewing API gateways that protect inference engines or LLM endpoints.

How to use this skill

Skill file

Rate Limiting at the API Gateway

Security Requirement

API gateways protecting AI models SHOULD implement rate limiting. This is a critical defense against attacks that require sending large volumes of requests to the models.

Attacks Mitigated by Rate Limiting

| Attack | Description |

|---|---|

| Model data extraction | Attempting to extract sensitive information the model learned during training |

| Training data extraction | Reconstructing training data from model responses |

| Token extraction | Stealing API tokens or credentials through repeated probing |

| Weight extraction | Reverse-engineering model weights through systematic queries |

| Prompt injection probing | Brute-forcing prompt injection payloads |

These attacks typically require sending thousands to millions of requests. Rate limiting makes them impractical or too slow to be worthwhile.

Rate Limiting Strategies

| Strategy | Use Case |

|---|---|

| Per-user/principal | Limit requests per authenticated user over a time window |

| Per-IP | Limit unauthenticated or pre-auth requests by source IP |

| Per-endpoint | Different limits for different model endpoints based on sensitivity |

| Adaptive/dynamic | Adjust limits based on detected anomalous patterns |

| Token-based | Limit based on input/output token consumption, not just request count |

Implementation Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.