Apply organization rate limits to GraphQL and web actions
What does this MR do and why?
Adds per-user limits to organization actions in the REST API, GraphQL and the web interface, and applies existing organization limits to the GraphQL and web paths that skipped them.
| Limit | Applies to | Key |
|---|---|---|
| 5 per minute per user | Deleting an organization: DELETE /organizations/:id, organizationDelete |
organization_delete |
| 5 per minute per user | Restoring an organization: POST /organizations/:id/restore, organizationRestore |
organization_restore |
| 5 per minute per user | Confirming an organization created from a group: organizationConfirm |
organization_confirm |
| 20 per minute per user | Updating an organization: organizationUpdate |
organization_update |
| Existing, configurable (default 10) | Creating an organization: now also organizationCreate and creating one from a group, linked or not |
create_organization_api |
| Existing, 20 per minute | organizationUserUpdate and organizationUserDelete, shared with the REST endpoints |
organization_user_update, organization_user_delete |
This brings these actions in line with the existing limits on similar actions.
- The four new limits are staged rules behind the
organization_rate_limitfeature flag, which is disabled by default. While the flag is off, requests over the limit are logged but not blocked. - The existing create and organization user limits are already enforced in the REST API, so their new GraphQL and web checks are skipped while the flag is off.
- Each action has its own key. In the create-from-group flow,
organizationConfirmruns after the organization is created, so deletes or restores can no longer use up its budget and leave the new organization without its groups. - The limits are checked after authorization.
DELETE /organizations/:idnow checks permission before the limit and returns the same403"Insufficient permissions" error as before. - Each new rule has a contract entry in
config/rate_limits/unowned.yaml. The docs list them in the non-configurable rate limits, and say which paths need the flag.
Production traffic
Organization writes per user per minute on 2026-11-30, for the endpoints and mutations above:
| Surface | Hours that returned | Requests |
|---|---|---|
| REST | 20 of 24 | 0 |
| GraphQL and web | 10 of 24 | 0 |
Organizations are an experiment, and organization writes are rare, so these limits shouldn't affect normal use. The rest of the hours timed out in Kibana.
References
- Rollout issue: #635776
Screenshots or screen recordings
Not applicable, there are no UI changes.
How to set up and validate locally
-
As an organization owner, run the
organizationUpdatemutation more than 20 times in a minute. -
With the flag disabled, the requests aren't blocked.
log/development_json.logshowsapplimiter_organization_update:limit_organization_updates_by_user_loginrate_limit_state. -
Enable the feature flag in the Rails console:
Feature.enable(:organization_rate_limit) -
Repeat the requests. Requests over the limit return a rate limit error.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.